Trustless, Noncustodial Exchange Prototype


Trustless Exchange


  • Mediator Smart Contract
    - Accepts and stores the roots of the Merkle tree built from a snapshot of the balances. This is referred to as a “commit”.
    - Mediates disputes between clients and the operator.
  • Operator
    - A service run by the exchange or payment provider.
    - Manages the balances of users or orders according to certain rules (that
    need to be verifiable by the mediator smart contract).
  • Clients
    - Interact with the operator in good times.
    - Interact with the Mediator to verify information and lodge disputes if

Merkle Trees

Protocol Outline

  • Operation
    - Clients deposit assets into the mediator.
    - The operator manages the balances of the clients according to rules of the application (payments, trading, …).
    - Clients withdraw assets from the mediator when desired.
  • Security of funds
    - Every round the operator commits a root of the Merkle tree, freezing the initial balances for the round.
    - Clients query the operator for their Merkle proof and use that to verify their balance in the mediator.
    - If a balance is incorrect, the client opens a dispute via the mediator.
    * If the operator was honest, they can close the dispute.
    * If the operator cheated, they’re unable to close the dispute. The system
    comes to a halt and the balances are rolled back to the last known good
    state. Users can then withdraw their assets to their wallets.


  • Funds should not be moved unless an order signed by the client authorizes it.
  • If clients go offline their orders remain live.

Integration with existing exchanges

  • Deploying the mediator smart contract.
  • Creating the necessary objects and signatures to communicate with the smart contracts.
  • Running the operator service.
  • Exposing a few API endpoints (such as current balance) to the operator service.




  1. Miller, Andrew, et al. “Sprites: Payment channels that go faster than lightning.” arXiv preprint arXiv:1702.05812 (2017).
  2. Khalil, Rami, and Arthur Gervais. Nocust–a non-custodial 2 nd-layer financial intermediary. Cryptology ePrint Archive, Report 2018/642., 2018.
  3. McCorry, Patrick, et al. “Pisa: Arbitration Outsourcing for State Channels.” IACR Cryptology ePrint Archive 2018 (2018): 582.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


OAX is a new, decentralized, digital asset ecosystem initiative run by the “The OAX Foundation Limited”. Go to to learn more.