What are bitcoin inscriptions and ordinals, and how do they work?

First published: 02/17/2023
| Last updated: 02/17/2023
| -- min read

If you’ve been following the “current thing” on bitcoin twitter, you may have heard about “NFTs” being back on bitcoin through “inscriptions,” or “ordinals.” It all started with the recent release of the ord command line wallet and block explorer, the first implementation of a new mechanism for publishing arbitrary data on the bitcoin blockchain.

Here we’ll explain what inscriptions and ordinals are, but first let’s take a stroll through the history of arbitrary data storage on bitcoin and why this isn’t all that new. 

A brief history of arbitrary data on bitcoin

The idea of using bitcoin block space for purposes other than explicitly sending financial transactions peer-to-peer has been around since the early days of the protocol. The idea for a DNS system built on top of bitcoin was first discussed on the BitcoinTalk.org forums back in 2010, an idea that eventually led to the creation of Namecoin in 2013. 

During this period, the term “Colored Coins” was adopted for these kinds of protocols that would mark (or “color”) chunks of bitcoin called unspent transaction outputs (UTXOs) for use in other off-chain protocols. In the early days, there were effectively no limits to what data you could store in a transaction, as long as the basic semantics of the scripting system were followed and fees were paid to have the transaction processed by miners. This was exploited in early systems like Counterparty, launched in 2014, which originally minted tokens in a “hack” of a script intended for multisig transactions. 

It was, however, quickly recognized that this was harmful to the long term scalability of bitcoin since all bitcoin UTXOs must be actively tracked by all nodes in order to validate new transactions. The counterparty outputs, or any others that might contain arbitrary data, were unspendable, and storing them served no purpose to nodes that didn’t care about the data or protocol they may serve. Effectively they were dead weight. 

To address this, OP_RETURN was made standard in the v0.9.0 release of Bitcoin Core in March, 2014. This function allowed a sender to mark an output as unspendable, signaling to nodes that they could be discarded, thus taking up no space in the UTXO set. An additional limit was added capping the size of the data in an OP_RETURN output to 40 bytes (later lifted to 80 bytes). 

OP_RETURN became the fashionable way to add arbitrary data to the bitcoin blockchain. Counterparty eventually converted to using OP_RETURN and on top of this were created some of the first blockchain-based NFTs. And to this day, it’s trivial for anyone to inscribe data such as a short message in the bitcoin blockchain with OP_RETURN.

If you want to read more about the history of OP_RETURN, see this Bitmex Research article.

Inscriptions

Inscriptions are a new way to write arbitrary data—the ordinals documentation calls them “digital artifacts”—on the bitcoin blockchain. 

From the documentation:

Inscriptions inscribe sats with arbitrary content, creating bitcoin-native digital artifacts, more commonly known as NFTs. Inscriptions do not require a sidechain or separate token.

These inscribed sats can then be transferred using bitcoin transactions, sent to bitcoin addresses, and held in bitcoin UTXOs. These transactions, addresses, and UTXOs are normal bitcoin transactions, addresses, and UTXOS in all respects, with the exception that in order to send individual sats, transactions must control the order and value of inputs and outputs according to ordinal theory.

In the witness data

Rather than put this data in outputs like the early Colored Coin protocols and OP_RETURN, inscriptions add their data into the witness data of a transaction. Most commonly the witness is where signatures and other data required to unlock the spending of a UTXO is stored. (The term “witness” comes from the idea that it is like the witness for a contract, “signing” to prove its validity.)

The segregated witness (“segwit”) upgrade to bitcoin activated in 2017, and later Taproot in 2021, helped pave the way for a system like inscriptions. This was accomplished by lifting some of the previously-imposed size restrictions placed on witness data as well as providing for a discount for any data stored in a separate (or “segregated”) data structure reserved for the witness, introducing an effective block size increase of up to 4MB. 

Furthermore, like OP_RETURN, input witness data does not need to be persisted by a node in order to validate future transactions. Once the witness has been validated, your node knows that transaction represents a valid spend and the creation of valid UTXOs and thus all data from the witness can be safely discarded by nodes for whom it is irrelevant. 

Inscriptions use this fact combined with the lack of size restrictions as compared to OP_RETURN (which only allows for 80 bytes) to store a much greater amount of data per transaction. The mechanism to accomplish this is similar, in fact, to the original OP_CHECKMULTISIG approach of Counterparty. This approach put the data in the bitcoin script in a way that would be ignored by the script interpreter, such that the script is still considered valid despite the excess data. Rather than putting this in the output, inscriptions put it in the input’s witness. 

Envelopes

The inscription protocol calls the mechanism used to store data an “envelope,” essentially a bitcoin script written in such a way that it won’t be run.

Thus, a digital artifact is created by encoding the data for the artifact—for example the bytes representing a jpeg—within such an envelope. The inscription is made on the first satoshi of the first output of the transaction where the envelope is revealed (which only happens upon spending). 

Inscription content is serialized using data pushes within unexecuted conditionals, called an “envelope”. Envelopes consist of an OP_FALSE OP_IF … OP_ENDIF wrapping any number of data pushes. Because envelopes are effectively no-ops, they do not change the semantics of the script in which they are included, and can be combined with any other locking script.

As explained next, interacting with this system requires a lens by which to order and understand these inscriptions, and it requires specialized software to receive, send, and track them. While they count as valid transactions according to the bitcoin network rules, the scripts for inscriptions are a capability the majority of bitcoin wallets cannot understand. For that, you need ordinal theory.

Ordinals

Ordinals, or “ordinal theory,” was proposed in 2022 by developer Casey Rodarmor (but the idea goes back to 2012). It can be thought of as a new way of “coloring” bitcoins except it does so without any additional data. Instead, it establishes a system at the social layer (off the bitcoin blockchain)—one that anyone can choose to follow themselves going back to the first bitcoin block ever mined. 

Numbering satoshis

In mathematics, a set of ordinal numbers is one that is “linearly ordered.” “Ordinal theory” does the same for every single satoshi (the smallest unit of currency in bitcoin) ever minted. 

From the ordinals documentation:

Ordinals are a numbering scheme for satoshis that allows tracking and transferring individual sats. These numbers are called ordinal numbers. Satoshis are numbered in the order in which they’re mined, and transferred from transaction inputs to transaction outputs first-in-first-out. Both the numbering scheme and the transfer scheme rely on order, the numbering scheme on the order in which satoshis are mined, and the transfer scheme on the order of transaction inputs and outputs. Thus the name, ordinals.

Tracking inscriptions on satoshis

Since the bitcoin protocol does not explicitly track the movement of satoshis, but rather simply converts the amounts from UTXOs in inputs into a new assembly of outputs, ordinal theory proposes a conceptual system by which to track satoshis. This is critical if one wants to be able to track and move around the inscriptions that have been made on those satoshis, as described above.

Similar to other Colored Coin protocols in the past, if you can track a particular coin or set of coins, and furthermore associate some asset to those coins, then you can not just trade them but also the asset attached to them. In other words, if a particular asset, like an image, is associated with a particular satoshi, then it can be considered only the owner of that satoshi that “owns” the asset. If you abide by ordinals, sending that satoshi in a transaction effectively transfers ownership of the asset associated with it and anyone that cares about verifying who the owner is can audit this transfer for themselves.

Uncommon satoshis

Viewing satoshis through the lens of ordinals also has some interesting knock-on effects outside of inscriptions. One such consequence is that some satoshis can be considered more or less rare than others. Consider the first satoshi mined in a halving epoch. As of 2023, there have only been 3 halvings in bitcoin’s history, which means that there only 3 such satoshis in circulation. The ordinal docs label these as “epic” satoshis. 

Collectors who subscribe to ordinals might find these satoshis to be more valuable than their face-value, similar to how legacy coin collectors treat certain mintings of various coins.

Why should you care? 

Maybe you shouldn’t. You might have a “rare” satoshi in your wallet right now, but if ordinals remain obscure, then there’s no more reason to treat those bitcoin any differently than you normally would, any more than a rare playing card is little more than paper and ink at the end of the day.

That said, with ordinals, inscriptions, and NFTs on the bitcoin blockchain being in the public consciousness, many concerns are being raised:

  • Would broad adoption of ordinal theory impact bitcoin’s fungibility?
  • Should we be concerned about a faster rate of growth of the blockchain?
  • What are the implications of illegal content stored on-chain?
  • Would this hurt or help Lightning Network adoption?

We don’t have complete answers to all of these questions—but they’re all questions worth exploring!

One thing we do know is that, ultimately, as bitcoin adoption grows and block space becomes scarcer, block space will be competed for regardless. Inscriptions don’t go around those limitations, and thus the blockspace must be paid for just the same. There are no additional validation costs imposed on relaying nodes that help broadcast the transactions and the data storage costs are the same as if the block space was taken up by equivalent financial transaction data.

Further reading

If you want to learn more about inscriptions and ordinals, you should check out the Ordinals BIP authored by Casey Rodarmor, the ordinals documentation, and Casey’s appearance on the Stephan Livera podcast. Pierre Rochard also discussed inscriptions and ordinals with Preston Pysh, which may be a useful resource for the less technical listener.

Sign up to get notified for future blog articles.