Trading with On Chain Remarks

By Luuu, Co-Founder of Evrloot

Bruno and his crew created something beautiful with RMRK.

Leveraging their technology we can build on top of their baby and use it for more use cases. Creating a RPG styled blockchain game, one use case comes to mind instantly. Trading. While Singular is a great marketplace to sell and buy items, trading is not something you can do.

Thats where we come in. We can use the variable structure of Remarks to build our own set of Remarks. For those that dont know what I am talking about: Remark built a consolidator which gets fed Remarks. Depending on past Remarks, the consolidator interprets new ones and changes the state of NFTs, Collections and Bases. So Remarks are only comments on the Kusama Chain and to correctly interpret them you need to know the complete past of Remarks.

So how can we use this Tech to our advantage?

By defining a few custom Remarks, we can create a ungameable On Chain trading mechanism.

Opening a Trade

The following RMRK opens a Trade.


EVRLOOT::TRADE::2.0.0::{NFTID1},{NFTID2},{NFTID3}...

To create a valid Trade the NFTs specified in the RMRK need to be sent to our escrow wallet within the same block the TRADE RMRK has been sent. On top of that a fee in KSM is expected. This fee has to come in the form of a balance transfer in the same block as the TRADE RMRK and SEND RMRKs. This one time fee covers the transaction costs of the escrow wallet and pays for the service. The Fee is dynamic and depends on if you are trading a equippable soul item or resources like water and wood. The fees do have a hard cap though.

The Trade is now live and bids can be placed.

Closing a trade

The Trade issuer can cancel the trade at anytime once it went live by creating a RMRK in the following format.


EVRLOOT::TRADECLOSE::2.0.0::{TRADEID}

Good to know: This action sends the Trade issuer and every bidder their NFTs back.

The Trade Id is created in the following format:

{block number}-trade-{ksm address of issuer}

A valid example for this would be:

13970443-trade-EX66JgYrd35sXkofDyajWZVGngSBjVT6hUaZYbQd7C29HZa

Important: This also implies that each ksm address can only create one valid Trade per Block

Bidding on a trade

Once a Trade went live, anybody can bid on it and hope their bid gets accepted. A bid is created similarly to a Trade with the difference that you need to specify which Trade you are bidding on:


EVRLOOT::BID::2.0.0::{TRADEID}::{NFTID1},{NFTID2},{NFTID3}...

When the same block includes the valid SEND RMRKs of the specified NFTIds to our escrow wallet, a valid bid is created.

Revoking a bid

Maybe an item you bid on some time ago doesnt seem as attractive anymore or you simply want to use your items again to play. Thats when you can revoke a bid.


EVRLOOT::BIDCLOSE::2.0.0::{BIDID}

This will disable your bid instantly and send you back your items. Bid Ids are created in a similar manner to Trade Ids.

{block number}-bid-{ksm address of issuer}

A valid example for this would be:

13970443-bid-EX66JgYrd35sXkofDyajWZVGngSBjVT6hUaZYbQd7C29HZa

Important: Again, this implies that only one bid per trade can be created. Creating multiple bids from the same ksm address within the same block, will get ignored

Accepting a trade

Finally we have the possibility to accept a trade. When the trade issuer is happy with a provided bid and wants to trade his items with the ones from a bid, he can. With the command


EVRLOOT::TRADEACCEPT::2.0.0::{TRADEID}::{BIDID}

The issuer is able to trigger the escrow wallet. The trade gets instantly closed and the trade issuer gets the items of the winning bid, the winning bidder gets the items of the trade and every bidder who didnt win, gets his/her items back.

Security measures have been taken to make this process as secure as possible: Accepting multiple Bids within the same block wont work, closing a trade and accepting a bid within the same block wont work etc.

Conclusion

Using the RMRK Tech we created an on chain trading mechanism. Everybody who reads the Kusama chain for rmrks and interprets them the same way as we do, will get the same result. Although it is automated it is obviously still centralized, since the code for this is running on our server. Smart contracts will fix this, but we sadly arent there yet.

Possible enhancements

  • push a commit to integrate our custom remarks into the consolidator. Thus everybody using the rmrk tech will be able to get the same state of trades and bids.
  • allow items outside of evrloot to be traded (?!)

Discord: https://discord.gg/4WpMHHu62q

Twitter: https://twitter.com/EVRL00T

https://linktr.ee/evrl00t

Evrloot
Post author

https://evrloot.com/

https://discord.gg/4WpMHHu62q

https://www.twitter.com/EVRL00T

Dive into dense, dark lore. Get your character. Find epic loot on missions and discover the secrets of Estra.

0 comments