Recursive Inscriptions: The Cornerstone of BTC Lego Assemblies and Complex Logic Products

IntermediateDec 17, 2023
The article begins with the fundamental principles and technical details of Ordinals technology, analyzing its developmental trajectory and examining the importance and roles played by Segwit and Taproot upgrades. It then delves into the concept of recursive inscriptions, explaining their innovative uses through real-world cases.
Recursive Inscriptions: The Cornerstone of BTC Lego Assemblies and Complex Logic Products

TL;DR

As a significant recent update to Ordinals, recursive inscriptions have opened up a vast realm of possibilities for the composability of the Ordinals protocol. Recursive inscriptions are a standard for inscription parsing. Creating PFP (Profile Picture) collection inscriptions is possible by uploading corresponding elemental features, allowing for combinatory assembly without the need to upload or download actual images. Recursive inscriptions boast enhanced interoperability, reduced costs, and the ability to break the 4MB size limit.

Creative directions based on recursive inscriptions include inscription deconstruction and combination, Bitcoin music, Bitcoin blockchain games, generative art, and decentralized websites. This article presents detailed examples of recursive inscriptions, showcasing their immense potential.

However, recursive inscriptions face challenges: whether parsers for off-chain rendering can rapidly analyze when recursive levels increase, and whether they can quickly process when the number of referenced inscriptions rises. In theory, games or NFTs generated by recursive inscriptions can be infinitely complex and detailed. But due to the limitations of the BTC network itself, their realization requires indirect technical solutions.

Recursive inscriptions allow inscriptions to interact with each other, enabling new use cases. Generative art, on-chain displays, and efficient storage have become realities. There are high hopes for the deep adoption of recursive inscriptions in generative art, blockchain games, and metaverse tracks, with the belief that killer applications are currently in development.

I. Introduction

The birth of the Ordinals protocol has endowed Bitcoin with the functionality of numbering and inscriptions, thereby expanding the product range of the Bitcoin ecosystem and bringing immense application potential to the Bitcoin community. In the past few months, we have witnessed the gradual evolution of the Ordinals track from obscurity to a thriving ecosystem. During this period, the Ordinals protocol has undergone significant upgrades, leading to the emergence of a series of derivative protocols:

In our June series on Ordinals, we updated detailed introductions to Ordinals and various BRC20 derivative protocols. Notably, a major recent update to Ordinals – the advent of recursive inscriptions – deserves mention. Announced on June 12 by Raph, the new chief maintainer of the Bitcoin protocol Ordinals, on GitHub, this update integrates Casey Rodarmor’s recursive inscription proposal #2167 into the Ordinals codebase. This development has opened up vast possibilities for the composability of the Ordinals protocol. This article will explore the principles of recursive inscriptions and their impact on Ordinals, combined with existing cases to forecast potential innovative applications of recursive inscriptions.

II. Basic Principles and Technology of the Ordinals Protocol

Since the end of December 2022, Casey Rodarmor has released the Ordinals protocol, introducing NFTs to the Bitcoin network through Ordinals and Inscriptions. This protocol enables the creation of unique digital artifacts by adding any content, such as text, images, videos, or even applications, to sequentially numbered sats (the smallest unit in Bitcoin) and allows for their transmission through the Bitcoin network. Let’s delve into the key technical principles involved in the Ordinals protocol:

(1) UTXO

Bitcoin uses a payment model called “Unspent Transaction Output” (UTXO), where all balances are stored in a list of UTXOs. Each UTXO contains a certain amount of Bitcoin, owner information, and its availability status. In Bitcoin transactions, there are inputs and outputs. Inputs refer to existing UTXOs, and outputs designate new addresses and amounts. Initiating a transaction locks the related UTXOs to prevent double spending until the transaction is confirmed. Once confirmed, the transaction’s input UTXOs are removed, and new UTXOs are generated as outputs. The total input amount of a transaction usually exceeds its outputs, with the difference being the network fee, rewarding miners who pack transactions. The fee correlates with transaction complexity, meaning transactions with multiple inputs and outputs generally require higher network fees.

(2) Numbering and Tracking of Satoshis

There are a total of 2.1 trillion * 10^8 satoshis in the Bitcoin network. How does the Ordinals protocol uniquely number each satoshi and track its account? According to the Ordinals protocol, satoshis are numbered based on the order they are mined. The metadata of Ordinals isn’t stored in a specific location but is embedded in the transaction’s witness data. This data is “inscribed” like an inscription on specific parts of a Bitcoin transaction, attached to specific satoshis. This process is facilitated through Segregated Witness (SegWit) and “Pay-to-Taproot” (P2TR), allowing for the inscription of any form of content (like text, images, or videos) on designated satoshis.

(3) SegWit and Taproot Upgrade

SegWit is a significant protocol upgrade for Bitcoin, segregating some transaction signature data (witness data) from the transactions themselves, thereby reducing the data size stored in Bitcoin blocks. This expansion of block capacity allows for more transactions, enhancing the network’s transaction processing capacity and reducing fees. The SegWit upgrade introduced a new witness field in transaction outputs to enhance privacy and performance. Though witness data wasn’t initially designed for data storage, it provides an opportunity to store metadata like inscriptions. The 2021 Taproot upgrade allows for more private storage of different transaction conditions on the blockchain. With Taproot’s script paths, inscription content can be stored in spending scripts, which are almost unrestricted in content. Additionally, Taproot’s discount mechanism makes storing inscription content more economical, saving significant resources. The Ordinals protocol cleverly utilizes SegWit’s relaxation of restrictions on writing content size to the Bitcoin network, storing inscription content in witness data, with up to 4MB of metadata. Taproot makes storing any witness data in Bitcoin transactions easier, allowing Ordinals developer Casey Rodarmor to repurpose old opcodes (OP_FALSE, OP_IF, OP_PUSH) to encapsulate content as inscriptions, thus storing arbitrary data.

(4) Process of Minting Inscriptions

Commit: The initial step in the transaction is to create an output that points to a Taproot script containing the inscription content. This output uses the Taproot storage format. At this point, the inscription data is already linked to the transaction output’s UTXO, but it is not yet public.

Reveal: In this phase, a transaction is initiated by using the UTXO corresponding to the inscription as an input. At this time, the content of the inscription is disclosed to the entire network.

Through these two steps, the content of the inscription is now bound to the UTXO it inscribes. Following the previously mentioned Satoshi, the inscription is realized on the first Satoshi of the input’s corresponding UTXO. The content of the inscription is included in the input of the displayed transaction. This specially inscribed Satoshi can be transferred, bought, sold, lost, and recovered.

III. Principles and Implementation of Bitcoin Recursive Inscription

Having understood the basic principles of Ordinals, let’s look at recursive inscriptions:

The Ordinals protocol introduced the capability to fully engrave files on the blockchain on Bitcoin. Before the advent of recursive inscriptions, ordinals were like isolated and finite islands. While you could inscribe text, images, and code, they were unable to interact with each other.

However, with the introduction of recursive inscriptions, this is about to change. Now, inscriptions can use a special “/-/content/:inscription_id” syntax to request the content of other inscriptions. This allows users to create inscriptions on the Bitcoin chain using less capacity and lower fees.

Recursive inscription is a standard for inscription resolution. Its syntax essentially involves using code to find images. Creating a PFP collection inscription involves uploading corresponding patterns, colors, actions, and other elements of the image. These elements can then be combined and pieced together with those already existing on the chain, eliminating the need to upload or download actual images.

Recursive inscriptions have the following characteristics:

With their unique self-referential property, recursive inscriptions offer an opportunity to break free from the constraints of previous inscription methods, moving beyond the awkward state of each inscription being isolated and unrelated, thus opening up possibilities for creative combinations.

In the form of their textual code, recursive inscriptions maintain a compact size, not only reducing costs but also allowing the size of inscriptions to exceed the 4MB limit of Bitcoin blocks.

This advancement enhances interoperability, programmability, and scalability, injecting more possibilities and creative imagination into the Bitcoin chain.

From a protocol perspective, the future looks very broad, with rich narratives waiting for developers and users to construct and apply.

However, there are still some challenges, such as whether inscriptions can be indexed and collected on platforms, which will determine the speed of their development and the extent of their widespread recognition.

IV. Innovative Application Methods of Bitcoin Recursive Inscription

The emergence of recursive inscriptions has unlocked many powerful innovative applications. Boasting high flexibility, easy integration, and cost-effectiveness, recursive inscriptions have introduced endless new possibilities to the realm of inscriptions. This article will discuss some specific cases to illustrate the potential innovations and applications of recursive inscriptions.

The emergence of recursive inscriptions has unlocked many powerful innovative applications. Boasting high flexibility, easy integration, and cost-effectiveness, recursive inscriptions have introduced endless new possibilities to the realm of inscriptions. This article will discuss some specific cases to illustrate the potential innovations and applications of recursive inscriptions.

Let’s delve into some typical cases that showcase the powerful potential of recursive inscriptions:

(1) On-chain Generative Art: 1Mask

By further combining various initial schemes, collections and secondary creations of inscriptions can be achieved: for example, combining a1 and a2 within a collection, or combining collections a and b. On this basis, the Bitcoin chain is expected to birth truly community-driven, native interactive generative art. Our first case is 1Mask, an all-on-chain generative art project themed around masks on the BTC chain. The 1Mask project ingeniously integrates Ordinals’ recursive technology, consisting of templates, algorithms, and inscription generation.

Source: https://1mask.io/

The template part includes seven types of inscriptions, each corresponding to a unique template format following image/svg+xml. The algorithm part uses wallet addresses as seeds, employing random functions to create various color combinations for coloring the mask models. The inscription generation mechanism leverages recursive technology to reference algorithmic inscriptions. Each mask inscription embeds HTML code required to construct the final colorful mask image. It functions by using random seeds to execute code stored in the algorithmic inscriptions, filling in chain-specific data like wallet addresses to ensure randomness yet relevance to the user. Therefore, using the same template with the same wallet address always yields consistent results.

Every new mask inscription created fuses specific chain details of the user and references the algorithmic inscription. Powered by recursive inscription technology, once these new mask inscriptions enter the market or are indexed by wallets, they autonomously activate the referenced code within the algorithmic inscriptions. Running these codes with user-specific chain data as input ultimately displays a unique, personality-expressing mask image.

In the Bitcoin network context, the data contained in inscriptions is immutable, ensuring their integrity. This characteristic ensures that the real-time images presented based on these immutable inscription data are also immutable. As long as the random seeds and algorithms involved in the mask inscriptions are correct, users can always verify the authenticity and accuracy of the creation process.

Behind this project, 1Mask introduced a standard called BRC721Auto, proposing that fully on-chain generative art consists of at least two types of inscriptions: one for the code and the other for personalized parameters.

In the code inscription, we need to encode an algorithm that can automatically generate an HTML DOM based on the content of the parameters. This DOM could be a canvas, SVG, or other browser-recognizable content rendered graphically.

Of course, code inscriptions can also reference other inscriptions’ content to complete their algorithms.

In the parameter inscription, we define an HTML and set a global parameter p to reference a Code Inscription. When ordinary browsers attempt to display this Parameter Inscription, they recognize the global parameter p and automatically execute the start() function in the Code Inscription to add or modify the current HTML DOM, ultimately rendering its content. Therefore, parameter inscriptions can be seen as the final NFTs (Non-Fungible Tokens).

With Recursive Inscription technology, the code for generating graphics, its execution process, and verification are all protected under the consensus of the Bitcoin blockchain. Unless someone launches a 51% attack on Bitcoin, no one can control the generation process of ERC721Auto NFTs, which will be autonomously executed by the Bitcoin ecosystem.

1Mask also proposed three standards for fully on-chain generative art projects. These standards are:

Decentralized storage for auto-generating graphics code

Decentralized execution of code based on user-provided parameters for personalized graphic generation

Decentralized verification of the correctness of the generated results

According to these standards, it is evident that on-chain art based on recursive inscriptions possesses the following characteristics:

Uniqueness and randomness: The artwork must be generated through algorithms and smart contracts, featuring irreplaceability, uniqueness, and provably random on-chain revelations, while also possessing artistic and aesthetic values.

Interactivity: Users can interact with and control the artwork.

Decentralization: The art is entirely on-chain, stored in a fully decentralized manner, and no centralized institution or individual can control them.

Reusable code, and is based on Ordinals’ works

Compared to other chain-based generative art projects, generative art based on BTC recursive inscriptions is entirely on-chain, independent, and decentralized, not relying on any off-chain resources.

(2) Geek Project: Orbinals

Due to the flexibility of recursive inscriptions, it provides a stage for geeks to showcase their talent, with projects rich in geek spirit further exploring the various potential boundaries of Ordinals technology.

“Orbinals” is such a typical representative. It’s a geek project with no Twitter or official website; all its content is based on Uncommon sat. As of August 20th, according to the latest price by f2pool, the price of Uncommon sat exceeded 366 USD.

Source:https://www.ord.io/?satributes=uncommon&contentType=html&sortBy=newest

If you directly open the Orbinals’ collection URL, you’ll find that each celestial motion series image references some identical content, with slight parameter variations. Upon deeper investigation into the content referenced in its recursive inscriptions, we discover the project’s real secret hidden in these links. Orbinals, fully named “Orbinals: Three Body Orbit Artifacts on Ordinals”, uses HTML and JavaScript to program the motion of three bodies, building upon two-body simulation code.

Source:https://evgenii.com/blog/three-body-problem-simulator/

Supported by mathematical and physical equations, the beauty of celestial motion is presented on the Bitcoin chain in a simplified manner. And, since the project doesn’t have Twitter, Discord, official websites, or any social media, future information might be presented in a very geeky manner, on the team’s own sats.

Source:https://ordin-delta.vercel.app/content/b5091b76f78d73677ad6b81e4785b0dfebc62b1079a0bf78b8366859a1ffacbci0

Besides the four channels disclosed by the project, there’s a hidden easter egg: in the referenced inscription content, the code contains a string of instructions: future Communication channels on /sats/ acknowledge, and “acknowledge” happens to be one of the team’s sats.

Source:https://www.ord.io/sat/1940129935364125

(3) BRC69 Project: Orditroops

BRC69 is a new standard for creating recursive collections, released by Luminex (https://github.com/luminexord/brc69). This standard uses recursive inscriptions to optimize the cost of inscribing with the ordinal protocol on Bitcoin, facilitating the launch of recursive collections on Bitcoin. Additionally, BRC69 offers high flexibility and opens the door for more enhanced features and functions, paving the way for more interesting on-chain functionalities, such as pre-display features.

With BRC69, the cost of inscribing Ordinals collections can be reduced by over 90%. This reduction is achieved through a four-step process:

Recording features

Deploying collections

Compiling collections

Creating assets

As long as the collection creator publishes their official inscription list according to current requirements, all these processes can be completed without external indexers. Additionally, images are automatically rendered on all front-ends that have implemented recursive inscriptions, without extra steps.

Orditroops is a recursive NFT based on BRC69, implementing the content of the BRC69 protocol, increasing the composability of features, reducing image space occupancy, and providing high-resolution images. The flexible combinations of soldiers, weapons, and attire add much character and fun to this NFT collection.

Source: https://twitter.com/OrdiTroops

(4) 3D NFT Project: OCM (On-Chain Monkeys)

Source: https://www.ord.io/3563188a3db53850bba48747293def7bd6b7395e4241b29ec7d49892945cf927i0

OCM is the first 3D NFT project applying recursive inscription standards. OnChainMonkey was initially created on Ethereum in September 2021 and appeared earlier this year as the first 10k series inscribed on Bitcoin.

As a high-resolution 3D animated inscription, OCM quickly stood out for its detail and quality. Before it, most inscriptions were still small text files or low-resolution images. Even on 4K or 8K displays, OCM provides good clarity, a feat achieved with files no larger than 1 KB, previously unattainable by other projects.

OCM achieves its capabilities by pioneering the use of powerful recursive inscriptions. The first 300 inscriptions of OCM are engraved on 300 consecutive satoshis on Bitcoin, starting from block 78 in 2009, and are arranged in ascending order of their satoshi number on the chain. The builders of OCM utilized compact code and referenced the P5.JS and Three.JS libraries for future creators to use. Users can view and access these libraries in the browser, where Dimensions Interactive Art is automatically decompressed within the Ordinals protocol.

With recursive inscriptions, OCM efficiently utilizes block space (each less than 1 KB) and achieves random on-chain revelations, integrating high-definition quality, 3D, animation, and interactive art features.

(5) On-Chain Music Engine: Descent into Darkness Music Engine

Source:https://ordinals.com/content/6fd06768414dfc2bd68b55869eea6844864fbf71ee72ec26568520e313c2bda2i0

This music engine, a part of the MUD RPG game ‘Descent Into Darkness,’ generates unique on-chain music from any word or phrase input. Ratoshi, the founder, emphasized the significant role of ChatGPT in developing the project’s music aspect, noting that the use of recursive inscriptions significantly reduces costs. This special combination of blockchain technology and artificial intelligence pays homage to the classic music of retro video games.

(6) Single-Player Chain Games

A game requires various components like images, frontend, and business logic. If the total size of these materials is less than 4M, they can be inscribed in a single sat without needing recursive inscriptions. Recursive inscription technology is suitable in two scenarios:

When the material itself is large (more than 4M), such as a 5M background image, which cannot be directly inscribed onto a single sat but can be split and referenced across different sats.

To implement better business logic, like when 100 sat inscriptions belong to a series using the same JavaScript (JS) file. In this case, recursive inscriptions are suitable because it’s unnecessary to re-inscribe the JS file for each sat.

The HTML (frontend) and JS (business logic) of the game are engraved on Bitcoin’s ‘satoshis’ and referenced mutually, allowing the creation of single-player H5 mini-games. Here are three examples of such games:

a. Snake Game

Source:ord.io/431507

The Bitcoin Snake Game is a typical H5 single-player game, reminiscent of the well-known Snake game. The frontend and logic of this game are entirely contained within a single Satoshi (Sat), without employing recursive inscription technology. This series has a total of 100 NFTs. A more efficient approach would involve inscribing the JavaScript (JS) file (business logic) on one Sat and using 100 different Sats, each inscribed with HTML, to reference (or recursively call) the JS file’s Sat to generate inscriptions. This method would result in a more streamlined process.

b. Matching Game

Source: ord.io/18201467

As illustrated, this game features a 3x4 digital grid (in simple mode; complex mode has a 6x6 grid). Players can open two grids at a time, and if the images in the grids match, they remain visible; otherwise, they revert to question marks. Victory is achieved by completing the task within a certain number of clicks, testing the player’s short-term memory. This game is similar to the familiar matching game. The JS and HTML of this game are inscribed in the Sat, which also references a “background image,” making it a simple application of recursive inscription.

Source: ord.io/18201467

c. MUD Game

Source:https://ordinals.com/content/1915ae7d46502199a7d03256efd7f6e2f6aabb8ed7176b34f70b7b8fd778b36ci0

Descent into Darkness, a text-based role-playing game, combines classic MUD game elements with ordinals technology, offering players a unique gaming experience. In the game, players embark on an adventure in darkness, encountering monsters, quests, and boss battles. Players fight monsters to complete quests, unlock new tasks, and earn coins for upgrading equipment and purchasing items. These three single-player H5 games are basic applications. They lack completeness as games, with no on-chain processes for game start, progress, or end, nor do they allow game saving. After the game ends, the Sat’s inscription remains unchanged, defining only the game logic without preserving the game state. These are initial attempts at BTC chain gaming.

(7)Multiplayer Full-Chain Game: BTC PixelWar

Source:https://twitter.com/btcpixelwar

BTC PixelWar claims to be the first full-chain multiplayer game on the BTC blockchain. Participants create on a 256x256 pixel canvas, either by clicking pixels directly or uploading images to generate pixels on the canvas. Each submission produces an inscription of the canvas’s latest state, recursively referencing the inscription from the previous state. This project may have the most recursive inscriptions to date, marking a significant application in the field.

The project introduces a new standard, “BRC721Cofound,” utilizing recursive inscription to allow all Bitcoin users to collaborate on the same canvas, recording the process. Each moment is an inscription, capturing the canvas’s state at that time, including new or updated pixels and references to previous “moment inscriptions,” along with “code inscriptions” to manage image changes between moments. Given the potential for many contributors, rendering the latest canvas state requires deep recursion, potentially lengthening load times. To address this, “code inscriptions” are designed to snapshot the latest canvas state after rendering the current “moment inscription,” then storing this snapshot in the DOM tree of the current inscription. Sequential browsers can simplify the rendering process by caching the DOM trees of each rendered moment inscription, thus reducing recursion levels.

Overall, BTC PixelWar is an innovative and iconic BTC multiplayer game on the blockchain. It not only realizes collaborative creation among multiple players but also optimizes the rendering process. The “BRC721Cofound” standard opens new possibilities for multiplayer gaming applications on the Bitcoin blockchain, showcasing the potential of recursive inscription in gaming and social domains.

V. Challenges and Future Developments of Bitcoin Recursive Inscriptions

Recursive inscriptions have ushered in the era of on-chain inscriptions 2.0, enriching the gameplay of BTC NFTs and making it increasingly likely for BTC NFTs to carve out a completely differentiated path from Ethereum and other chains’ NFTs. The future holds immense potential for imagination and narrative in this space. Recursive inscriptions connect previously independent inscriptions, allowing them to reference each other and forming a diverse database structure. In previous articles, we discussed various derivative protocols based on Ordinals. In fact, when combined with these protocols, recursive inscriptions can read other inscriptions and react based on their own smart instructions to update their status. By indexing, they can directly manipulate the state of protocols, forming a coherent set of actions similar to smart contracts.

At the same time, the vast database of recursive inscriptions provides more operational and imaginative space for inscriptions, including metadata in various fields like basic data, knowledge bases, code libraries, and function libraries. These can reference each other to realize complex logic in product applications. Hence, we can look forward to deep adoption of recursive inscriptions in generative art, blockchain games, and the metaverse, believing that killer applications of the future are in the making.

However, recursive inscriptions also face some challenges:

1、If the recursive level increases, for instance, to ten thousand layers, can off-chain rendering parsers quickly interpret this?;

2、If the number of referenced inscriptions increases, like one Sat referencing ten thousand inscriptions, can off-chain rendering parsers handle this efficiently?

If these challenges are met, theoretically, the games or NFTs created by recursive inscriptions could be infinitely complex and detailed. These issues are hard to fundamentally solve due to the limitations of the BTC network itself, but they could be addressed through indirect technical solutions.

VI. Conclusion

The recursive upgrade in the Ordinals protocol allows for interactivity between inscriptions, enabling new and exciting use cases. With this functionality, generative art, on-chain displays, and efficient storage have become a reality. We can see that developers within the BTC ecosystem continue to create and develop in directions like blockchain games and generative art. Works based on recursive inscriptions are emerging, slowly assembling the various components of a massive project. In the future, we can look forward to the birth of on-chain games, metaverse projects, and interactive generative art with complex product logic.

Disclaimer:

  1. This article is reprinted from [Foresightnews]. All copyrights belong to the original author [JellyZhouishere、GryphsisAcademy]. If there are objections to this reprint, please contact the Gate Learn team, and they will handle it promptly.
  2. Liability Disclaimer: The views and opinions expressed in this article are solely those of the author and do not constitute any investment advice.
  3. Translations of the article into other languages are done by the Gate Learn team. Unless mentioned, copying, distributing, or plagiarizing the translated articles is prohibited.
Start Now
Sign up and get a
$100
Voucher!
Create Account