The Ledger of Szabo: Gaming with Lightning Network and Ethereum
What is “The Ledger of Szabo”?
The Ledger of Szabo, created by Blockade Games, is an adventure game inspired by classic 8-bit videogames. The player finds themselves stranded on an island while seeking out Bitcoin puzzles to solve. To escape, the player needs to find three magic keys to unlock the treasure and leave the island, with the journey taking them through a winding overworld and a perplexing dungeon filled with monsters, mazes, and puzzles.
The game is more than just a fun, nostalgic romp through an 8-bit world. The Ledger of Szabo is also the most ambitious puzzle game Blockade Games has released yet. Inside the game are 8 independent Bitcoin and Ethereum puzzles waiting to be discovered throughout the adventure, for a total prize of 1 BTC, donated by The Pineapple Fund.
What is an NFT?
An NFT is a non-fungible token, a blockchain-backed digital asset that you can own with your cryptocurrency wallet. NFTs can be freely traded, bought and sold on blockchains such as Ethereum, and we’re introducing the feature for players to pay for NFTs using Bitcoin through the Lightning Network.
Create your own NFT
One of the fun, new ideas we’re introducing is the ability for players to create their own game character designs, mint them as NFTs, and then play as their created character in-game! We’ve already had a number of submissions for characters, such as a Bitcoin Wizard, famous comic-book heroes, movie characters, a walking Bitcoin, a Ravencoin hero and more. It’s worth noting that character customization includes specialized attack moves.
One of the interesting benefits of letting people create their own NFTs is that they can then go ahead and sell their playable creations to other players on open marketplaces. Talented sprite artists can make characters and gift them to friends or design highly desirable NFTs for the broader market.
The Player’s Experience
In order to play The Ledger of Szabo and seek out the 8 cryptocurrency puzzles and prizes, a player will need to have an Ethereum wallet (which includes MetaMask, Portis, and Fortmatic) to hold their NFT and sign a message that proves they own their characters. Once they sign the message in-game, the game opens up to them, and they can play as any of the unique characters in their wallet.
Tech Behind the Scenes
The Ledger of Szabo uses a mix of Bitcoin and Ethereum technology to provide a unique game experience for the player. For the first time, players can buy Ethereum Non-Fungible Tokens using the Bitcoin Lightning Network. Our shop will let players buy tokens in Bitcoin or Ethereum — and the NFT will be minted to the player’s Ethereum address.
Beyond this, we’re also using Web3Connect to support as many wallets as possible. Currently supported wallets include MetaMask, Portis, Fortmatic, and Wallet Connect. Due to the bleeding-edge nature of the technology we’re using, only Chrome is promised to be supported at this time, but we’re investigating ways to improve the experience for more wallets and more browsers.
To start the game, the player needs to cryptographically sign a unique message, which is easy to do using current Web3 wallets. By signing the message, the player can prove that they own the wallet address and all of the NFTs inside of their wallet. Then, we retrieve all of their Characters and Power-Ups, and the game is unlocked for the player. Unlike most dApps, The Ledger of Szabo does not ask the player to make any transactions while playing the game — the player only needs to purchase a character in order to download the game.
This is the first game we’re releasing that is using our new blockchain game platform, which was first prototyped in Plasma Bears, and is being rewritten and battle-hardened for Neon District at the end of this year. The Ledger of Szabo is our first wide-scale test for our blockchain-agnostic NFT real-time cache and new APIs for pulling current NFT ownership and metadata.
The Ledger of Szabo is also the first game in which we are testing our Bitcoin Lightning Network payment gateway, so players can buy their characters and power-ups using Bitcoin. Because the game does not require any transaction fees, an otherwise empty wallet with only the player’s NFTs is all that is needed to play the game.
Further, when a player buys a new NFT, we automatically monitor and create the game assets for the player on the spot. Each time a player buys a newly minted character, they have a unique game asset to play with. Every character has their own random name and visual appearance, making each NFT distinct from one another.
In-Depth: Our Bitcoin Lightning Research
Our current Lightning Network and Smart Contract integration uses a central oracle to watch for completed Lightning Network payments and then submits the Ethereum smart contract call to mint a new character for the player.
As part of our on-going research, we’ve explored alternative ways to remove the oracle from the process, and found that when it comes to current user experience and security trade-offs, the current use of an oracle is the quickest and least complex approach for the end user to interact with Ethereum smart contracts.
Our oracle approach, which is live on The Ledger of Szabo, was developed by Troy Salem, aka Cr0wn_Gh0ul. In this approach, the Lightning Network transaction is confirmed nearly instantly, which allows us to issue the minting request immediately, and with a satisfactory gas fee, the player will own their NFT within one or two blocks on the Ethereum mainnet, which is only about a 15 to 30 second wait.
Our lead blockchain engineer, Rob Myers, has explored two other mechanisms for using Bitcoin and Lightning Network transactions to interact with Ethereum smart contracts. The first is a pure Bitcoin approach, and the second uses the Lightning Network.
The first approach, using the Bitcoin network directly, works such that the player generates a pre-image that contains their Ethereum address and a random nonce, then produces a double-hash image from that, which is broadcast as part of a Bitcoin transaction payment to the seller, which is not spendable unless the seller knows the first hash image. If the seller is dishonest and doesn’t register the transaction for the buyer on the Ethereum smart contract, then the buyer can retrieve their funds from the UTXO after a lock-up period.
When the seller sees the transaction on the Bitcoin blockchain, they submit a transaction to the Ethereum smart contract registering the purchase for an NFT by storing the double-hash image. The buyer then witnesses the registration event, and they can receive their NFT by submitting the original values used to generate the double-hash image to the Ethereum contract, which it hashes twice and compares to the registered double-hash image — if it’s correct, then the buyer receives their NFT. Finally, the seller now knows the original input and can unlock their funds from the Bitcoin transaction.
This previous approach has the ultimate benefit that it is fully trustless — a purchaser and the seller do not have to trust each other, and both can be sure that the other party doesn’t receive any Bitcoin or Ethereum NFTs without exchanging information that allows both parties to simultaneously receive the payment or the NFT. The major drawbacks, of course, are that it is an incredibly involved approach to expect people to undergo to purchase small ticket items, such as $5 to $10 game assets — but such an approach is hugely valuable in large transfers between Bitcoin and Ethereum. It’s slower than a Lightning payment (10 minutes for the Bitcoin block) and if Bitcoin fees are high at the time of purchase, a payment provider might be cheaper for small purchases.
The second approach, which uses the Lightning Network, is similar to the double-hashed pre-image approach above. When the buyer and seller agree to transact using the Lightning Network, the seller constructs a pre-image of random bits , hashes it, and then registers the buyer’s Ethereum address and the hashed pre-image with the smart contract. Then the buyer creates the invoice and includes the . The seller pays the invoice, receives the pre-image as part of the completion of the Lightning transaction, and then can submit that pre-image to the Ethereum smart contract for verification and to receive their NFT.
This approach is far faster than the pure Bitcoin network approach, and it still retains the trustless nature of the transaction. It is still a bit involved for most users, particularly for small amounts of Bitcoin, but the time to wait to complete the purchase is only limited by the time for the first and second Ethereum transactions to confirm, as the Lightning Network payments are nearly instantaneous.
What’re you waiting for? Go play!
Go out, create, and have fun, and enjoy the treasure hunts hidden within The Ledger of Szabo!
Puzzle Prize Addresses
- 0.01 Bitcoin: 17iZVg6xizCB8Pnaif5Ct4pHmE9Xpb3MTc
- 0.02 Bitcoin: 1DHNn8K1ieJnGqUwNspEEuRLBafVPmB3wz
- 1.69 Ethereum: 0xda72652810720D019b6cbF49E99bb1fCbD6AC004
- 0.04 Bitcoin: 1Q4SWuuqGoVt5UtLgzCVBYfgyJasEn54v4
- 8.37 Ethereum: 0x984f145fe2B6dA0328163A159BD1e422BF5EF48a
- 0.20 Bitcoin: 1M5aizZ1ErzJ3tiCxJK9Pe6hqFSU4ZLcPR
- 13.97 Ethereum: 0x30391aD8977b60d1FC7f459B7F8C7a0E4F81595d
- 0.30 Bitcoin: Hidden