The Emoon 0x Topology – Emoon
When Emoon first adopted 0x, the reason was to replace our native smart contracts with the 0x smart contracts. Our migration was a success and the use of 0x’s audited, trusted, industry standard smart contracts has been a huge benefit for Emoon.
Since that time, the 0x team has provided a host of open source software projects above and beyond its smart contracts, including 0x Instant, 0x Launch Kit and 0x Mesh. Emoon has embraced these projects and stitched them together with our own software to create an end-to-end solution for peer-to-peer trading of crypto assets.
In the following post, we will outline the entire Emoon topology and how it uses various 0x open source software. We will enumerate where we built custom code vs. where we were able to leverage projects created by 0x. This guide is meant to demonstrate the architecture for how an entire solution can be built in conjunction with 0x projects, so as to create a peer-to-peer marketplace for crypto assets that provides the best prices for buyers and optimum exposure for sellers.
The Emoon Website User Experience and Emoon API
For users, the entry into the Emoon solution is the website itself, a responsive single page application (SPA) that runs entirely in the browser. The website provides several key custom built experiences for users including:
- Creating a valid signed order
- Searching and browsing different asset classes to discover items for sale
- Viewing token balances and NFTs for any Ethereum address
- Creating and bidding on auctions
- Creating bundles of items
These experiences are facilitated by calling the Emoon API, a REST-based service with both read and write APIs. The read APIs can be called anonymously; the write APIs are authenticated by having users pass a valid signature with every call. Signatures, used for both authenticating with our API and for creating 0x signed orders, are facilitated by using web3 libraries. Additionally, web3 libraries are used to call out to the Ethereum blockchain via Infura to get the latest state information.
0x Instant, Emoon’s Standard Relayer API and Other SRAs
For the checkout experience on the Emoon marketplace, Emoon uses the 0x Instant widget. This widget optimizes the buying experience in several ways.
- First, it allows buyers to pay in ETH and not have to convert their ETH to WETH in order to fill an order. (Note that sellers get paid in WETH.)
- Second, it ensures that the buyer gets the best price for buying ERC20 tokens. Buyers never have to pick a specific order from the order book.
- Additionally, the widget facilitates buying ERC721 assets with a very clean user experience.
For the 0x Instant widget to work, it has to connect to a valid 0x standard relayer API (SRA). Emoon provides its own SRA endpoint for the tokens and assets it supports on the marketplace. In some cases, a deeper liquidity pool exists from a different SRA. In those cases, the Emoon website wires up 0x Instant to to an external SRA endpoint, such as Radar Relay or Fabrx. This is a great example of how a single UI can tap into networked liquidity.
To build the Emoon SRA, we forked the 0x Launch Kit. It provided boilerplate code and helped insure that our endpoints were compliant to the SRA specification. For more on connecting to the Emoon SRA endpoint, see https://www.emoon.com/developers.
The Emoon Database
Both the Emoon API and the Emoon SRA use a common database for storing signed orders. The database contains additional metadata above and beyond just the 0x signed order structure. When the Emoon API is called for a given order, it returns these additional fields, including things like metadata for the NFT, price pre-calculated, amount decimals rationalized, etc. When the Emoon SRA is called, only the signed order is obtained.
This practice of having two APIs that call into a single database for signed orders is common among relayers. It can be seen in the Radar Relay API: https://developers.radarrelay.com/. The reason for this practice among relayers is that the nature of a signed order is to be compact, thus requiring additional metadata for the purpose of a marketplace.
Emoon and 0x Mesh
Emoon recently announced integration with 0x Mesh, both pulling orders from the mesh and submitting orders to the mesh. This integration provides benefits to both buyers and sellers. For buyers, it means that more orders are available for browsing, adding liquidity for a given trading pair. For sellers, it means that orders submitted through the Emoon website are distributed to the mesh, ultimately exposing the order to more buyers.
Whenever an order is submitted to Emoon, the Emoon API pushes it to both its own database as well as to our own mesh node running in the cloud. Additionally, a daemon runs as part of the Emoon API that subscribes to our mesh node. When an order is received from mesh that we are interested in, it gets pushed into our database through our API, adding appropriate metadata so that it can be properly surfaced in our UI as well as in our SRA. The Emoon integration with 0x mesh was facilitated by the 0x Mesh SDK: https://0x-org.gitbook.io/mesh/json-rpc-clients/typescript.
Conclusion
We are believers in the 0x vision of a tokenized world where buyers and sellers are able to trade crypto assets peer-to-peer, using the Ethereum blockchain as the settlement layer for brokering the swapping of assets. The role of marketplaces such as Emoon are key to this vision, helping bring buyers and sellers together. To achieve this, Emoon has built a complete solution combining custom software with open source projects provided by the 0x team.
Published at Mon, 09 Sep 2019 16:26:56 +0000
Bitcoin Pic Of The Moment
✅ This image from Marco Verch (trendingtopics) is available under Creative Commons 2.0. Please link to the original photo and the license. 📝 License for use outside of the Creative Commons is available by request.
By trendingtopics on 2019-03-21 10:03:25
