Steem Monsters Tech Talk - Steem Blockchain Integration
As @aggroed has mentioned, we are both absolutely floored by the response Steem Monsters has received from the Steem community so far! While I have strict instructions to spend all of my free time “furiously coding” new features, I thought it would be good to take some time to discuss the technical details of how the Steem Monsters project utilizes the Steem blockchain since that is obviously the primary differentiating feature of this game.
As most of you probably know, the Steem blockchain does not support custom-built smart contracts like blockchains such as Ethereum, EOS, and some others do. This means that it’s not possible to build a game, or any custom app really, that is run and executed directly on the blockchain in a completely decentralized manner.
While this might seem like a bad thing, it’s actually a very good thing, but I’m not going to get into that right now since it is far outside the scope of this post. You’ll just have to trust me!
So while Steem Monsters cannot be run on the Steem blockchain directly, we can still utilize the Steem blockchain to record everything that takes place in the game in an immutable, decentralized manner, and allow players to authorize actions using their private keys. This allows for complete transparency, true digital asset ownership, and for the full “state” of the game to be recorded permanently and immutably.
Custom JSON Operations FTW!
The game achieves the goals described above by publishing everything that happens in the game on the blockchain using Custom JSON operations. This is an operation built into and fully supported by the Steem blockchain that allows publishing any arbitrary data to the blockchain which does not show up as a blog post or comment and cannot receive votes or earn rewards. It is simply a way to store some data on the blockchain.
Whenever packs are purchased from the Steem Monsters website, a Custom JSON operation is published to the blockchain with the the unique identifier and type of each card in those packs along with the Steem account name of the purchaser. This way all of the cards that exist are published, permanently and immutably, on the blockchain, allowing anyone to check, verify, and prove what cards are owned by whom.
Any promotional packs we give out are “purchased” by the @steemmonsters account and published to the blockchain in the same way as any other packs, so there is complete transparency around that as well.
If you look at the @steemmonsters account on a block explorer like steemd.com you can see these custom_json transactions being posted each time packs are purchased:
You can see in the image above that each individual card in the game has a unique identifier which looks something like this: "C-1GBTAYHMHC". It’s important to note that it’s not every type of card, it’s every individual card. This means that if you have five Pirate Captains in your collection, they each have their own unique identifier and are each treated as separate cards which can be bought, sold, traded, and upgraded individually. You can see the unique identifier of each card in your collection on the Steem Monsters website by clicking on a specific card on the “My Collection” page to bring up the card details.
These are known as “Non-Fungible Tokens” or NFTs. Non-Fungible means that each individual token is different and can have its own properties, as compared to fungible tokens like STEEM, SBD, SMTs, BTC, ETH, etc which are tokens that are each indistinguishable and interchangeable. Cryptokitties are an example of NFTs on the Ethereum blockchain and, as far I know, Steem Monsters are the first and currently only NFTs available on the Steem blockchain. Again, I’m not going to go into the topic of NFTs too much here, but it’s a fascinating subject for those of you who are interested and want to research it further.
One of the great things about decentralized blockchains is that they have, for the first time, introduced the concept of true digital asset ownership. If you buy a pack of Magic the Gathering cards then you own that pack and each of the cards in it by the mere fact that you physically possess it (and presumably acquired it legally).
If you buy a pack of cards in Hearthstone, however, you only “own” that pack and those cards because Blizzard says you do. In reality Blizzard owns them because they own and control the database in which those cards are stored. Blizzard can delete your cards from the database, or transfer them to someone else, and they would be gone and there is no way to prove that you really owned them (since you technically didn’t).
Before blockchain technology came out it was not possible to truly own digital assets in the same way you can own physical ones, but now you can! If you have the private key to an Ethereum account containing some cryptokitties then you own them and have complete control over them. There is no central entity like Blizzard that can take them away from you.
The same thing applies to Steem Monsters as well. While we do maintain a private server and database like Blizzard does for Hearthstone, in order for a card to be transferred or altered in any way it requires the owner to publish a Custom JSON transaction using their private posting key to authorize the action.
This means that, while we may control the Steem Monsters website and our internal database, if we were to ever transfer or alter your cards you can prove that it was an unauthorized action because you did not publish and sign the transaction with your private key.
You can see how this looks for combining cards in the screenshot below:
Then once that is published on the player’s account, the @steemmonsters account will also publish a Custom JSON with the details / results of that action and a reference to the transaction published by the player authorizing it. This allows the full “state” of the game to still be contained within the @steemmonsters account history. You can see an example of the second transaction below:
It’s important to also note that publishing Custom JSON operations to the blockchain from your own account in order to “authorize” actions will require you to log in to the Steem Monsters website using your private posting key. Previously we allowed logging in using the private memo key and even though very few people have used that option I wanted to make sure we were very clear and transparent about the change to require the private posting key and the reasons behind it.
Your private key is kept and used only locally within your web browser and is never sent anywhere. You can feel free to check the page source and network traffic sent from the site to verify this. Also you can read a good discussion between myself and @lukestokes about these decisions here.
In Conclusion (i.e. back to work for me!)
I have spent a LOT of time thinking about how to create a game like this using NFTs on the Steem blockchain (even before Steem Monsters was ever conceived!) but that doesn’t mean that what I ended up coming up with - as described above - is necessarily the best or only way to achieve these goals.
My focus, first and foremost, will be on building out the game and adding new features, but the integration with the Steem blockchain is what makes this game unique and I would love to hear thoughts/comments/ideas from the Steem community on how the implementation may be able to be changed or improved!
Thank you for reading and for your overwhelming praise and support for Steem Monsters! I want to wish everyone the best of luck in the tournaments to come and may every pack you open contain a legendary! But please let me know if that happens because that means something is very wrong!
Banner art by @nateaguila ...except I just added the Steem Monsters logo in the middle :-)