Runes - Standard Functions


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, represented in text as BLOCK:TX. For example, the ID of the rune minted in the 20th transaction of the 500th block is 500:20.


The runestone:

struct Runestone {
  edicts: Vec<Edict>,  
  etching: Option<Etching>,  
  mint: Option<RuneId>,  
  pointer: Option<u32>,

Is parsed from the unsigned message using the following tags:

enum Tag {
  Body = 0,  
  Flags = 2,  
  Rune = 4,  
  Premine = 6,  
  Cap = 8,  
  Amount = 10,  
  HeightStart = 12,  
  HeightEnd = 14,  
  OffsetStart = 16,  
  OffsetEnd = 18,  
  Mint = 20,  
  Pointer = 22,  
  Cenotaph = 126,  
  Divisibility = 1,  
  Spacers = 3,  
  Symbol = 5,  
  Nop = 127,

Note that tags are grouped by parity, i.e., whether they are even or odd. Unrecognized odd tags are ignored. Unrecognized even tags produce a cenotaph.

All unused tags are reserved for use by the protocol, may be assigned at any time, and must not be used.

The standard functions are designed to enhance Bitcoin's utility by enabling it to support complex DeFi operations typically associated with more programmatically flexible blockchains like Ethereum. By integrating these functionalities, Runes aims to broaden Bitcoin's appeal and utility in the burgeoning DeFi sector.

Minting: In the Runes protocol on Bitcoin, minting refers to the creation of new tokens. This is achieved through specific transactions that define the properties of the new tokens, such as supply and operational rules. Unlike traditional token creation on platforms like Ethereum, Runes utilizes the Bitcoin blockchain's UTXO model to manage these tokens, ensuring that they remain within Bitcoin's architectural framework.

Transferring: The transfer functionality in Runes is fundamental for moving tokens between addresses within the Bitcoin network. This process involves using specific transaction outputs that dictate the new ownership of the tokens. It leverages Bitcoin's transaction mechanism, allowing for secure and verifiable transfers of ownership without the need for an intermediary.

Etching: Etching is a unique feature of the Runes protocol, serving as the method by which new token types are defined on the Bitcoin blockchain. This function allows developers to specify the attributes of a token, such as its total supply and rules for its distribution and use. Etching is crucial for customizing token behavior to suit specific needs or applications, making it a versatile tool for expanding Bitcoin’s functionality.

Last updated