Nash, a decentralized financial services platform registered in Liechtenstein, has published details of the off-chain matching engine that is at the core of its upcoming currency exchange. Matching engines are used in electronic exchanges to complete trades by pairing bids and offers from the traders.
The Nash team has attempted to design a matching engine that delivers the best aspects of existing centralized exchanges (high performance and cross-chain trading) and decentralized exchanges (trustlessness and user custody of funds).
Multi-Chain State Channels
The Nash matching engine uses off-chain state channels to execute trades and update user balances without having to wait for the host blockchain to publish a new block. Final settlement to the blockchains will occur after trading is complete. The Nash exchange will feature state channels that span across its supported blockchains (multi-chain state channels) to allow for responsive cross-chain trading (for example, NEO/ETH).
Unlike a centralized trading system, however, users will need to individually authorize their proposed trades by signing them (ownership of the account’s private key is required). This mechanism, “elliptic curve cryptography,” is the fundamental cryptography of cryptocurrency, and prevents Nash from moving user assets in the exchange’s smart contract without the user’s consent. Similarly, users may withdraw their assets from the contract at any time without the exchange’s approval.
Determinism and Distribution
Nash describes two other computing concepts that are key to the design of its matching engine. Firstly, the Nash engine is designed to be “deterministic,” meaning that a set of inputs to its matching engine will always generate the same trading activity outputs, on any computing hardware, anywhere in the world. Because Nash claims that its engine is fully deterministic and “provably fair,” there will be only one “correct answer,” a fair set of outputs (matched orders), for a given set of inputs (trading activity).
Because a deterministic computer gives reproducible, predictable outputs, it is suitable for deployment in a distributed system (multiple instances of the Nash matching engine will run simultaneously).
Nash plans to launch its deterministic matching engine as a distributed system, consisting of five nodes. As a security measure, four nodes will have to agree in order for their completed trades to be periodically settled on their host blockchains.
Finally, Nash notes that each of its over 30 trading markets will run “as an independent parallel process,” meaning computers will match trades in each of its markets at the same time. According to Nash, although computation in these individual markets is deterministic, a further step is needed to guarantee determinism for the entire exchange “since the order in which individual processes run isn’t fixed.”
Nash offers the solution of grouping trades into simultaneous batches known as “heartbeats,” bursts of matched trades and updated account balances that are separated by a pause. Nash claims that its heartbeats, which are part of an audit system “running dozens of times per second” allows the project to offer a “fully deterministic” matching engine.
Furthermore, when the heartbeat data is hashed and compared with the hashes from the same heartbeats of other nodes, the project can quickly verify that its distributed nodes are processing the trades in the intended manner, and generating the same outputs.
The full description of Nash Exchange’s matching engine can be viewed at the following link: