-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document runes #3380
Merged
Merged
Document runes #3380
Changes from 16 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
e4dd903
Document runes
casey 6faf43d
Enhance
casey d8a58df
Amend
casey a5ea1cf
Tweak
casey 7bea70a
Tweak
casey 962060a
Tweak
casey 03db708
Tweak
casey 185bada
Enhance
casey 4f4df42
Modify
casey 65d2834
Modify
casey b616004
Tweak
casey 9ac2193
Enhance
casey 932e344
Amend
casey fcf659a
Amend
casey 4577339
Enhance
casey 70f0c4c
Modify
casey f14985b
Amend
casey fb89a9d
Modify
casey 7f6516f
Merge remote-tracking branch 'upstream/master' into document-runes
casey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,158 @@ | ||
Runes | ||
===== | ||
|
||
Runes allow Bitcoin transactions to etch, mint, and transfer Bitcoin-native | ||
digital commodities. | ||
|
||
Whereas every inscription is unique, every unit of a rune is the same. They are | ||
interchangeable tokens, fit for a variety of purposes. | ||
|
||
Runestones | ||
---------- | ||
|
||
Rune protocol messages, called runestones, are stored in Bitcoin transaction | ||
outputs. | ||
|
||
A runestone output's script pubkey begins with an `OP_RETURN`, followed by | ||
`OP_13`, followed by zero or more data pushes. These data pushes are | ||
concatenated and decoded into a sequence of 128-bit integers, and finally | ||
parsed into a runestone. | ||
|
||
A transaction may have at most one runestone. | ||
|
||
A runestone may etch a new rune, mint an existing rune, and transfer runes from | ||
a transaction's inputs to its outputs. | ||
|
||
A transaction output may hold balances of any number of runes. | ||
|
||
Runes are identified by IDs, which consist of the block in which a rune was | ||
etched and the index of the etching transaction within that block. | ||
|
||
Etching | ||
------- | ||
|
||
Runes come into existence by being etched. Etching creates a rune and sets its | ||
properties. Once set, these properties are immutable, even to its etcher. | ||
|
||
### Name | ||
|
||
Names consist of the letters A through Z and are between one and twenty-eight | ||
characters long. For example `UNCOMMONGOODS` is a rune name. | ||
|
||
Names may contain spacers, represented as bullets, to aid readability. | ||
`UNCOMMONGOODS` might be etched as `UNCOMMON•GOODS`. | ||
|
||
The uniqueness of a name does not depend on spacers. Thus, a rune may not be | ||
etched with the same sequence of letters as an existing rune, even if it has | ||
different spacers. | ||
|
||
### Divisibility | ||
|
||
A rune's divisibility is how finely it may be divided into its atomic units. | ||
Divisibility is expressed as the number of digits permissible after the decimal | ||
point in an amount of runes. A rune with divisibility 0 may not be divided. A | ||
unit of a rune with divisibility 1 may be divided into ten sub-units, a rune | ||
with divisibility 2 may be divided into a hundred, and so on. | ||
|
||
### Symbol | ||
|
||
A rune's currency symbol is a single Unicode code point, for example `$`, `⧉`, | ||
or `🧿`, displayed after quantities of that rune. | ||
|
||
101 atomic units of a rune with divisibility 2 and symbol `🧿` would be | ||
rendered as `1.01 🧿`. | ||
|
||
If a rune does not have a symbol, the generic currency sign `¤`, also called a | ||
scarab, should be used. | ||
|
||
### Premine | ||
|
||
The etcher of a rune may optionally allocate to themselves units of the rune | ||
being etched. This allocation is called a premine. | ||
|
||
### Terms | ||
|
||
A rune may have an open mint, allowing anyone to create and allocate units of | ||
that rune for themselves. An open mint is subject to terms, which are set upon | ||
etching. | ||
|
||
A mint is open while all terms of the mint are satisfied, and closed when any | ||
of them are not. For example, a mint may be limited to a starting height, an | ||
ending height, and a cap, and will be open between the starting height and | ||
ending height, or until the cap is reached, whichever comes first. | ||
|
||
#### Cap | ||
|
||
The number of times a rune may be minted is its cap. A mint is closed once the | ||
cap is reached. | ||
|
||
#### Amount | ||
|
||
Each mint transaction creates a fixed amount of new units of a rune. | ||
|
||
#### Start Height | ||
|
||
A mint is open starting in the block with the given start height. | ||
|
||
#### End Height | ||
|
||
A rune may not be minted in or after the block with the given end height. | ||
|
||
#### Start Offset | ||
|
||
A mint is open starting in the block whose height is equal to the start offset | ||
plus the height of the block in which the rune was etched. | ||
|
||
#### End Offset | ||
|
||
A rune may not be minted in or after the block whose height is equal to the end | ||
offset plus the height of the block in which the rune was etched. | ||
|
||
Minting | ||
------- | ||
|
||
While a rune's mint is open, anyone may create a mint transaction that creates | ||
a fixed amount of new units of that rune, subject to the terms of the mint. | ||
|
||
Transferring | ||
------------ | ||
|
||
When transaction inputs contain runes, or new runes are created by a premine or | ||
mint, those runes are transferred to that transaction's outputs. A | ||
transaction's runestone may change how input runes transfer to outputs. | ||
|
||
### Edicts | ||
|
||
A runestone may contain any number of edicts. Edicts consist of a rune ID, an | ||
amount, and an output number. Edicts are processed in order, allocating | ||
unallocated runes to outputs. | ||
|
||
### Pointer | ||
|
||
After all edicts are processed, remaining unallocated runes are transferred to | ||
the transaction's first non-`OP_RETURN` output. A runestone may optionally | ||
contain a pointer that specifies an alternative default output. | ||
|
||
### Burning | ||
|
||
Runes may be burned by transferring them to an `OP_RETURN` output with an edict | ||
or pointer. | ||
|
||
Cenotaphs | ||
--------- | ||
|
||
Runestones may be malformed for a number of reasons, including non-pushdata | ||
opcodes in the runestone `OP_RETURN`, invalid varints, or unrecognized | ||
runestone fields. | ||
|
||
Malformed runestones are termed | ||
[cenotaphs](https://en.wikipedia.org/wiki/Cenotaph). | ||
|
||
Runes input to a transaction with a cenotaph are burned. Runes etched in a | ||
transaction with a cenotaph are set as unmintable. Mints in a transaction with | ||
a cenotaph count towards the mint cap, but the minted runes are burned. | ||
|
||
Cenotaphs are an upgrade mechanism, allowing runestones to be given new | ||
semantics that change how runes are created and transferred, while not | ||
misleading unupgraded clients as to the location of those runes, as unupgraded | ||
clients will see those runes as having been burned. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the behavior if neither a premine nor terms are specified? It seems the default for each of those is 0/do nothing. Does that etch a valid rune with 0 max supply (effectively "burning" the name), or does it create a cenotaph (and burn all runes that are also on that tx)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If neither premine nor terms are supplied, the supply is zero, but the runestone is not a cenotaph.