forked from ordinals/ord
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
758 additions
and
30 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
Metadata | ||
======== | ||
|
||
Inscriptions may include [CBOR](https://cbor.io/) metadata, stored as data | ||
pushes in fields with tag `5`. Since data pushes are limited to 520 bytes, | ||
metadata longer than 520 bytes must be split into multiple tag `5` fields, | ||
which will then be concatenated before decoding. | ||
|
||
Metadata is human readable, and all metadata will be displayed to the user with | ||
its inscription. Inscribers are encouraged to consider how metadata will be | ||
displayed, and make metadata concise and attractive. | ||
|
||
Metadata is rendered to HTML for display as follows: | ||
|
||
- `null`, `true`, `false`, numbers, floats, and strings are rendered as plain | ||
text. | ||
- Byte strings are rendered as uppercase hexadecimal. | ||
- Arrays are rendered as `<ul>` tags, with every element wrapped in `<li>` | ||
tags. | ||
- Maps are rendered as `<dl>` tags, with every key wrapped in `<dt>` tags, and | ||
every value wrapped in `<dd>` tags. | ||
- Tags are rendered as the tag , enclosed in a `<sup>` tag, followed by the | ||
value. | ||
|
||
CBOR is a complex spec with many different data types, and multiple ways of | ||
representing the same data. Exotic data types, such as tags, floats, and | ||
bignums, and encoding such as indefinite values, may fail to display correctly | ||
or at all. Contributions to `ord` to remedy this are welcome. | ||
|
||
Example | ||
------- | ||
|
||
Since CBOR is not human readable, in these examples it is represented as JSON. | ||
Keep in mind that this is *only* for these examples, and JSON metadata will | ||
*not* be displayed correctly. | ||
|
||
The metadata `{"foo":"bar","baz":[null,true,false,0]}` would be included in an inscription as: | ||
|
||
``` | ||
OP_FALSE | ||
OP_IF | ||
... | ||
OP_PUSH 0x05 OP_PUSH '{"foo":"bar","baz":[null,true,false,0]}' | ||
... | ||
OP_ENDIF | ||
``` | ||
|
||
And rendered as: | ||
|
||
``` | ||
<dl> | ||
... | ||
<dt>metadata</dt> | ||
<dd> | ||
<dl> | ||
<dt>foo</dt> | ||
<dd>bar</dd> | ||
<dt>baz</dt> | ||
<dd> | ||
<ul> | ||
<li>null</li> | ||
<li>true</li> | ||
<li>false</li> | ||
<li>0</li> | ||
</ul> | ||
</dd> | ||
</dl> | ||
</dd> | ||
... | ||
</dl> | ||
``` | ||
|
||
Metadata longer than 520 bytes must be split into multiple fields: | ||
|
||
``` | ||
OP_FALSE | ||
OP_IF | ||
... | ||
OP_PUSH 0x05 OP_PUSH '{"very":"long","metadata":' | ||
OP_PUSH 0x05 OP_PUSH '"is","finally":"done"}' | ||
... | ||
OP_ENDIF | ||
``` | ||
|
||
Which would then be concatinated into | ||
`{"very":"long","metadata":"is","finally":"done"}`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.