Steem Monsters Tech Talk - Part 4 - The Monster Market DEX Protocol

in #steemmonsters6 years ago

The Monster Market DEX Protocol

Earlier today we released the Monster Market feature on the steemmonsters.com website. The Monster Market let's players list their cards for sale and easily browse and filter the cards listed for sale and purchase them. While this is a nice addition to the site, what I am much more excited about is the decentralized and trustless way in which it works, which I am calling the Monster Market DEX Protocol!

Using the Monster Market DEX Protocol, anyone can buy and sell cards, or even build their own market for buying and selling cards without going through us or using the Steem Monsters website at all! As long as any cards listed for sale or purchased are published to the blockchain in the manner specified by the protocol, steemmonsters.com and any other sites showing Steem Monsters information, can pick it up.

Third party sites can even charge their own fee for sales made through their market as a way to receive compensation for the service they are providing!

Getting Into the Weeds

Now that you know what it is, let's really dig into the technical details of how the Monster Market DEX Protocol works!

Offering Cards for Sale

In order to initiate a sale, an "sm_sell_cards" custom_json transaction must be published to the Steem blockchain by the account that owns the cards being sold. The JSON message should contain the following properties:

{
  "cards":["C-AG154DK52D",...],
  "currency":"USD",
  "price": 1.23,
  "fee_pct": 200
}
  • The "cards" property lists all of the cards being sold in this package. You may notice that currently the Monster Market on steemmonsters.com only allows selling one card at a time, but the protocol allows for many cards to be sold together.
  • The "currency" property denotes the currency in which this package of cards will be priced. Currently steemmonsters.com only supports USD, however the protocol allows for USD, STEEM, and SBD.
  • The "price" property denotes the price (in the specified currency) for which the specified cards are being offered for sale.
  • The "fee_pct" property denotes the fee that is being offered to the market through which the sale is made. The value of 200 shown in this example represents a 2% fee. More on this later.

Once the "sm_sell_cards" custom_json transaction is published, it will be referenced in the future using the transaction ID of the operation on the blockchain.

If any card listed in the "cards" property is not owned by the account that signed the transaction, or if any card is already actively listed for sale, then the transaction is considered invalid and will be ignored (though it will still get published to the blockchain). Similarly, if any of the other properties are not valid values then the transaction will be ignored as well.

Cancelling a Sale

An account that has previously listed cards for sale, can cancel that sale at any time (assuming the cards have not already been purchased) by publishing an "sm_cancel_sell" transaction.

The JSON message for an "sm_cancel_sell" transaction need only contain the ID of the "sm_sell_cards" transaction that the user wishes to cancel.

{"trx_id":"bf49557b09105f89dd056857b1f6f8b735b4c9f9"}

Making A Purchase

To purchase a card, or set of cards, offered for sale, one only needs to transfer the required amount of STEEM or SBD to the seller's account with the following memo:

sm_market_sale:bf49557b09105f89dd056857b1f6f8b735b4c9f9

Where "bf49557b09105f89dd056857b1f6f8b735b4c9f9" is the ID of the "sm_sell_cards" transaction being purchased. The amount that must be transfered needs to cover the "price" specified in the sell transaction minus the "fee_pct". So for example, if I sell a card for 1 STEEM and a 5% fee ("fee_pct" = 500) then I would need to transfer at least 0.95 STEEM in order for the purchase to be valid.

If a valid purchase transaction is made, then the cards listed for sale will be automatically transfered to the account that sent the purchase transaction. If the transaction is made through a market, such as the one on steemmonsters.com, then the full payment is sent to @steemmonsters, and then @steemmonsters will transfer the payment amount minus the market fee to the seller.

In this case, @steemmonsters will add the buyer's account name to the end of the purchase transaction memo:

sm_market_sale:bf49557b09105f89dd056857b1f6f8b735b4c9f9:yabapmatt

This way the cards will be transfered to the buyer (@yabapmatt in the above example) instead of to @steemmonsters. This is how markets are able to keep the fee portion of sales made through their site.

Fees

Speaking of fees, I thought it would be good to discuss how they work in a little more detail.

As you saw above, the fee percentage is set as part of the transaction that offers the card(s) for sale. This means that the seller has the ability to set the fee to whatever they wish. Knowing that, you may be asking why sellers wouldn't just set the fee to 0?

The reason is because each market can choose which sales to display and which not to display on their site. So it's very much like Bitcoin transaction fees. You can se the fee to 0, but your transaction may never get included in a block. Similarly, you can set your Steem Monsters card sale fee to 0, but there may be no markets willing to list it for you.

Additionally, the vast majority of sellers will not be posting the "sm_sell_cards" transaction manually, but will be using the UI provided by a market to do it. So in that case the market can automatically set the fee at the rate it chooses to charge. If sellers feel the rate is too high, then they can choose to use a competing market instead.

Third Party Markets!

Since all transactions are posted publicly on the Steem blockchain, cards listed for sale through one site can show up on any other site that has a market, just like how posts on steemit.com show up on busy.org or any other website that shows content on the Steem blockchain. Only the site that the buyer uses will get the market fee for the sale, however.

The Monster Market currently on the Steem Monsters website is a nice start, but it isn't really so great. It only lets you sell or buy a single card at a time, for example, which is already proving to be a pain for some people.

I could work on making it better and adding more features, but I would very much prefer to focus on building the fighting and tournaments (which are coming along nicely by the way!). So by making this an open and decentralized protocol, it opens the door for other talented developers in the Steem community to make something better.

If anyone is game for doing that (looking at you @blervin!), please reach out to me if you need any help or support. Based on the volume we've been seeing so far from day one, I expect that a well made market that provides an easy interface for all different types of card sales can do pretty well off of the fees!

A Note on Gifting & Combining

For anyone who may already have built, or is working on a third party site that will allow gifting and combining of cards, please note that now that the market has been introduced - gifting or combining cards that are actively listed for sale will be considered an invalid transaction.

If you are using the Steem Monsters API to get each account's card collection, you will notice that each card record of the /cards/collection endpoint now includes a "market_id" property so you can tell whether or not it is currently listed for sale.

Thank You For Your Support!

To everyone who has supported me, I want to sincerely thank you. That really gives me the motivation to keep doing this day in and day out and to know that I'm making the right decision devoting so much of my time and energy to the Steem platform.

I know that this post, as with most of my posts, was very long and technical, so for those of you who aren't techies but still made it all the way here - thank you! For those of you who are technical, I would really appreciate and am looking forward to hearing your thoughts and ideas on the Monster Market DEX Protocol in the comments!


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

Sort:  

I'm so very excited to see innovation like this happening on Steem. Thank you! I'm tempted to write up some code to dig into the sales history so far and create some reports. I'm really curious and want to see how this price discovery happens over time. :)

That would be very cool. I look forward to seeing some realtime charts soon. 👍 The third-party app environment setting up around #SteemMonsters is great, and this marketplace innovation is only going to increase it even more. No doubt @reseller and @themonstertrader will have their own marketplaces built soon, using this codebase.

I just stumbled upon this: http://steemmonstersdb.com/steemmonsters

Really cool :)

I also did my own report last night and then updated it again today. It's fun to write some code to play around a bit.

If you haven't already, go give this monstersdb post an upvote. Very cool stuff.

@disregardfiat and I are having so much fun making what will be a sandbox for 3d VR steem games
https://lamboland.glitch.me

https://dlux.io

I'm keeping an eye on it. Definitely ping me when you get something working so I can do a walkthrough of it.

Matt, I have used the site and it is awesome. I know there will be many that will add onto what you've done and make it an even deeper market. The fact that you priced in USDs is also a great thing as people will now be able to transact based on the same metrics as the packs (without always doing the conversions). This is going to definitely add value to the Steem Monsters game, so once again awesome job!!!

Yep this was very very needed!

@jarvie ... I hear that @blervin is getting close to his extension.. that might be cool too ;)

Soon with https://dlux.io we will have a reason for people to join and develop for steem

We will eventually have a whole menu of games you can play with using steem, and it will be FUN to be on steem.

@ackza very cool... I hope this works, it will be great!

This is awesome stuff and I'll definitely be diving into the code to completely rebuilt my market. I've got a lot of stuff I've been working on but was waiting to see this real market first so I'm excited it's here.

I love it! You did an amazing job! I was streaming live when I was trying to get in my collection and it wouldn't work, I said hmm....give it a few minutes they must be working on it upgrading,etc. It's great! So easy to use! Thank you so much! p.s. This is @clove71 I wa sin the middle of making a BattleTeam post for Steemit about The Monster Market!!!

Spirit of the Forest_gold (600px, 25fps).gif

It's pretty slick! I bought a few cards and listed a couple!

I wish that while viewing a card within my collection I could click buy, so that I could compare values and also fill missing cards without having to remember which card I was looking for.

Great job on this.

Wow! keep up the great work @yabapmatt ! These are very exciting times for the steem blockchain so much going on right now! Always been voting you and @aggroed as witness ! I just joined your awesome Steem Monsters by buying my starter Card pack two days ago I was so excited I did a post about it, and have since bought 2 more booster packs, and am saving up for more hoping for my first Epic or legend card! Its all ready addicting and I know this game is going to be EPIC ! upped and resteemed!💕👍✌

Thanks @karenmckersie - glad you like it, and really appreciate the witness vote!

Your very welcome @yabapmatt ! I have always voted for you guys as witness , I love all the stuff you do for the platform, keep up the great work! Steem Monsters is going to be so EPIC! I gave you guys an awesome mention in my first Steem Monsters Promotional post I did a couple of days ago when I Bought my first starter pack and 1 booster pack. All ready addicted and wanting more Lol! 👺👹👾💀👍😂

I really like what you are doing with the protocol and the openness of the ecosystem. Seems like a very good thing. Are there any API docs for the endpoints?

Thanks! I don't have any docs yet (struggling just to keep up with the development right now!) but if you want to PM me on the Steem Monsters Discord I would be happy to help you with any API integrations.

I never got around to using Steembay to do any sales, but this new market system makes it so much more simpler and effective. I am glad it is a trustless, decentralised method where I can and already have, easily list cards I do not want or want to get.

Can't wait for tournaments!

Upvoted! Keep up the great work!

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!