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:  
There are 2 pages
Pages

If I buy a monster pack, is the transaction id used as a component in the random distribution of the pack I receive?

This is an awesome question! This is something I have thought about and would REALLY like to do, but I'm not sure how to implement it in a way that provides an even distribution. What I need is a way to take the transaction ID and generate N integers from it between 0 and X such that each integer has a roughly equal probability of being generated.

If you (or anyone else reading this) are able to provide that algorithm I will definitely get it implemented right away!

You could use the transaction ID as the seed to your random number generator of choice and then generate those N numbers from that generator in a consistent fashion (like the first N calls to the random number generator).

Yes I think this is what I will do. I found a JS random number generator that can be seeded (since Math.random() cannot) here: https://www.npmjs.com/package/seedrandom

Thank you!

Yeah, Javascript's build in random number generator is pretty primitive. The package you found looks like it will do the trick just fine. You just reminded me I keep wanting to play around more with Node.js...just need to make some time.

The transaction hash is already strong random number. Let's take eg. first 3 digits to get an ID of draw card.

It would probably be less important if there is a set number of monsters like it is at the moment. But if you ever go in the direction of procedurally generated monsters, I would find it very compelling if the procedure was posted publically and the generation routine was cryptographically verifiable from the data in the blockchain.

I agree 100%! I will work on updating what we have so it is cryptographically verifiable and then publish the details. Probably a good topic for my next "tech talk" post. Thank you!

How are trxids generated? I feel like I should know this already, and I'm almost embarrassed to ask.

Anyway, care must be taken to ensure that good cards can't be mined. If you use blockchain data to seed your RNG, you probably still need to add randomness on your end before generating cards.

Love the project, by the way! My starter pack contained no legendaries, so no worries there. ;)

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

Hi @yabapmatt. Congratulations, it is a wonderful work! But, the following part was not clear to me:

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.

This means that I really do not own the cards as such, but I need your authorization to be able to exchange them with other users. In the end, is the information decentralized in the steem blockchain but the property remains centralized?

Can I transfer ownership of my cards to someone else from my account?

I'm just curious about it.

Regards...

@rach I mentioned in the post that it's not possible to build a fully-decentralized solution on the Steem blockchain like you can on Ethereum or some others. So it is still centralized, however everything that happens is published and verifiable on the blockchain. To transfer ownership of cards you do publish that transaction from your own account, but for now you need to do that through the steemmonsters.com website in order for the change to be reflected on the site. Hope that makes sense!

Thak you for your reply @yabapmatt.
For now I will do more research on your project which I really love. I want to try to make some applications for steemmonsters and I was interested in understanding the dynamics of the exchange of cards between users, to see if it was possible to use the scrow in these cases. But this is going to take a lot of time because our programming skills are quite limited.
By the way, for your information, luckily I own steemmonster.net.

I can say with 100% certainty, my wife will spend a great deal of time ignoring me now in an effort to play this game as much as she possibly can.

Thanks @yabapmatt :|

hahaha

Looks really really cool, but I'm very hesitant to enter my private key on any website.. is it safe??

@skycornish it's good that you are being careful about how you use your private key. It's important to consider who has built and is running a site to decide if they are trustworthy. I hope that by this point I have built up enough trust in the community so you can be comfortable using your private key with sites and services I have built, but in addition to myself this is also run by @aggroed who should certainly have that level of trust. Please feel free to reach out to me directly if you have any questions or concerns or want to discuss it further.

Are you a genius or can a lot of coders do this type of coding? I've kind of been hearing that you are a genius.
So you can run SMT like apps on other website and still use the Steem Blockchain to record transactions?
Do we really need SMT's?
I thought it was cool how https://steemhunt.com/ integrates some Steem functions into their website.

Lol I am certainly not a genius. This stuff is rather simple from a development perspective. The developers who work on the core Steem blockchain are the real geniuses here and I don't think they get the recognition they deserve. SMTs will be very different than what we are doing with Steem Monsters and will allow a lot more than just recording things on the blockchain.

Just real innovative? From what I have been hearing and have seen it seems like you're our best developer.
So you couldn't have programmed the Steem blockchain by yourself? lol
Were Dan and Ned our main developers?

Dude Steem Monsters is absolutely smashing it right now!

It's all over my newsfeed, everyone is talking about it! Hopefully it will help attract some more people to Steemit to accelerate the platform's growth, great work with the project so far!

Man, I just bought my monsters lately before reading this. Well, It's getting me feel excited about the battle. So, I can't wait but, of course, to WAIT for that BATTLE! :D

@yabapmatt

Can you please check your bot? Something is wrong today, we lost a lot of money.

Transfer 15.000 STEEM to postpromoter
https://steemit.com/win/@resteem.bot/win-with-resteem-bot-04-06-2018
(5.64 SBD, 0.25 STEEM, 2.65 SP)

Transfer 16.456 STEEM to postpromoter
https://steemit.com/win/@resteem.bot/win-with-resteem-bot-05-06-2018
(6.26 SBD, 0.27 STEEM, 2.94 SP)

And in this payout are a lot upvotes from other user.
Can you please check all your upvotes from you to us?
We can not lose money from our community.

Thank you.

@resteem.bot

@yabapmatt

This are ca. -50%, even with the upvotes from the other users.

@resteem.bot

@yabapmatt

I don't know your system, but I think this vote was in this round:
3 hours ago Transfer 100.000 SBD to postpromoter https://steemit.com/steemmonsters/@steemmonsters/welcome-clove71-to-the-team

And with the new 50 SBD/STEEM limit it must be made manual?

Is this the error?

@resteem.bot

This was due to SBD prices being messed up on coinmarketcap. The issue is fixed and you have been sent a refund. Please accept my sincere apologies for the issue!

@yabapmatt

Yes I have seen this.

$7,34 USD (319,37%)
0,00095765 BTC (316,98%)

I is because you can not deposit SBD on HitBTC, it is a phantasie price.
2 HitBTCHitBTC SBD/BTC $179.576 $25,05 23,99% Recently

Thank you.

@resteem.bot

The game will be amazing

In my opinion this game will be the reference for future ways on STEEM. Congratulations!

Is there any randomness built into the game? If so, how is that done?

Currently, yes, for determining what cards will be in each pack. Just using the basic JS Math.random(). But based on the comment thread started by @inertia on this post I am going to change that to be seeded based on the transaction ID so it will be verifiable going forward.

Peeps, make sure to drop in the unofficial discord called Team Steem Monsters - we are building out the Team Guilds.

Thanks for this Educating write-up sir. More Inspirations

good manners sir @yabapmatt ..., his explanation is very aspirative, accommodative and implementative sir.i have resteem your post sir @yabapmatt . thanks you

#Steemmonsters it will be mostly played by the steemian all over the world.
I recommend
need to be explained again in post steemmonsters detail about this play.
Thanks to @yabapmatt
Nice to meet you

Everyone is getting pretty excited about it and building their collections. You don't want to miss out on this, trust me.

I would be totally lying if I said that I truly and deeply understand most of that technical stuff. But I can honestly say that I am totally in love with the project already and that I fully trust you guys to make something great out of it - especially now that you have seen how desperately the community wants you to do that with Steem Monsters! Good luck guys! :)

sir how to steemd the witness, let me know sir @yabapmatt.

I think you guys should buy the rights to use this platform....

elementsthegame.com

As far as I know the developer has abandoned that game and while there are still some players I believe it can easily be altered.

Just a thought because elements was my favorite card game for probably about 2 years.

I'm glad you guys are thinking about the implementation of the gaming platform itself because I think that will be the most difficult part to get right.

I´m not an expert on this subject, so I'm afraid I´m not a big help, but I'm definitely an enthusiast that is supporting this game at 100%, and this I know I´m good at!
So, all I have to say is, Thank You, for investing your time on what we love!!

I would love to get a legendary every pack, but it would disrupt the point and mystic behind those type of cards...

Thank you for the technical details! It would be a great reference for those of us who are working on future steem blockchain projects!

I really enjoyed reading this post. It didn't felt long at all, and I was excited to read every line.I I am new to steem and I already bought myself a pack of steem monsters. I wish the project a hugh success :) and thank you very much for being so trasparent and informative!

Very interesting topic, I don't understand all of it because I haven't studied enough, but I think that this is a great breakthrough. Looking forward for the next updates and the tournaments. I hope you get enough free time to finish soon!

Loving what you guys are doing here! Get what you gotta do done right and TRY not to feel rushed 😋 I know great things are in the future 👐👐 Throwing the witness a vote as well 😎

You got a 22.00% upvote from @postpromoter courtesy of @postpromoter!

Want to promote your posts too? Check out the Steem Bot Tracker website for more info. If you would like to support the development of @postpromoter and the bot tracker please vote for @yabapmatt for witness!

Killer explanation, and thank you for the transparency. I believe this to be the first game that has a following to utilize steem blockchain in such an innovative way to ledger game records. I'm really excited to see this happen.

I would like to translate your publication into Spanish, so that Spanish speakers know about this great project. Please. You give me your permission?

@yordin Yes by all means, go ahead!

Thank you very much friend @yabapmatt. A hug from Venezuela. Regards!

great info @yabapmatt...thank you for your great explanation......go steemmonster...

This is such a inavative project I'm glad to be apart of it, also If I had a card idea what would it take to add it to the game?

Wow, this is getting interesting more and more, I just want to be one of the first to know about battles when they start (not necessarily THE tournament.)

Great work @yabapmatt

This game will be one of its kind. Please, I have a question.

Will it be possible to watch the tournament as it is going on? Or, am I expected to buy the card and expect a positive outcome?

What would happen if I bought a monster package as the transaction would be?

I just heard of this today what a cool idea and I bought a few packs ;)

tip!

Hi @yabapmatt! You have received 0.1 SBD tip from @tattoodjay!

@tattoodjay wrote lately about: Market Friday - Downtown Milford Shops Feel free to follow @tattoodjay if you like it :)

Earn daily income on steem: @tipU distributes 100% profit + 60% curation rewards to all investors.

Cool. I bought the pack :) Can't wait.... haha

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...

I have to agree with @mysearchisover, you are a genius @yabapmatt
I was wondering, what happens if my keys get compromised and I need to change my keys - how do you deal with that ? On Bitcoin and ethereum, if one loses the private key the ownership if whatever that key was associated with is lost, but steem has worked hard to prevent that hard link.

@sorin.cristescu If you lose your master password for your Steem account that can never be recovered. If you lose your private keys those can be generated from your master password. If your keys get stolen you can change them using your master password. If your master pass or owner key gets stolen you can recover your account using Steem's built-in account recovery mechanism.

Thanks @yabapmatt - my question was related to the steemmonsters: if I change my posting key, what happens to my steem monsters? I understood that the association is between a card and my posting key, is that correct ? So if I change my posting key, does the game (your database) know to change the association from my old posting key to my new posting key ?

Also, unrelated, is there a post where the principles of the "built-in account recovery mechanism" are explained ? I would like to understand how it works.

TIA

Oh, sorry I misunderstood! Your steem monsters cards are in no way tied to your posting key. We never get or store your private keys in any way. They are associated only with your steem account name so as long as you log in with whatever is the currently valid posting key on your account all of your cards will still be there!

As for the account recovery mechanism, I don't have a link off hand, but I would just try googling it and I bet you can find some good info. Might also be some good info in the whitepaper.

Please how do I get started with this

There are 2 pages
Pages