Steem Monsters Tech Talk - Part 2 - Why We Don't Need Smart Contracts

One of the questions I get asked most often when talking about creating a game and associated NFT’s (Non-Fungible Tokens) on the Steem platform is some variation of: “Don’t you need smart contracts for that?” I thought that answering that question would be a good topic for the second "Steem Monsters Tech Talk" post - so here goes!

The answer, thankfully, is no - you do not need smart contracts for it. Everything that we want to achieve in creating a decentralized game requires only an immutable, public ledger, for which the Steem blockchain definitely qualifies. In fact, this could all be done on the Bitcoin blockchain as well, since it is also an immutable, public ledger, however that would be quite slow and expensive, making a blockchain like Steem a much better choice.

Hard vs Soft Consensus


The primary difference between building a game like Steem Monsters on a platform like Ethereum with programmable smart contracts vs a platform like Steem, without them, comes down to the method of consensus that is used.

Implementing the consensus rules within smart contracts that get executed on the blockchain is known as "hard" consensus. If I broadcast a transaction to the Ethereum network saying that I want to transfer a Cryptokitty from my account to another account, the smart contract code will check if I own that Cryptokitty, and, if not, then it will reject the transaction and it will never get included into a block.

In a "soft" consensus system, like Steem Monsters is currently using on the Steem blockchain, I can broadcast a "custom_json" transaction saying that I am transfering a card I don't actually own to someone else, and it will get included into a block.

But, despite being included in a block, anyone can easily see from the public ledger that I don't own that card, and therefore everyone will agree that that transaction is invalid and will ignore it. So the end result is the same in both cases - there is a clear consensus as to what constitutes a valid vs an invalid transaction and the same rules (in this example the rule is that you can't transfer something you don't own) are enforced.

The Hivemind Soft Consensus Layer for Steem


Many of you are probably aware of the Hivemind project that @roadscape is hard at work building for the Steem platform. This is a soft consensus layer that will run on top of the blockchain and will filter out transactions that the blockchain has accepted but that go against the consensus rules agreed upon by the community.

One of the most highly anticipated features that the Hivemind project will enable is the concept of communities which can include content moderation. Let's take an example where there is a community that only allows posts from a specific list of approved accounts. Since it will be a "soft" consensus feature, I can still publish a post to the blockchain in that community even if I am not on the list of approved accounts, but the Hivemind software will ignore that post as invalid since it voilates the soft consensus rules.

It's important to note that these features are all currently possible even without Hivemind - Utopian.io is a moderated community, for example - but they had to do a lot of custom development work to implement the soft consensus rules themselves. Hivemind aims to provide a standardized way to build moderated communities, and much more, without all of the additional development effort.

In future versions of Hivemind, I hope that it will be easily extendable to add new soft consensus standards for things like NFTs. That would make it much quicker and easier to build games like Steem Monsters and lots of other interesting applications as well on the Steem blockchain.

If you break it down, an easily extendable Hivemind software will allow for a system very much like the smart contracts used on platforms like Ethereum to be built on the Steem platform using this concept of "soft" consensus. This is why I'm really much more excited for Hivemind than for any other development on the Steem platform, including SMTs!

Verifiable Code Execution


There's one other topic that still needs to be addressed for running a decentralized application on a blockchain that doesn't allow programmable smart contracts, and that's the concept of verifiable code execution.

This is something that we have yet to implement for Steem Monsters (mainly due to time constraints more than anything else) but that we absolutely will do in the not-too-distant future.

Right now, when you purchase Steem Monsters booster packs, you have no way to verify the code that is being run to choose the cards in your packs. You have to trust that @aggroed and myself are generating the packs in a fair and equitable manner, which means that this portion of the game is currently not decentralized.

This is because the code is being run on private servers that we control, as compared to being run directly on the Blockchain like is possible on platforms like Ethereum. But, despite that we cannot run the code directly on the Steem blockchain, we can still implement the code in a fully verifable manner.

If we seed our random number generator with a non-predictable value generated by the blockchain, such as the block id of the block containing a Steem Monsters pack purchase transaction, and publish the code for choosing the cards in each pack, then anyone would be able to verify that the pack contents were generated via a pre-published algorithm.

In this way, if we were to ever change that algorithm to do something like give ourselves lots of valuable cards, then anyone could see that we were doing that and everyone would likely lose faith in the game and we would lose our reputations within the Steem community.

One thing I would like to note here is that we are currently using the transaction ID of the purchase transfer transaction to seed our random number generator to generate card packs. Since I found out that the transaction ID can be pre-determined, it is not secure, and therefore I have not released the algorithm for generating the cards to prevent anyone from being able to cheat the system.

But, this means that once we switch to a more secure method, we can then release the original pack generation algorithm which will allow anyone to go back and verify that all the packs that were generated in the past were done fairly and properly.

The same thing can and will be implemented for the battle system once that is released. Just like with pack generation, this will allow anyone to verify that all fights are run in a fair manner, even though the actual code executes on private servers.

Figuring this out as we go...


The tl;dr version of this is that as long as everything that happens is published on an immutable, public ledger, then a fully decentralized, custom application can be achieved without the use of blockchain-level smart contracts by utilizing "soft" consensus and implementing verifiable code execution.

Of course, I've never actually done this before, and it hasn't been done on the Steem blockchain before in any serious way that I'm aware of, so as the section heading says - we are just figuring this out as we go!

There will be bugs, there will be issues, and things will change over time (hopefully for the better), and we really appreciate all of the patience and support from the community as we try to build something that's both groundbreaking for the platform, and lots of fun to play!

Most importantly though, we really value the input from all of you! So, if you feel that I've gotten any of this wrong (which is entirely possible), please let me know, and I'm happy to work together to make sure we get it right!


Banner art by @nateaguila ...except I just added the Steem Monsters logo in the middle :-)

H2
H3
H4
3 columns
2 columns
1 column
39 Comments