The heart of Nash: Our off-chain matching engine - Nash.io

The heart of Nash: Our off-chain matching engine

The heart of Nash

Our goal at Nash is to bring decentralization to everyone. Since blockchains are too slow to implement high-performance exchanges, users turn to centralized solutions for trading. If decentralized technology is to be truly widespread, we must overcome these bottlenecks. Genuinely decentralized systems have to compete in terms of performance.

This is exactly what our off-chain matching engine achieves. By matching trades off the blockchain, we bypass its speed restrictions. We can also match trades across multiple chains, like a centralized exchange. However, with Nash, users never give up control of their funds. What’s more, our matching engine is a provably fair, distributed system, adding extra security and requiring even less trust.

We’d like to give you a better idea of the main features of our matching engine. For a start, this is what it looks like:

The matching engine matching trades across multiple chains. Note the frequent “heartbeat” movements. These keep the matching engine deterministic and allow us to verify that distributed nodes are synchronized.

The Nash matching engine is essentially a multi-chain state channel manager. A state channel is a kind of account that is opened off a blockchain, allowing users to update balances that are only written to the chain at a later date. This is faster than recording every transaction to the blockchain and is essential to scaling solutions such as Ethereum’s Raiden Network. Cryptography ensures that requests to change balances in the channel are valid.

Nash takes this concept further, handling state channels across multiple chains. Users who wish to trade first transfer funds from their personal wallets to our trading smart contracts, which are capable of interacting with the matching engine. When a user places an order on the exchange, they sign that order using elliptic-curve cryptography (ECC). This gives the matching engine permission to update their smart contract balances appropriately. It is impossible for the matching engine to adjust a user’s balance on the blockchain unless they have agreed to the change.

As a system independent of the blockchain, the matching engine is capable of rapidly executing the algorithms required to match trades fairly. It does not have to write every trade or balance update to the blockchain. Instead, it writes balance updates periodically. These represent the state of users’ funds after what could have been a large number of smaller transactions.

During this time, user funds are never controlled by Nash. Users must sign off on the trades they send to the matching engine and are free to withdraw their funds from our trading smart contracts at any time, even if the matching engine and Nash web platform are not functional.

Nash doesn’t stop at taking trading off the blockchain. Our matching engine also provides a provably fair, distributed system. The matching engine is initially designed to support five nodes, with four nodes having to reach consensus for updates to be written to the blockchain. This will significantly increase the security of our system from attackers. Moreover, our present architecture is constructed with a view to upgrading to a fully decentralized system in the future.

For the matching engine to work as a distributed system, it must possess a specific property: determinism. This makes the Nash matching engine unique within the blockchain space.

Determinism simply means that a given input will always generate the same output, regardless of who is running the system, where or on what hardware. If multiple nodes are to reach consensus, they must all be deterministic, which in turn proves the correctness of the whole system. Nash users do not have to trust that a centralized exchange or smart contract–based DEX is matching trades fairly. Nash can prove that our matching engine matches trades in the fairest way, and does so every time.

This is also why our matching engine has a heartbeat.

To increase the speed of our system, each market (e.g. BTC-ETH) is treated as an independent parallel process. These individual processes are deterministic. However, this doesn’t guarantee determinism for the whole system, since the order in which individual processes run isn’t fixed.

Heartbeats let us handle any inconsistencies that may arise, making the matching engine fully deterministic. They are part of an audit system running dozens of times per second. With each heartbeat, the system updates user account balances globally. Moreover, these heartbeats let us check consistency across nodes by comparing the hashes of heartbeat data.

Watch the video above and you can see the heartbeat in action!


Nash will be unveiling our new website and exchange launch program at NEO DevCon in Seattle on 17 February. Keep watching @nashsocial for more updates!

Tom
Read more posts by this author.
All Posts

Compliance and Registration

Nash was the first Crypto Platform in Europe registered by the Financial Market Authority (FMA) of Liechtenstein. Nash is also registered with the De Nederlandsche Bank N.V. (DNB).
Icon illustration representing a book with transparent background.

Industry Leading Security

Nash’s Crypto Platform and Investment App uses state-of-the art, audited security measures and is fully non-custodial.
What makes Nash so safe
Icon illustration of a shield representing security on a transparent background.
Trustpilot logo icon
YouTube logo iconTwitter logo iconTelegram logo iconLinkedIn logo iconInstagram logo iconFacebook logo icon
Rates may vary over time. Crypto-powered earnings on Nash are not covered by any deposit guarantee schemes like bank savings accounts and involve risks unique to the underlying technologies: (i) Exploitations of the smart contracts used; (ii) Forex fluctations between your national currency and the US dollar, which underlies crypto earnings assets; (iii) USD stablecoins losing their peg. 
Nash is a trademark of Neon Exchange Aktiengesellschaft. Neon Exchange Aktiengesellschaft is an exchange bureau registered with the FMA of Liechtenstein (TT Exchange Service Provider Nr. 261096 as defined by the Token- und VT-Dienstleister-Gesetz / TVTG, 3 October 2019)
Nash Exchange B.V. is registered with De Nederlandsche Bank N.V. (DNB) as a provider of crypto services. DNB conducts supervision and monitors Nash Exchange B.V.’s compliance with the Money Laundering and Terrorist Financing Prevention Act and the Sanctions Act 1977. Nash Exchange B.V. is not under the prudential supervision of DNB nor under business conduct supervision of the AFM. This means there is no supervision of financial requirements or business risks and no specific consumer financial protections.
Neon Exchange Aktiengesellschaft is a partner of Modulr Finance B.V., a company registered in the Netherlands with company number 81852401, which is authorised and regulated by the Dutch Central Bank (DNB) as an Electronic Money Institution (Firm Reference Number: R182870) for the issuance of electronic money and payment services. Your account and related payment services are provided by Modulr Finance B.V. Your funds will be held in one or more segregated accounts and safeguarded in line with the Financial Supervision Act – for more information please see this link.
Neon Exchange Aktiengesellschaft also provides fiat-crypto exchange services. These are separate and unrelated to the account and payment services you receive from Modulr Finance B.V.