Steem Monsters Tech Talk - Steem Blockchain Integration

in #steemmonsters6 years ago

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:

image1.png

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.

Card Ownership


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:

image2.png

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:

image3.png

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!

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

Sort:  

Nicely explained @yabapmatt - when I first saw the Steem Monsters announcement I knew I had to support this project, because as a developer seeing this kind of stuff being built on Steem exciting. And as someone who obsessively collects things (like unique Australian $2 coins) it taps into that "Pokemon" collecting part of my brain.

In my experience always attempting to make everything completely decentralised on the blockchain comes with disadvantages. As you have seemingly have discovered, there are ways to maintain a separate database of data and then write into the blockchain, I guess technically you could call a database + blockchain combination a centralised sidechain.

I've been working on a project for Steem which will use the blockchain to write certain operations into the chain as well as read, but for other inconsequential data, it'll be encrypted in spread out MongoDB instances. The data won't be accessible to anyone other than the user who use their private key to unlock the data. It doesn't give you the ultimate redundancy that a decentralised blockchain does, but the chances of the fallback instances I have in different regions all going down is very unlikely.

You should make these technical deep-dive posts a frequent thing because it's insightful. And as someone who is building applications on the Steem blockchain myself, the shared knowledge helps with things I and others are also building.

Really glad you like it and thank you for your support! I definitely plan to do more "tech talk" posts as the project progresses, but no guarantees on the frequency!

No worries @yabapmatt - while I have you here (and apologies if you already answered this previously) but any plans to open source Steem Monsters? I think you would have a lot of support from the Steem developer community and it could help add new features in the current app/fix existing bugs. I, for one, would love to contribute.

Going open source is definitely something that I like and that I have considered for Steem Monsters but I don't think we're ready to do that quite yet.

Yes please! Look forward to more technical deep dives posts from you!

Great work @yabapmatt!
Just wondering, how will you be utilising blockchain when tournaments come out? Will the battles be recorded on the blockchain in some way and will there be a way to meaningfully view the tournament history from the blockchain?

Tournament and battle details will absolutely be recorded on the blockchain! You will be able to view the history in a meaningful way on the Steem Monsters website, but ideally there will be nothing to stop someone else from making their own "tournament viewer" site using the data published on the chain.

I love that you spent the time to explain all the details here, particularly about ownership of digital assets. For a lot of people, something like this is the first time they've purchased an asset using steem/sbd (their steemit earnings, and evidence of their effort on steemit!) and to feel safe in doing that is important.

Nice work so far, lots of folks I know are looking forward to seeing how this progresses!

I didn't know you are involved with Steem Monsters. I was never a Pokemon card collector in my youth and don't think I will ever be one now, lol. I'm game to try it out though. Just bought a couple packs and am now a proud owner of a...wait..let me check...Air Elemental and Selena Sky. :)

Thanks for taking time to write the tech portion of it. I'm sure many are more comfortable playing the game knowing that transactions are recorded on the blockchain. You did mention on one of your older posts that you were working on a big project. Steem Monsters is definitely a big one!

Awesome, thanks for the explanation, I guess if someone really wanted to they could create some sort of decentralized steem monster card explorer that shows what users own what cards on the STEEM blockchain...

Yes - this is exactly the idea!

Very cool @yabapmatt, learning about this all now and I'll be sure to pick up some packs. As an avid MTG player, it's incredible to see blockchain tackle the dire problems of authenticity, ownership, and general function of digital TCGs in the modern world.

Also, we'd love to do an article on this for @sndbox / @creativecrypto if you and/or @aggroed are down for some interview questions.

Thanks! I would definitely be open to doing an interview about it. Let me know!

@yabapmatt do you mind throwing us an email at [email protected]? We can send you an interview questionnaire =)

You got a 25.00% Upvote and Resteem from @ebargains, as well as upvotes from our curation trail followers!

If you are looking to earn a passive no hassle return on your Steem Power, delegate your SP to @ebargains by clicking on one of the ready to delegate links:
50SP | 100SP | 250SP | 500SP | 1000SP | 5000SP | Custom Amount

You will earn 90% of the voting service's earnings based on your delegated SP's prorated share of the service's SP pool daily! That is up to 38.5% APR! You can also undelegate at anytime.

We are also a very profitable curation trail leader on https://steemauto.com/. Follow @ebargains today and earn more on curation rewards!

Well said @yabapmatt!! I was curious how this was going to be set up! It is pretty damn genius I must say! It makes sense with the private posting keys being able to sign the messages even though the steem monsters database is separate!

I am looking forward to following this project even though I missed the whole trading card and gaming as a kid!!

I may need to get someone to show me the ropes or play on my behalf! :D

I'm sure there will be plenty of people making videos, guides, etc to show you the ropes once the tournaments start! You should definitely play yourself and not have someone play for you - otherwise what's the fun?

P.S. I am so looking forward to getting the Steem silver rounds!

That is true! My little brother loves gaming and it might be a good way to get him onto Steemit!!

Did you see the latest update?? It’s here in case you missed it!

I may be busy, but I never miss a Steem Silver Round update! That would be great if you can get your brother into Steem - let me know if you need any help creating an account for him. At some point we definitely want to focus on promoting the game outside of the existing Steem community. It's a great way to get new people into the ecosystem.

I’m glad you stay up to date with it!! A while back, neoxian showed me Vessel and I was able to successfully create an account using it! I was impressed with how easy it was to use!

I do agree that it is a great way to get people onto the platform here!

This is amazing! I was posting about the possibilities of smts tokenizing the cards on an open market in the discord suggestions. Okay so can I ask you something? Can the NFT still be tokenized and traded on an open market schema as well?

I love to learn how things work behind the scenes. I submitted a map to the cartography contest and started a 3d model of it because it's a 3d map. Lots came to mind about the possability of an actual game using google api or even an app like pokemon go. Or even a short 3d movie. This has opened my mind about possibilities of using the blockchain in a different way. Could this be used to do all kind of collectible markets on the block-chain? Now I'm thinking about business documents and things like that.

Anyhow, thanks. This is enlightening. I would be interested in you going into this further.

@omitaylor I'm not sure I understand your first question - an NFT is a token, so it doesn't really make sense to Tokenize it. For your second question - yes any type of collectibles could use the same method we are using to interface with the Steem blockchain. Many projects like this are already being run on Ethereum already which allows true decentralization on the blockchain for NFTs.

Loading...

When we can expect that game will start?
P.S I have bought 150 packs today, can't wait to play :-)

Awesome! Hope you got some good cards! We're doing everything we can to get the game play started as soon as possible, including looking for some development help. I don't want to promise anything right now but I can assure you we will keep everyone posted when we have updates!

Thanks mate :-) I've got 5 legendary cards. Similar legendary rate if you compare to Hearthstones :-)

My programming skills are limited, but I'm not too bad at developing game play or writing a story. I run a small RPG comp on Steemit and people like it. If you need an Alpha tester or an idea's guy I maybe I'm able to help in some way. Work and Uni are simultaneously eating allot of my time, but I love Steem and will do what I can, if its useful.

Else, keep up the good work, looking forward to seeing where this goes. Cheers

Coin Marketplace

STEEM 0.24
TRX 0.11
JST 0.031
BTC 61875.79
ETH 3013.13
USDT 1.00
SBD 3.69