The Evolution of eosfinex
A look into the first high-performance on-chain exchange on EOS
Breaking down asset exchange to a transparent network, accessible to all, is one of the foundational goals at the heart of the blockchain movement.
In line with this, there exists a genuine desire within the community to explore financial innovation through the development of blockchain-based trading capabilities. We are proud to have contributed to this movement by developing eosfinex, a peer-to-peer trading platform upon which all major exchange functionality is on-chain.
As a platform, eosfinex is composed of the following components:
- Order books
- Order matching
- Custody and settlement
Although certainly the ‘Holy Grail’ of exchange development, implementing the above components on-chain has posed serious challenges — the main challenge being technical.
This post will share with you the hurdles we encountered in the creation of eosfinex and how, through innovative technological approaches, we were able to overcome them.
The promise of EOS
Technically there has simply not been a framework available with the necessary fee structure and performance requirements for a fully on-chain exchange until EOS.
Through the use of Delegated Proof-of-Stake (DPoS), networks adopting the EOS software address the fee structure and scalability problems seen on other blockchain networks. By instead staking for network resources, EOS allows for the removal of network transaction fees. Additionally, allowing block producers to spend more computing power on processing transactions (relative to e.g. Proof-of-Work), has enabled the network to run with reduced block-spacing and significantly higher throughput.
These innovations make EOS an ideal blockchain for bringing all major exchange components on-chain.
The eosfinex Architecture
Eosfinex is the industry’s first fully on-chain, fully transparent and scalable exchange ecosystem built on EOS software.
In order to achieve acceptable irreversibility times and exchange responsiveness, the exchange contract will initially run on a sidechain using EOX as the system token, thus providing a natural way of allocating exchange resources based on the amount of EOX a user has acquired and staked. A user will also use EOX to buy RAM for placing resting eosfinex orders and for potentially loading a custom smart contract onto her sidechain account.
The project will grow along with the EOS software it is built on. As asynchronous confirmations (BFT-DPOS) are introduced that cut network irreversibility times to mere seconds, eosfinex can increase the number of sidechain BPs and even launch on the EOS mainchain.
Customers can interface with the exchange ecosystem by sending transactions directly to the EOS blockchain, or by using a custom eosfinex nodeos plugin that supports the familiar Bitfinex WebSockets API. The eosfinex plugin makes it easy for existing Bitfinex or Ethfinex users to point their trading systems at eosfinex from day one.
The eosfinex fee structure is designed to improve liquidity by rewarding all providers of liquidity with a simple and easy to calculate trading fee rebate. More eosfinex users means more EOS users, opening up the door for more dApp development and a myriad of truly exciting cross-contract applications.
Token transfers between the sidechain and main chain will be synchronized using two gateway contracts — one on each chain. A trusted external process will poll for token transfers into each gateway contract and then forward the transfers to the other chain. The API and UI will support popular signing mechanisms like Scatter and hardware wallets. In this way, both regular UI users and market makers can profit from state of the art authentication support, which further helps to ensure a healthy ecosystem.
A summary of the initial main eosfinex project components are:
- Exchange contract: Fully on-chain custody, order book, and matching engine.
- Main chain gateway contract: Custody for tokens whilst on sidechain.
- Side chain gateway contract: Issues and burns sidechain tokens.
- Sidechain network: Uses the EOX system token.
- Nodeos plugin: Supports connecting via Bitfinex V2 WebSocket protocol.
- User Interface: Bitfinex style UI with support for signing transactions.
- API client library: Polymorphic library to interact with the WebSocket gateway from the browser and server. Supports major EOS auth mechanisms like Scatter and hardware wallets.
In addition to this, future developments on eosfinex are set to include, amongst other things:
- Possible tweaking of EOS software timings for sidechain performance improvements.
- Increasing the number of sidechain BPs and/or launching on the EOS mainnet with the release of EOS support for asynchronous block confirmations (BFT-DPOS).
- Adding margin capabilities to eosfinex.
After a year filled with challenges and hard work, we’re proud to release the eosfinex beta to the EOS community in the coming week.
The beta will operate as a ‘Paper Trade’ environment, providing our users with the chance to experiment with eosfinex in a simulated ecosystem whilst earning rewards through providing platform feedback. A bug bounty outline will be presented in the coming days upon which users can structure their platform feedback.
We’re excited to see how the EOS community interacts with the beta and with their help, look forward to launching the fully-functioning version in the near future.