Redux: Provable On-chain Game Framework Based on BTC Ordinal Theory
  • Contents

  • 1 What is Redux Protocol?

  • 2 Why Redux Protocol?

  • 2.1 Reasons to build game infra in BTC ecosystem based on ordinal theory?

  • 2.2 GameFi and On-chain Game

  • 2.3 On-chain State Machine and Provable State Machine

  • 2.4 Merkle Tree and Stateful Inscription

  • 3 How it works?

  • 3.1 Core Functions

  • 3.2 What is Stateful Inscription?

  • 3.3 What is Merkle Tree?

  • 3.4 Redux Protocol Working Flow

1. What is Redux Protocol?

Redux is a provable game framework and state indexing for building on-chain games and autonomous worlds based on Bitcoin ordinal theory. It serves as the innovation backbone within the crypto gaming sphere, seamlessly integrating blockchain technology and gaming experiences. Through its visionary approach, Redux Protocol brings forth a suite of key features that not only streamline development but also elevate the gaming experience to unprecedented heights. From the revolutionary Game State Indexing, ensuring efficient tracking and retrieval of in-game actions, to the dynamic adaptability of Stateful Inscription, transforming digital relics in response to player interactions, and the precision-driven Tick-driven Runtime, orchestrating real-time game logic seamlessly—Redux Protocol stands at the forefront, redefining the very essence of crypto-native gaming.

2. Why Redux Protocol?

2.1 Reasons to build game infra in BTC ecosystem based on ordinal theory

Unlocking more application scenarios for inscriptions. The BTC ecosystem is booming fast. With the approval of the BTC spot ETF, the price of BTC has now surpassed $70,000, reaching a new historical high. Many new types of assets based on the ordinals protocol, including NFTs and BRC20 tokens, have also seen epic rises. It can be said that the invention of the ordinals protocol has expanded the potential of the BTC chain as a DA layer. However, we believe that "inscribe" can be used not only for issuing assets but also for many more application scenarios.

Exploring new methods for BTC scaling. The commonly discussed layer 2 scaling methods include sidechains, rollups, plasma, and state channels, etc. However, these solutions cannot provide satisfactory performance for building on-chain games. For serious data states (such as financial assets), security is naturally the first consideration. But for non-serious data states (such as on-chain game state updates), performance requirements are higher than security. We find that decentralized indexing is very suitable for building high-performance on-chain games.

2.2 GameFi and On-chain Game

The inherent purpose of games is to provide emotional value, such as the aesthetic pleasure often brought by games, the sense of achievement from completing tasks, and the excitement of defeating enemies. The integration of blockchain technology and games is currently seen in two ways. One approach is to put in-game assets on the blockchain, forming various tokens, including NFT tokens for characters and items, and in-game economic circulation tokens. This is the concept of GameFi, for example, Axie Infinity and Big Time, etc. Another approach is to put both game rules and assets on the blockchain, forming on-chain games. On-chain games have seen significant progress in the past year, creating unique infrastructures. They are considered to be crypto native games because they can offer unique composability of game rules, not just the financial asset composability brought by GameFi.

2.3 On-chain State Machine and Provable State Machine

While the concept of on-chain games sounds promising, there are accompanying issues: the fastest blockchain virtual machines currently only match the performance of servers from 30 years ago. If all of a game's logic and rules are placed on the blockchain, it limits the games to those with simpler game logic and UI. So, do AAA games have no choice but to follow the "GameFi" route, where only assets are put on the blockchain? The emergence of Provable State Machines makes the creation of high-performance 3A on-chain games possible.

Over the past year, we have seen on-chain games generally follow two technological paths: On-chain State Machine and Provable State Machine. For on-chain game engines, the former is typically represented by MUD, while the latter is epitomized by DOJO.

On-chain State Machine: A typical example is the Ethereum paradigm, which is based on blockchain technology and has implemented a mechanism for recording, updating, and verifying states on the chain. The term "on-chain" means that all related state transitions and records are conducted on the blockchain itself, rather than being processed or stored externally.

  1. On-chain State: In Ethereum, the "on-chain" state refers to all data stored on the blockchain, including account balances, smart contract codes, and their storage variables. Unlike traditional centralized systems, in Ethereum, this state is not stored on a central server or database but is distributed across every node in the network. Each node has a complete copy of the state, ensuring the system's transparency and resistance to censorship.

  2. Transactions and State Transitions: In the Ethereum network, each transaction can result in a change of state. For example, when a user sends ETH, this directly affects the balance of the involved accounts. Transactions involving smart contracts can be more complex as they may trigger internal functions of the contract, thereby changing the data stored by the contract. Every transaction is recorded on the chain, and each node verifies these transactions to ensure their validity and correctness.

  3. Blocks and Chain Structure: Transactions are packaged into blocks, and each block is linked to the previous one, creating a timestamped, immutable chain of blocks. This chain structure not only ensures the continuity and security of data but also ensures that every node in the network can reach a consensus on the current global state at any given time.

  4. Consensus Mechanisms: Ethereum uses consensus mechanisms (such as PoW or PoS) to ensure all nodes in the network agree on the current state. This means that any change in state (such as transactions or the results of contract executions) requires a majority of the nodes in the network to reach a consensus. This process ensures the consistency and security of the state, preventing double spending and other types of attacks.

  5. Smart Contracts and On-chain Logic: Smart contracts allow users to deploy custom logic and applications on Ethereum. Once deployed, their code and operations are permanently stored on the blockchain. The execution of these contracts is entirely on-chain, ensuring the transparency and immutability of the processes. This allows Ethereum to handle complex state transitions, not just simple currency transactions.

Provable State Machine: This blockchain technology paradigm aims to address the performance issues found in smart contract platform, especially when it comes to complex computations and state updates. The core idea behind this approach is to move state computations off-chain while maintaining the security and immutability on-chain.

  1. Off-chain Computing: Under the Provable State Machine framework, complex state computations are conducted off the blockchain. This means that not every node needs to process and verify all computations, significantly reducing the demand on onchain resources and overall network congestion. Off-chain computations can be conducted in dedicated environments that offer higher computational efficiency and speed.

  2. On-chain Verification: Although the computations are completed off-chain, their results must be verified on-chain to ensure their accuracy and fairness. This is achieved by submitting a type of evidence known as "state change proofs." These proofs demonstrate that the computations conducted off-chain are correct, eliminating the need to redo the entire computational process on-chain.

It is well known that the BTC blockchain lacks smart contract functionality and has limited TPS. To realize on-chain games, one must choose a state compression solution that combines off-chain computation with on-chain verification.

2.4 Merkle Tree and Stateful Inscription

Thanks to the advent of the ordinals protocol, the BTC chain can now serve as a secure and usable Data Availability (DA) layer. This enables inscriptions to act as pointers to the state of off-chain computations or changes in the states. The essence of these state pointers is state compression, which can be realized in several ways currently.

Dojo on Starknet is a typical example. By moving the computation of game states off-chain and utilizing technologies like zero-knowledge proofs to verify the correctness of these states, Dojo can improve performance without sacrificing security and transparency. This means that even computation-intensive games can benefit from blockchain features such as immutability, transparency, and decentralization while overcoming the performance bottlenecks faced by EVM when processing these types of games.

Metaplex on Solana has been researching state compression for NFTs since 2022, known as Compressed NFTs. Unlike uncompressed NFTs that store their states (metadata, owners, etc.) on the chain, Compressed NFTs store their states in a Merkle tree. For Compressed NFTs, detailed account data is not stored on the chain but in a data storage managed by an RPC provider or indexer. Moreover, Compressed NFTs maintain backward compatibility with Metaplex NFTs, allowing them to be easily transferred, delegated, or even decompressed into account space to ensure interoperability with existing smart contracts.

Considering that BTC transactions exist in the form of a Merkle tree in BTC full nodes, Redux Protocol attempts to map and compress the world state of games in the form of a Merkle tree and store it in the BTC ecosystem's DA layer. Indexers monitor and record all changes in the state machine, generating corresponding DA proofs uploaded to the BTC SegWit space to form unique state inscriptions. For specific technical details, refer to the following sections.

3. How it works?

3.1 Core Functions

Game State Indexing: The Game State Indexer adopts a data model facilitating direct mapping of game actions to a relational database. When players perform operations, known as actions, on entities within the game, the indexer ensures these actions are efficiently recorded, allowing for easy retrieval and tracking of the game state.

Example: If a player in a crypto-native strategy game performs an action like deploying a unit, the Game State Indexer records this action and updates the game state, making the information accessible for future reference.

Stateful Inscription: Stateful Inscription introduces the ability for inscriptions, which were initially designed as digital relics, to dynamically change numerical values and statuses. This feature allows for the evolution of inscriptions in response to specific in-game actions, adding a layer of adaptability to in-game assets.

Example: Consider an inscription representing a magical shield in a crypto-native RPG. With Stateful Inscription, the shield's protective capabilities can dynamically adjust based on the player's interactions, such as successfully blocking attacks or absorbing magical energy.

3.2 What is Stateful Inscription?

Inscriptions were initially designed as digital relics, distinct from other NFTs in that their content is entirely stored on the blockchain, rather than relying on external storage solutions like IPFS. This aspect is indeed attractive. However, an artifact that cannot interact seems limited in its ability to expand into new application scenarios. We believe the potential of inscriptions goes far beyond this. Civilization is built on the interaction of many individuals; if inscriptions could become stateful, they could unlock a whole new world.

The concept of stateful inscriptions can be divided into two parts as illustrated: one part consists of immutable state, which is inscribed on the BTC blockchain. If we compare stateful inscriptions to an RPG game, then the immutable content would be the unit's basic attributes, which are fixed. The other part consists of mutable state, the storage of which resides within the Redux protocol's Indexer. On the inscription itself, what is stored is a pointer that points to the mutable state set of this inscription.

3.3 What is Merkle Tree?

A Merkle tree is a type of binary tree where each leaf node contains the hash value of a block of data, and each non-leaf node contains the hash of the hashes of its child nodes. This structure is built from the bottom up until there is only one node left at the top of the tree, known as the root hash or Merkle root. The Merkle root provides a unique fingerprint of the data set, which can be used to verify the integrity of the data. For mutable state sets, we utilize Merkle trees for storage. Due to the characteristics of Merkle trees, we can quickly verify changes in a particular state.

Store mutable state as Merkle Tree:

It represents the state attributes of a game character. At the base of the tree are the leaf nodes for each attribute, including Strength (189), Agility (95), Intelligence (82), Current Attack Power (125-149), and Experience (150). These leaf nodes are hashed and paired to form parent nodes, which are then combined again to form higher-level nodes, culminating in a single root hash value at the top. In this way, any change to the game character's state, such as modifying the experience value, will result in a change in the root hash value, thus providing an efficient method for verifying data integrity and consistency. This not only ensures data security but also provides an efficient mechanism for data storage and verification.

3.4 Redux Protocol Working Flow

Developers or world editors are responsible for constructing the basic framework of the world and its stateful inscriptions. This involves defining which states are immutable (static) and which are mutable (dynamic), as well as establishing the logic for user interaction with state inscriptions. The Redux protocol provides a runtime environment, allowing developers to customize how players interact with stateful inscriptions.

Users or players experience the game by interacting with stateful inscriptions. Stateful inscriptions can be likened to the protagonist in an RPG game, with players controlling it to level up, pass levels, acquire equipment, and earn in-game token rewards designed by the developers.

Regarding the workflow, developers first create and define the logical framework of their world and stateful inscriptions. This "world" can be seen as a collection of entities, where "entities" refer to stateful inscriptions. As shown in the diagram, the deployment process of stateful inscriptions is related to interactions with BTC, while the handling of state changes is facilitated through a mechanism called "World Derived Pointer" interacting with Redux's indexers. Redux plans to open up the operation of these indexers in the future to enhance the openness and decentralization of the protocol.

-In essence, why choose Redux? Probably because you're looking to deploy your world on the most valuable blockchain out there.

Subscribe to Redux Protocol
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.