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

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 :-)

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center