Bitcoin on a laptop

Ordinals on Bitcoin without SegWit and Taproot

This post was first published on Medium.

Ordinals has become a hot topic in BTC circles to create non-fungible tokens (NFTs). Its main feature is storing the NFT itself entirely on chain.

We show that the original Bitcoin protocol can already support it. No breaking changes, including both SegWit and Taproot, are needed for Ordinals to work. Actually, it works better on the original protocol: 100,000X cheaper and 12.5X bigger.

How Ordinals Works

Ordinals is the latest manifestation of color coins, which marks individual satoshis (thus “coloring” them) such that they can carry extra information. More specifically, every satoshi is sequentially ordered based on the time it is mined, which was first proposed in the Bitcoin forum in 2012. Each satoshi will have an ordinal number between 0 and 2,100,000,000,000,000 (hence the term “ordinals”) assigned. Each unique satoshi can then be inscribed with some other information to create NFTs (aka inscriptions).

When an Ordinal NFT is minted in a transaction, it is inscribed on the first satoshi of the first output of the transaction. The transaction contains some extra data: text, images, videos, etc. Afterward, it can be transferred just like regular bitcoins.

Consider an example transaction with three inputs and two outputs.

ordinals on bitcoin without segwit and taproot 1
Caption: Credit

There are six satoshis from three addresses in the inputs. The outputs contain five satoshis to two different addresses. The remaining one satoshi is used as a fee to pay the miner.

Ordinals uses the first-in-first-out algorithm to assign each satoshi of the inputs to the outputs. Any missing ordinals go to the miner. In the example, Ordinals (and their represented NFTs, if any) A, B, C, and D go to the first output, F to the second, and F to the miner.

Compare with other Bitcoin-based NFTs

Previous colored coins usually use OP_RETURN, an unspendable output with only 80 bytes of metadata maximally, which means a link/reference to NFT is stored.

Ordinals stores the entire NFT image/content on-chain using these techniques.

  1. The Taproot upgrade in 2021 removed the data limit entirely, as long as it fits inside a block. Segregated Witness (Segwit) software upgrade in 2017 allows up to 3MB of witness data to be stored ‘outside’ of the 1MB block limit. Together, they provide up to 4MB worth of storage space for the inscription content.
  2. Inscriptions are stored in an “envelope” between Opcodes OP_IF and OP_ENDIF. OP_FALSE precedes OP_IF to ensure that this data is never actually used in script execution and does not take up stack space. No OP_RETURN is used, and the output containing an inscription is spendable and thus unprunable. The following example inscribes the text “Hello, world!”:
ordinals on bitcoin without segwit and taproot 2
Caption: Credit

Ordinals on Bitcoin SV

The original Bitcoin protocol of today, Bitcoin SV (BSV), pioneered storing NFT entirely on chain as early as 2021. Since BSV and BTC share the same algorithm for issuing satoshis, they can assign satoshis ordinal numbers in the same way. Ordinals on BSV works overwhelmingly better than on BTC.

  1. Cost: BTC fees are around 10 sat/byte, while BSV’s are only 0.05 sat/byte¹. Given the price of $25,000/BTC vs. $45/BSV as of today, minting the same NFT is >100,000X cheaper!
  2. Data size: BSV has restored the full Script after the Genesis upgrade, so the same envelope works. It also has more ways to embed the data in a transaction. For example, OP_RETURN can be used in a spendable output. Currently, up to 50MB of data can be included in a single transaction, 12.5X bigger than the 4MB limit on BTC. Here is a transaction of 27MB and another of 12MB. Data limit is expected to increase continuously as usage grows. More advanced NFT protocol on top has already stored NFT over 1GB, by breaking it up across multiple transactions.

BSV does so without changing the protocol. No SegWit and Taproot is needed.

References
[1] https://docs.ordinals.com/
[2] https://medium.com/coinmonks/ordinals-an-overview-of-bitcoin-nfts-795c39447e23
[3] https://tara-annison.medium.com/a-comprehensive-explanation-of-ordinals-nfts-on-bitcoin-67b11868e74f
[4] https://www.chain.com/blog/what-are-bitcoin-ordinals

***

NOTE:
[1] We compare the average fee rate. In BTC, SegWit can bring 4X discount, and in BSV, some miners take 0.01 sat/byte, a 5X discount.

Watch: Smart Contracts and Computation on BSV

YouTube video

New to blockchain? Check out CoinGeek’s Blockchain for Beginners section, the ultimate resource guide to learn more about blockchain technology.