Home » Articles » Hallex – A Decentralized Cryptocurrency Exchange Via Ethereum’s Turing-Complete Blockchain
Click Here To Hide Tor

Hallex – A Decentralized Cryptocurrency Exchange Via Ethereum’s Turing-Complete Blockchain

A large number of cryptocurrency exchanges have experienced cyberattacks that led to the loss millions of US Dollars worth of bitcoins and altcoins, during the past 4 years. In most cases, most cryptocurrency exchanges utilize centralized servers, where trading takes place, to store and manage digital assets, which renders them highly valuable targets for hackers. Accordingly, decentralized exchanges represent ideal alternatives to shield cryptocurrency exchanges against such cyberattacks.

Hallex is a newly introduced trustless exchange platform for various digital assets including cryptocurrencies. Hallex is built on top of Ethereum’s Turing-complete blockchain. Through combining digital signatures with smart contracts, Hallex enforces asset trades’ rules at low latency. Although these rules render the exchange rather centralized, they don’t place trust in any intermediary third parties. This approach integrates the merits of centralized exchanges, including speed and price, along with the advantages of decentralized smart contracts, yielding high levels of security and settlement speed.


What is the idea behind Hallex?

The main idea is to save the order book on the exchange’s centralized server, yet actual transactions will only be executed via smart contracts which will impose specific security rules. Practically speaking, a user will only give the exchange permission to execute the minimum action needed; to buy/sell X amount of an asset Y at a price Z within a specific timeframe of T blocks. At the next block, the user can further revoke this authorization whenever needed. A digital signature is used to give the authorization. This digital signature is validated via means of the smart contract at the following block.

The below figure illustrates the Hallex protocol. Traders A and B exchange 100 of Y shares. The order book is saved on the exchange’s central server which promotes low latency order matching; however, the trade’s smart contract is saved on the blockchain which renders the trade decentralized and trustless.


Using this approach, the centralized exchange will not have any access to a user’s assets, as smart contracts are used to store and protect assets at all times. Consequently, even if the exchange becomes subjected to a cyberattack, the assets would remain safe.

Potential Attacks on Hallex and Mitigating Them:

According to the protocol illustrated in the above figure, a malicious exchange can perform the following attacks:

a. Delay/refuse orders’ processing

b. Delay/refuse cancelled orders

c. Reorder intra-block transactions: Due to the fact that an order is only established when a brand new block is mined, theoretically, the exchange can re-order transactions before they are stored on the blockchain.

Even though all current exchanges can experience these forms of attacks, Hallex mitigates them efficiently; thanks to the transparency offered by the blockchain. To boost transparency, the exchanges must broadcast transactions once two orders have been matched. The protocol is designed to incentivize exchanges to do so by offering them a reward for every pair of orders matched. The amount of the reward is calculated using an exponentially decreasing fee function such as:

f = e-x . 0.9 + 0.1

where x represents the time, in blocks, spent by the exchange to match two orders and f is the fee collected from finding a match. Each and every order is assigned a starting block number, which determines when this specific order can be processed on the blockchain. If the exchange succeeds in matching the order in this block, it will be rewarded with the maximum fee. On the other hand, if the order is matched at a certain point in the future, according to the above equation, the fee will be exponentially lower depending on how many blocks have been created by the time the order has been matched. As a result, whenever an exchange deliberately delays processing of an order, it will be literally penalized in terms of collecting lower transaction fees. As such, honest exchanges will be always maximally incentivized to encourage immediate processing of orders whenever possible.

The Hallex protocol prevents double spending attacks via introduction of a simple lock system. Before a trade could be executed, the exchange must lock the trader’s assets for a given period of time, for example 100 blocks, which renders double spending, or concurrent trades, impossible. The locking system is saved and enforced via the smart contract.

Leave a Reply

Your email address will not be published. Required fields are marked *


Captcha: *