What are Ordinals?

Advanced
3m

In December 2022, Casey Rodarmor, a bitcoin developer, released an open-source software called ORD that runs on top of a Bitcoin Core full node. ORD allows users to mint Bitcoin NFTs in two steps: 1) engrave arbitrary information such as a string of text or an image onto the Bitcoin blockchain (“inscription”), and 2) attribute that inscription to an individual satoshi ("ordinal/ordinal theory"). Satoshi is the smallest unit of Bitcoin. 1 BTC = 100,000,000 satoshis. The end product, an inscribed satoshi, is a Bitcoin NFT or an Ordinal.

Inscriptions

During an inscription, arbitrary information is engraved into the taproot script of a bitcoin transaction's witness data. Unlike minting Ethereum NFTs, where every new NFT created is a separate ERC-721 token, inscriptions do not create new tokens. Instead, they bind arbitrary information to existing tokens (satoshis).

Inscriptions are made possible because of two Bitcoin updates, Segregated Witness (SegWit) and Taproot. SegWit took place in July 2017 and increased the size of witness data. Taproot was finalized in November 2021, making inserting arbitrary witness data in a bitcoin transaction easier.

An inscription consists of a content type, also known as a MIME type, and the content itself, which is a byte string. The inscribed content is fully on-chain and stored in taproot scripts.

For example, an inscription of the text "Hello, world!" looks like the following:

1 OP_FALSE
2 OP_IF
3      OP_PUSH “ord”
4      OP_1
5      OP_PUSH "text/plain;charset=utf-8"
6      OP_0
7      OP_PUSH "Hello, world!"
8 OP_ENDIF

Source: Ordinals Docs

First, the string

ord

is pushed, to signal that what follows is an inscription based on ORD.

OP_1

Indicates that the next push contains the content type, which is an utf-8 text string. Other types include image (jpeg, gif), video (mp4), application (pdf), etc.

OP_0

Indicates that subsequent data pushes contain the content itself, which is "Hello, world!" in this case. Multiple data pushes can be used for large inscriptions, as one of taproot's few restrictions is that individual data pushes may not exceed 520 bytes. The theoretical maximum size of an inscription is 400,000 bytes, because it is possible to make an inscription transaction that takes up an entire bitcoin block (4MB, but in practice, Bitcoin Core limits this size to 400,000 bytes).

The inscription content is contained within the input of a bitcoin transaction, and the inscription is tied to the first satoshi of its first output. This satoshi can then be tracked according to the ordinal theory, allowing it to be transferred, bought, sold, lost to fees, and recovered.

One of the controversies raised by inscriptions is that using the taproot script to store arbitrary data was not the intention of the Taproot update. The Taproot update probably would not have been activated if the bitcoin community had known about this unintended consequence. However, there's nothing that can be done now to limit this particular use of the taproot script. So Ordinals (Bitcoin NFTs) are here to stay.

Ordinals (Ordinal Theory)

Ordinal theory ascribes arbitrary features (inscriptions) to satoshis and allows tracking and transferring individual satoshis. But it is not a complicated mechanism. Rather, it is a simple numbering scheme for satoshis.

Satoshis are numbered by the ordinal theory according to two rules.

First, ordinal numbers are assigned to satoshis in the order in which they are mined. For example, the first satoshi in the first bitcoin block (the genesis block) has ordinal number 0, and the second has ordinal number 1.

Because of Bitcoin's UTXO model, satoshis exist as unspent outputs, but transactions destroy outputs and create new ones. Ordinal theory tracks satoshis from the inputs of a transaction to its outputs based on the principle of first-in-first-out, which is rule #2.

For example, the following transaction has three inputs and two outputs, all labeled with their respective values:

[2] [1] [3] → [4] [2]

Source: Ordinals Docs

Now let's label the same transaction with the ordinal numbers of the satoshis that each input contains, and question marks for each output. Ordinal numbers are unimaginably large, so let's use letters a-f to represent them in this example:

[a b] [c] [d e f] → [? ? ? ?] [? ?]

Based on the rule of first-in-first-out, the question marks are easy to figure out:

[a b] [c] [d e f] → [a b c d] [e f]

What about fees, you might ask? Good question! Let's imagine the same transaction, this time with a fee of two satoshis. Transactions with fees send more satoshis in the inputs than are received by the outputs:

[2] [1] [3] → [4]

As a result, the satoshis "e" and "f" now are lost in the outputs because they go to the miner who mined the block as transaction fees:

[a b] [c] [d e f] → [a b c d]

According to ordinal theory, fees paid by transactions are treated as extra inputs to the coinbase transaction, and are ordered how their corresponding transactions are ordered in the block. The coinbase transaction of the block, assuming it only contains one transaction, looks like this:

[SUBSIDY] [e f] → [SUBSIDY e f]

Here SUBSIDY means block rewards, i.e., the bitcoins (satoshis) given to the miner of that block. The numbering of the SUBSIDY follows rule #1, which states that ordinal numbers are assigned to satoshis in the order in which they are mined.

While inscriptions (images, videos, etc.) are fully on-chain, ordinals are not. The connection between an inscription and an individual satoshi (ordinal) is established by the ordinal theory, an off-chain numbering scheme. In other words, social consensus, or general acceptance of the ordinal theory, is required for ordinals to exist. Inscriptions cannot be tracked or traded without the ordinal theory, as inscriptions do not point to individual satoshis automatically.

For more detailed explanation on the history of Bitcoin NFTs and the technical details of Ordinals, we highly recommend Illegitimate bitcoin transactions by pourteaux or this whitepaper by Galaxy Research.

Bitcoin

NFT

What else do you want to learn?

Send
delate
Use TokenInsight App All Crypto Insights Are In Your Hands
Open