UEH News

Building a Decentralized Stock Market based on Blockchain Technology

Building a Decentralized Stock Market based on Blockchain Technology

19 Sep, 2021

Building a decentralized stock market will help eliminate unnecessary intermediaries, consequently, reducing transaction costs, transaction time, time for securities and money to the account. Besides, with the security mechanism of Blockchain technology, it will make the market very difficult to be attacked, bringing high safety and sustainability to the whole system. What is the most appropriate solution to apply Blockchain technology in building a decentralized stock market in Vietnam?

Background and historical mission of technology-based non-traditional trading methods

As far as we are all aware, the traditional stock market with a centralized management system can be targeted by hackers; therefore, the security of the current stock market model is not high. Besides, this traditional market model is the place where power is concentrated in controlling, setting prices and imposing related costs. Furthermore, the system is being heavily dependent on intermediaries called brokers, benefiting from transaction fees, which are unnecessary fees and should be eliminated in the new model. Another limitation of the current stock market model is that the transaction processing time is too long, the settlement process takes a long time in general, which destroys the dynamic nature of the stock market. Industrial Revolution 4.0 era along with Blockchain birth allows us to think of building a completely new stock market model with a completely decentralized mechanism, which will be an innovative solution that will overcome inherent shortcomings in the traditional stock market model.

Proposing Blockchain technology application in building a decentralized stock market in Vietnam

In accordance with the advantages of Blockchain technology, listed as eliminating intermediaries: stock exchanges, securities companies, clearing and settlement centers, contributing to minimizing transaction costs in the market; concurrently, to increase the security and the safety of the entire stock market, our authors propose to build a decentralized stock exchange model as follows:

Trading method on exchange floor using Blockchain technology

This solution is to build a decentralized stock market that aims to provide a solution to all the disadvantages of a centralized market by providing: (1) unification for all transactions, (2) automatic confirmation through smart contracts, (3) transparency of algorithms through smart contract code, and (4) low transaction fees through a competitive peer-to-peer market.

A smart contract is a piece of code that describes business rules that need to be verified and accepted. Therefore, an actual legal contract can be viewed as a set of instructions. These contracts are registered in Blockchain, similar to transactions. They can be triggered in the future by transaction calls and its state will be updated based on the smart contract execution results. Smart contracts should be viewed as a stateful, functional element that can be activated at any time after successful implementation. The purpose of a smart contract is to replace third parties (judges, notaries, escrow, brokers, etc.) with a neutral agent that operates in accordance with a defined set of rules in advance. The specific terms of a smart contract depend heavily on the framework that implements it.

Securities trading smart contracts are built on-chain when supply and demand meet and an order-matching transaction occurs. The transaction information is completely public and Blockchain network acts as a decentralized depository where each participant can keep track of all transactions and provide a copy of the data across the network. Furthermore, any modification to the custody is governed by consensus among the participants in the system and any kind of attack is not feasible because the state of the custody is stored in the block files in terms of anti-theft mechanism.

Once there is a false notification of an order placed transaction between the peer-to-peer networks, this order integrity will be checked in the platform before execution. As a decentralized clearing house, each node in the network checks the order validity by ensuring that the transaction is guaranteed to be executed when the order is matched. For each BUY transaction, it validates whether the buyer has frozen the funds in case the transaction has enough funds to pay. This is checked against the required quantity and price, depending on the order type (SELL transaction does not require blockade). By freezing the funds inside the transaction, the actual amount will be used, no deposit is required. From this point on, the funds will be frozen and controlled by the contract and transferred to the seller once the order is executed. Similarly, whenever a SELL transaction is launched, the network confirms whether the seller owns a sufficient number of securities that he is willing to sell, by checking the imported entries of the decentralized deposit depot.

Each market seller will issue a sell order with a suggested quantity and price. Similarly, the buyer will issue a buy order containing the quantity and the price they are willing to pay. After creating commands, these commands will be recorded and replicated in blocks across all nodes in the network.

Consensus mechanisms are implemented in the blockchain system, which keep track of all these changes and confirm each state update corresponding to each buy/sell price received by the respective trader. Because StockMarket contract is replicated across all nodes in the network, subsequent transactions contained in a block are confirmed by each node in the network in the following way:

To create a valid block, it must contain transactions along with the latest state of the account; in our case, it is StockMarket Contract. The latest states are determined by the miner after applying the action sequence represented by the transactions stored in that block. When one miner wins, its block is propagated to the entire network for verification and acceptance. Each node of the network will receive this newly-mined block and validate the state transitions, by performing all known states related transactions from the previous block; after that, comparing the results between the block received by miners and their own computation. The proposed changed state is accepted if and only if the validation is correct; otherwise, the block is discarded and new block proposals are accepted.

Consequently, the system provides a fully replicated and highly reliable decentralized application, where each node is responsible for validating the integrity of registered actions: owned assets, transaction and offer prices, market prices, settlement prices and so on. The management proposal system provides complete decentralization as well as provide a democratic system where each stakeholder can have transparent access to all the algorithms and implemented transactions, verify and validate the integrity of these transactions. Furthermore, one important improvement of the system is the lower fees obtained by eliminating the middlemen who are representing the customers. These fees are replaced by mining fees needed to provide security and system integrity by rewarding miners for their honest work.

Advantages of Decentralized stock trading model compared to those of Centralized model

Being hard to be attacked: Since each participant will be backed up by a decentralized and distributed ledger of transactions, data loss is unlikely unless hackers can hack into the computers of all participants in this stock market at the same time.

Transactions are difficult to be fixed: The possibility of a 51% oversold attack is theoretically and practically impossible as a hacker must take control of 51% of the network nodes on the system to be able to correct any transaction. Besides, transaction correction can only be conducted in newly generated blocks, not fixing blocks in the past when it has been attached to Blockchain.

Minimizing transaction costs: The elimination of intermediaries, listed as stock exchanges, securities companies and stockbrokers will minimize transaction costs for investors. The transactions are confirmed automatically through the computer system of the participants.

Minimizing clearing time: After the smart contract is executed, the clearing between the buyer and the seller will be automatically performed immediately without having to wait for T+3 as the transactions according to the current traditional method. Helps increase liquidity and minimize clearing time for investors.

Avoiding price making, putting virtual orders on the floor: The fact that the public trading can only be traded if there are real stocks will avoid price making phenomenon, pushing virtual orders on the floor, causing market distortions like traditional stock exchanges.

Avoiding congestion and overload of centralized system: Because the transaction mechanism is a peer-to-peer network mechanism, putting orders into a server system for processing leads to overload will not occur to a decentralized transaction model when orders are executed peer-to-peer and concurrently through distributed network nodes, therefore, limiting the overload of the old centralized transaction mechanism.

Disadvantages of this model

Being unable to be corrected is both the advantage but also the disadvantage of the model. Once the transaction has been made and confirmed to be included in the blockchain, it cannot be edited or deleted on the blockchain system anymore. It can be inferred that when the order is placed incorrectly and the order has been matched, the order cannot be corrected.

Generally speaking, each new revolution has certain advantages and disadvantages; however, it is a general movement to develop new ones and eliminate old ones that are no longer relevant. Therefore, to be able to apply this model in practice, we need to build a suitable roadmap and come up with plans to optimize the advantages and to minimize the disadvantages of the model. From this foundation, building a stock market under a decentralized mechanism provides an additional effective capital transmission channel for the economy in the future.

Please refer to the full research of Building a Decentralized Stock Market based on Blockchain Technology here. Author group consists of: Dr. Nguyễn Hữu Huân (UEH); Dr. Ngô Minh Vũ (UEH); MSc. Trần Nguyễn Trâm Anh (Văn Lang University).

This paper is in Series Spreading researches and applied knowledge from UEH, we would like to invite distinguished readers Newsletter ECONOMY NUMBER #23 “Employment Policy for Ho Chi Minh City in Post-social distancing Period”

News, photosAuthor group, UEH Department of Marketing – Communication.