Using Bitcoin Lightning Network as an Interface to Ethereum Smart Contracts
Blockchain gaming is a new, experimental application bringing blockchain features to mainstream games. At Blockade Games, we have a long history of experimenting with new technology and ideas, spanning from creating the first crypto-puzzles, to deploying a Twitter bot powered by machine learning, to launching one of the first mainstream blockchain games on the Loom Network. Building at the forefront of technology is in our DNA.
Recently, we have been experimenting with different payment methods for purchasing in-game items and interacting with smart contracts. We believe that Ethereum will be integral to the future of non-fungible assets and blockchain gaming. However, we also believe that Bitcoin is the future of money, and many of our players will prefer to hold most, if not all, of their funds in Bitcoin. We want to make it possible to serve our biggest supporters and players on the Bitcoin network while utilizing all of the infrastructure present on Ethereum and other blockchain networks.
By integrating Bitcoin Lightning Network payments, we are able to accept instant payments in Bitcoin directly, and instantaneously kick off a series of events on any other chain, such as minting a brand new Neon District asset to a buyer’s Ethereum or Loom Network wallet. Here’s how it works:
First, a payment channel must exist between the merchant (us, Blockade Games) and the buyer (you, our favorite Neon District player). A channel can be created by a user connecting to our Bitcoin Lightning node or having a channel open with another node that has a route to us. Once an open channel is established, the purchaser can initiate payments for as long as the channel remains open. For more information on lightning network channels, read about it here.
When a player wishes to buy an in-game item, they can navigate to the item they wish to purchase. For this example, let’s say they want to buy a “Ghost Head”. When they choose to purchase with Bitcoin Lightning, we generate a BOLT-11 compliant payment request QR code. BOLT-11 is an invoice protocol for the lightning network. So now we have a payment request with an invoice. We can give this invoice, account, and item to a monitor system, similar to monitoring events on the EVM, which will listen to our node for the invoice status. *Note: There are other ways to monitor this, for example through a BTC Relay.
Once the player scans the QR code with their Lightning-compatible wallet, our node will use the payment data (if successful) to mark the invoice as paid. Once that invoice is paid, our monitor, which is listening to our node for that invoice, will pick it up and be able to process the payment accordingly. For example, it could call an Ethereum Smart Contract or send the information to some other processing system.
We could use this information to call a Smart Contract on the Ethereum Mainnet — however, if the network has a lot of traffic and high gas prices at the time, then this could be a slow and costly bottleneck. To get around this, we don’t need to mint our item directly on the mainnet — we can also mint directly to the player’s in-game wallet. Our game contracts are deployed simultaneously on the Ethereum mainnet as well as our highly-performant second-layer sidechain (which we call the “game chain”). Depending on the buyer’s preference, their purchase can mint the items on the game chain directly to the user instantly, granting immediate in-game access to their game assets.
Now the player can use the item in the game and also have instant and free transfers to other players in the game. And when the player wants to migrate their game assets to Ethereum or another network, they can use the Transfer Gateway to exit their assets and hold them on any other supported chain — again covering any and all costs with a Lightning Network payment. This allows the user to use their Neon District items in other games that support them or to sell on marketplaces such as OpenSea.
There are many more use cases that have yet to be explored. Among these, we’re looking at providing real-time micro-payments for game developers and content providers — so you can pay for additional lives for just a few Satoshis. We’re also exploring the possibility that we can provide cryptographically-sealed additional content for Free-to-Play games, so a little Lightning can unveil a whole new level to your favorite adventure game.