Satoshi Dragons

Satoshi Dragons

A smart contract-enforced NFT game on Bitcoin


The problem Satoshi Dragons solves

Satoshi Dragons is a Bitcoin-based game where a collection of NFTs, namely the dragons, perform smart contract-enforced interactions. This is achieved by combining the 1Sat token protocol with sCrypt smart contracts.

How It Works

A game of Satoshi Dragons starts with a "realm" mint transaction, where dragon NFTs are created and assigned to their owners. Each dragon gets its separate 1Sat UTXO, locked by a special smart contract script. By leveraging some more advanced techniques, the smart contract enables the NFTs to interact with each other in an "on-chain" fashion.

To keep things simple, Satoshi Dragons implements a single "battle" mechanism. The outcome of this battle is determined by the dragons' respective power levels and some randomness.

An owner of one dragon can challenge another by constructing a "challenge" PSBT. The challenged party checks the PSBT's structure and accepts the challenge by signing and broadcasting the transaction.

Once the challenge transaction is broadcast and mined into a block, the battle can be executed via a smart contract method call. The called method implements the game mechanics. The outcome of the battle depends on the dragons' power levels. The higher it is relative to the opposing dragon, the higher the chance of winning. To keep things interesting, randomness is introduced via the block header, where the challenge transaction was mined.

tx-diagram

Challenges I ran into

Players may "feed" their own dragons by battling their dragon against forged low-level dragons they created. To resolve this, game clients would have to index the history of a dragon to validate that it stems from the same valid genesis transaction as theirs. A better on-chain approach would be to make the smart contract validate a recursive zk-SNARK that proves the history of the NFT. However, as of this writing, there is no working implementation of a recursive SNARK verifier on Bitcoin yet.

So, for now, if it is detected by the game clients, that a dragon NFT has engaged in some non-valid interaction in its history, it is disqualified from the game.

Technologies used

Discussion