Practical Plasma (Volume I): Gaming
A series on practical uses of the Plasma technique by Loom Network
- We released our Plasma Cash implementation in June 2018. Check out the release announcement here.
Articles in this series:
Just in case you aren’t in the loop…
Plasma ain’t some sciencey stuff inside your blood — In the world of Blockchain, Plasma is a technique for making secure deposits and withdrawals between blockchains.
It’s like a digital security guard that never sleeps —and prevents 100% of all robbery attempts.
…and it is gaining steam.
In fact, right now — it is virtually impossible to talk to anyone in the Ethereum community without Plasma being mentioned in the conversation within the first 5 minutes.
Everyone is buzzing about Plasma.
…and guess what?
We at Loom Network are also incredibly excited about the possibilities of Plasma.
It’s important, however, not to get stuck (and distracted) on the technical layer of Plasma.
At the end of the day, new technology should be about enabling novel experiences and making life easier for the end user — it should not be for geeking out for its own sake.
Today, I am going to give you the inside scoop on some of the new (and incredibly cool) types of games that our Plasma implementations can be used for.
We’ll be looking at a few interesting examples to illustrate what’s possible with interconnected blockchain systems backed by Plasma.
…and instead of these examples coming to life at some point in the distant future, these are all examples that will become reality very soon.
1. Transferring Decks to Play on a Sidechain
Imagine you are playing a fun card battle game like Magic: the Gathering with a bunch of friends over a few beers.
The only difference is that, in this case your entire card game is being played on the Blockchain.
Your cards are represented by what we call Non-Fungible Tokens (NFTs)— that means each token is unique and identifiable, and belongs to a single owner. Just like real playing cards.
Here’s the thing—playing a card battle game like Magic the Gathering on Ethereum is not feasible.
Since you would have to pay gas fees for LITERALLY EVERY action in the game, it’s going to get very very expensive. Plus, since you’d also be required to sign a transaction via MetaMask for EVERY MOVE you make, there’s a lot of friction from a UX perspective.
In short, playing any Blockchain game suddenly becomes too cumbersome.
Sidechains are the solution for frictionless Blockchain Gaming
Instead of having battles take place on Ethereum, we could simply store the cards as NFTs on Ethereum, but handle all the game & battle logic on a Loom Plasma Chain.
Players would transfer their cards to the Loom Chain only for the duration of the battle, and the Loom Chain would transfer the cards back to them when the battle is finished.
This way, while players are not playing the game, they don’t have to worry about security.
All of their idle game assets are completely safe.
But wait — what about WHILE they’re playing the game? What if the Loom Chain steals their cards?
If users have to transfer their assets to the Loom Chain for the duration of the game, that means they have to trust the Loom Chain’s consensus algorithm, right?
After all, they’re transferring their cards to the Loom Chain to play the game, and trusting that the Loom Chain will transfer the cards back to them when the game is finished.
Here’s where Plasma comes in.
Plasma allows the original owner of the assets to transfer them to a sidechain without needing to trust the sidechain’s consensus algorithm.
If a fraudulent transaction is made by any validator, the owner can initiate a Plasma Exit and withdraw his cards back to the main chain — effectively preventing a digital heist of his hard earned game assets.
This gives us the best of both worlds:
- Players can have true ownership of their assets on a fully decentralized blockchain like Ethereum.
- These assets can be used to play games on a sidechain optimized for high throughput, so users don’t have to pay high gas fees for every action.
- The assets on the sidechain are secured by plasma — meaning the player can transfer them to the sidechain with total peace of mind that any fraudulent attempts by the sidechain to steal their assets can easily be contested on Ethereum itself.
In essence, the Loom Chain gives you a high-performance sidechain for the card battles to take place on, and Plasma gives you security guarantees that the Loom Chain can’t steal your cards even during the time they’re in its possession.
Adding an Expiration Date for Additional Security
Transferring the cards back and forth between Ethereum mainnet for every single battle would require paying gas for the transfer fee each time.
Thus, in a lot of cases it may make sense to transfer the cards to the Loom Chain once, play as many games as you want to, and then initiate an exit back to Ethereum once you’re finished with a gaming session.
But what happens if you forget to transfer your cards back to Ethereum when you’re finished?
To handle this case, users can send decks to the Plasma Chain with a preset expiration period — an hour, a day, or a week, for example.*
This way if they forget to transfer their assets back to mainnet at the end of the session, the expiration date ensures that the Plasma Chain will initiate an exit of their cards for them after that time has passed.
* We expect this to be implemented as middle-ware as it is not part of the core protocol.
2. Playing With Stakes
Let’s take our card battle game example from above and change the rules a bit:
Let’s make it a game with real stakes, where you bet a card against your opponent— and if you lose the round, you lose the card.
Or we could even generalize this to a casino-based sidechain with games like Poker and Blackjack.
Normally, when you use an online casino, you first need to transfer a bunch of money to them, which then allows you to play games and bet. But if you’re playing at high stakes, you may have thousands of dollars in funds at risk that you’ve entrusted to the casino, just sitting in their possession.
Plasma Chains can reduce the levels of trust necessary here by only putting your assets at risk for the duration of the game.
For example, if you and your opponent were playing a round of Heads-Up No-Limit Hold’em with a 5 ETH buy-in, you would both transfer 5 ETH into the smart contract on Ethereum owned by the Plasma Chain.
After the game was completed, the Plasma Chain would then transfer your funds back to you and your opponent based on the outcome of the game. Your funds would only be at risk for the duration of the single game, and you wouldn’t have to leave your entire bankroll in the poker host’s possession indefinitely.
Likewise in a card battle game, you would be able to deposit the card or cards you wish to bet to the Plasma contract, and only that card would be at risk.
As above, a number of games could be batched together and the funds/cards could be transferred with an expiration date—and if the Plasma Chain tried to run off with everyone’s funds, users could initiate a Plasma Exit to withdraw their funds, and the dispute would be settled by the Plasma contract on mainnet.
3. Battling Your Zombies on a Sidechain
For those of you who built your first Ethereum game with CryptoZombies.io (our interactive code school for learning to build your own DApps on Ethereum), you’ll recall we added
ZombieBattle functionality for your zombie to fight with other players’ zombies.
But our battles weren’t interactive due to limitations on Ethereum — you simply chose to attack a specific zombie, and the outcome of the battle was determined by probability.
This was because on Ethereum, it’s hard to make interactive battles—users would have to pay gas for every move (attack, defend, etc.), and their opponent would have to wait 15+ seconds for the action to get validated and added to a block before he could take his turn.
That’s no fun — for gaming or your wallet.
But with a Loom DAppChain, we can use a more performant consensus algorithm that can process dozens of blocks every second. This makes it possible to have real, interactive, Pokemon-style battles.
Just like with decks of cards, you can have your Zombies stored on mainnet as ERC721 Non-Fungible Tokens. You can then deposit your Zombie (including all of its game statistics) onto a DAppChain, and have all the battle logic take place there.
When you withdraw your zombie to the Root Chain, it will have its stats updated according to all the fights that took place in the DAppChain.
4. Upgrading and Merging Game Characters
In our upcoming game “CryptoZombies Rancher”, you’ll be able to merge 2 Zombies to make a better, upgraded Zombie. This is similar to how in CryptoKitties you can breed your cats to get a new cat.
You may also recall that at its peak, CryptoKitties was so popular that it totally clogged up Ethereum mainnet with transactions.
You can’t blame the users — they just wanted to try all sorts of different merging combinations to try and get the best kitties possible. But you CAN offload these transactions to a Sidechain to reduce costs for players to experiment, and prevent Ethereum from being bogged down by gamers being silly and having fun 😉
In this case, the user would transfer their Zombies to the Plasma Chain, which would handle the merging. The user could keep their new Zombie on the Plasma Chain to perform subsequent merges, or they can withdraw it back to mainnet at their convenience.
This example is especially interesting from a technical perspective, because it involves merging two different tokens into a new one. These details are currently under heavy discussion (along with token-splitting) on calls from the Plasma implementation group.
5. Decentralized Auction House for Game Assets
What’s the point in tokenizing game assets if you can’t buy, sell, and trade them with other players?
Decentralized game item marketplaces will be an inevitable part of the future, and are something we’re really excited about at Loom Network.
You can have an eBay-style auction house entirely devoted to tokenized in-game items and characters for literally every blockchain-based game in existence.
But as we’ve seen with CryptoCurrency exchanges in the past, they typically require users to store all their funds on the exchange — which makes them a huge target for hacks and employee theft, and represents a massive risk to their users.
Plasma Cash can be utilized to operate a Decentralized Exchange on a Sidechain and make this a lot less risky.
As in the above examples, the assets will only be at risk during the time the individual auction is taking place, and Plasma Exits give users a way to withdraw their assets if the Plasma Chain tries to do something dishonest and run away with everyone’s money and items.
This allows us to have a fully decentralized auction house marketplace where users are able to trade, buy, and sell their characters, items, and cards, without needing to entrust their assets to a central party.
Loom Network Is on the Forefront of Developing Plasma-Infused DAppChains
Up until now, it’s been necessary to run all of a game’s code on the main Ethereum chain in order to provide the level of asset security that game players demand in cryptographic systems.
However, as we have seen in this article, reliable Plasma chains completely change that landscape — unlocking totally new types of gaming experiences not previously possible on Ethereum alone.
The above are only a few examples that we’ve been working on at Loom Network in our own games. The number of use cases for DAppChains with assets backed by the main Ethereum chain is limited only by developers’ imaginations.
And at Loom Network, we’re busy creating reliable, tested systems that will let those imaginations run wild.
So, stay tuned 😉
P.S. If you are a developer and haven’t already — sign up for the Loom SDK Beta.
Loom Network is a platform for building highly scalable DPoS sidechains to Ethereum, with a focus on large-scale games and social apps.
Want more info? Start here.
Want to stake your LOOM tokens and help secure PlasmaChain? Find out how.
Fan of blockchain gaming? Check out Zombie Battleground, the world’s first desktop and mobile card game that runs fully on its own blockchain.
And if you enjoyed this article and want to stay in the loop, go ahead and sign up for our private mailing list.