How IDEX works — One-off state hop with on-chain settlement

Alex Wearn
IDEX
Published in
3 min readOct 9, 2017

--

Blockchains have introduced an unparalleled level of security for digital asset transfers, but the inherent latency makes them unsuitable for high-performance exchanges. Proposed enhancements, such as state channels, will help address the issues of low transaction speed and throughput. Participants send cryptographically signed authorizations back and forth, updating the state of who owns what off-chain, and eventually settle the channel with one transaction that is written into the blockchain. This design allows for real-time transactions and higher throughput, however these improvements come with a loss of security as waiting to write the final state on-chain opens up the participants to attack vectors.

What if you could have both the speed of state channels and the security of blockchain settlement? IDEX provides this by carefully coordinating communication between two separate databases creating a process we call the state hop.

  1. The IDEX infrastructure handles the off-chain messaging and state updates. Users can trade instantly and indefinitely while behind the scenes their authorized transactions are prepared for dispatch to the Ethereum network.
  2. The Ethereum network processes the transactions as they are received, ensuring the state of the IDEX smart contract reflects all trades that occurred in the IDEX database

Depositing on IDEX opens a new channel hub. Each trade is equivalent to making one transaction and then immediately closing it. IDEX verifies the transaction’s authenticity and updates the off-chain state while the authorized transaction is prepared for dispatch to the Ethereum network for final judgement and processing by the IDEX contract. Traders can make as many trades as they want off-chain but cannot close the channel hub (withdraw their funds) until the Ethereum state is finalized (all pending trades have mined). This design enables real-time trading while preserving all of the transparency and security of blockchain settlement.

The UX improvement is dramatic and gives traders the following benefits:

  1. Buy and sell continuously without waiting for previous trades to mine
  2. Fill many orders at once, allowing for true market orders
  3. Be protected from front-running thanks to trade ordering in the transaction queue
  4. Never waste gas on a matched order, eliminating the need to overpay on Ethereum network fees

The IDEX architecture scales indefinitely and continues to function even if the transaction volume temporarily exceeds the processing capabilities of the Ethereum network, allowing for the transaction queue to clear when network activity dies down. This architecture will add value even on a POS-sharded network where syncing communication between shards introduces additional latency. When ethereum scales, IDEX will bring the best part of state channels, the transaction speed, and the full security of writing all events into the public network.

IDEX is currently live on the mainnet with support for over 200 tokens: start trading immediately! Stay tuned and join the discussion on Telegram, sign-up for our newsletter, visit us on Bitcointalk, or follow us on Twitter to learn more about Aurora IDEX and our IDEX market making rewards program.

Thanks to Phil Wearn and Ray Pulver for reviewing drafts of this post.

--

--