Abstract
At present, the spot exchange will encounter two major problems in the commodity transaction. One is the risk of the transaction. The second is the transaction controllability problem. The problem of transaction accuracy is mainly manifested in the complex links. The information transparency is not high. The stakeholders are relatively independent, thus exacerbating the risk of the transaction. Spot trading market is very large, there are many difficulties in the process of market transactions, and the controllability is not high, which brings security risks to the healthy development of spot trading market. Therefore, in this paper, the block chain technology distributed book functions were combined to improve the rapid interaction of information. Market bi-directional transactions were increased, the authenticity and reliability of the transaction was guaranteed, and the risk of the transaction was reduced. In addition, the decentralization function of block chain technology was exploited, and the ability of market regulators to supervise the market order was improved. The healthy development of spot trading was guaranteed.
Introduction
The distributed independent nodes and de-centric functions of the block chain technology have certain relevance for solving the asymmetry of information asymmetry in the spot market and the difficulty of supervision and management [1]. The database system based on the block chain adopts the multi-node cooperative maintenance books to manage the data, which has the characteristics of transparency, reliability, fairness and security of the transaction information, and ensures that the transaction data is not to be forged and tampered with. The idea of decentralization is an independent record of transaction information that occurs at each node, and is traceable and can be used for the regulation of transactions [2]. The application system based on block chain is more secure in development than traditional database application system, and can simplify the development process and multiplex the structure coding to achieve the new system frame structure [3]. Columns: MVC mode is converted to MVBC design pattern, visual model control based on block chain [4]. In the development and application of the block chain, EBA and POC perform a generic block chain, the accounts, transactions, contracts on the same unified block chain, and maintain unity [5]. However, this method is applied to the spot trading market. Due to the limitation of transaction privacy, the common block chain can’t meet the requirements of independent transaction and privacy protection. At the same time, under the environment of organization sharing, the system has high throughput, slow running and can’t reach real-time application of spot transactions [6].
Based on the application of the original block chain technology, this paper proposed the block chain architecture for sharing a variety of spot transactions with metadata and protocols, and established the account limit in the chain of permitted blocks, and the transactions between units in the spot trading process are protective [7]. The stock transaction data is divided by the two types of block chains, such as Account Block Chain (ABC) and Trading Block Chain (TBC). Among them, the ABC block chain stores the transaction account information and the transaction result information, which does not have the function of transaction execution, and the TBC stores the relevant information about the execution of the spot transaction [8]. The TBC network structure of multi ABC block chain is constructed under the same environment. The ABC block chain is responsible for the preservation and inquiry of the accounts, ensuring the exclusivity of the account and not being maliciously tampered with by hackers [9]. ABC block chain is used Kazakhstan clothing encryption, each spot transactions are verified, and through the block chain nodes to monitor each other. The TBC block chain is responsible for the execution of the spot transaction. As a channel for performing transactions and settlement, it does not confirm the information of both parties, performs only the data exchange of the participating accounts, and encrypts the interactive data [10]. ABC+TBC binding architecture established the spot trading account into a separate block chain to ensure the anti risk ability and controllability of the block chain.
Block chain technology
Block chain structure
The block chain is a complete data chain formed by the connection of different data blocks through the information chain, which divides the data to form a plurality of data blocks [11]. In the block of the block, the Block Header is set, which contains the hash value of the previous block, and the block is concatenated by the hash value. The block structure is shown in Fig. 1.

Block chain structure.
The block chain is divided into block head and block body. The block header is the hash pointer Hof the previous block, and the block body is the data, and becomes the whole block chain structure through the links of the various blocks. Technically, the core content of the block chain includes a block-chain structure, multiple independent information stores, and a highly fault-tolerant system [12]. Each block in the block chain has a timestamp, which is linked by a hash with the previous block to form a chain structure. When the transaction is made, the block chain can be viewed as an account. The information is verified to ensure the reliability and security of the transaction [13]. Each node in the block is stored with independent information, which can complete a closed job independently, and the blocks can be interconnected and monitored to achieve the sharing of information, which shows that the block chain book is a distributed book. Block chain system can guarantee the existence of errors below 1/3, and can keep the system running as much as possible in a complex and open environment, the block chain is a highly relevant synchronous distributed account [14].
Block chain application process has a very high security, which can choose a different encryption algorithm for encryption, and because the data is divided into blocks and has good security, the block chain system can guarantee the authenticity and security of the data in the financial and other fields [15]. Block chain has the characteristics of being difficult to tamper with, intelligent contract, centralized, architecture sharing and so on in application. When data enters the block chain system, the system manager and the application can’t modify the data, thus being reliable in the financial, futures, spot and other transactions [16]. Block chain execution is based on contract law, and the law defines the automatic generation, and establishes intelligent contract relationships to ensure the legitimacy of the operation. There is an independent relationship of mutual trust between blocks. On the chain platform, even if the two sides do not know each other’s identity, but the platform can ensure the safety of the transaction to achieve their goals. In the block chain framework, the use of distributed systems allows information to be reused, each node work independently, reducing the cost of master-slave relationship, the system is more flexible [17].
According to the characteristics and application areas of block chains, it can be divided into public block chains and permissible block chains [18]. The nodes of each block in the common block chain can be kept accountable independently, which is open to the public; the nodes that have the permission chain can be booked and non-public. In a distributed environment, the PoW workload test and the Pos equity certification mechanism were used to ensure the consistency of the block chain system data [19]. The PBFT Byzantine Consensus Agreement and the CBFT Concurrent Byzantine Consensus Agreement were used to establish a licensed block chain. The transaction information on the common block chain needs to be signed and validated, so it needs to be optimized in terms of the corresponding speed. Due to the shared data service, the scalability of the function is low, and the block chain is a block chain operation, which has good independence and is better at the corresponding speed and scalability than the public block chain, but it is necessary to solve the problem of server pressure caused by multi user concurrent use of licensed block chain.
In order to ensure the security and controllability of the block chain system, smart contracts are used to create code contracts that place data on block chains to prevent tampering. The relational database differs from the block-chain database in nature, which leads to differences in the way things are handled [20]. The principle of smoothing relational database to deal with things is atomic, consistent, isolated and persistent, that is, ACID (Atomicity Consistency Isolation Durability). The block chain database does not comply with the principle of transmission, which maintains the consistency of the data through the distributed books, multiple transaction blocks can be established through the block chain, which each independently handle the database transaction, the transaction processing of relational database and block chain database is compared as shown in Table 1.
Comparison of transaction processing between traditional database and block chain database
Comparison of transaction processing between traditional database and block chain database
The block chain can contain multiple transactions in terms of transaction unit processing. Relational databases can only be handled separately, and block chain can deal with multiple transactions at the same time. Although the relational database and the block chain database are faced with the problem of transaction delay, the block chain can solve the conflict between transactions in the application, building blocks, the chain code and other links, relational databases can’t solve these problems. In the aspect of transaction processing, the block chain database can set up several independent databases according to the block chain nodes. Each node can choose different methods to deal with the data, the relational database can only be concurrent control; in the processing system, each node of the block chain can manage the database. The relational database uses centralized database management. It can be seen that in the face of spot exchange transaction services with a large number of users, complex transaction process, multiple concurrency, block chain technology clearly has a better ability to solve problems.
Spot exchange block chain application system architecture
Spot exchange block chain application system was based on spot information and transaction service system of licensed block chain. The architecture of the system was designed with scalability and security, block chain node credit mechanism, ABC and TBC double-chain architecture were established. Based on cloud services, the system’s data capacity and productivity were improved. The architecture of the application system of spot exchange block chain is shown in Fig. 2.

Spot exchange block chain application system architecture.
Applications include: banking system, computing legal system, credit certification, supply chain system; chain code includes: business process chain code, the deployment chain code, execution chain code. Chain code services include: account registration, account cancellation, status storage, permission authentication, transaction delivery, status check. Interfaces include: transaction reception, query, public and private key synchronization, transaction, block transmission and broadcast. The block chain service consists of ABC block chain and TBC block chain. The ABC block chain performs state synchronization, index service, account service, public and private key management. The TBC block chain performs the actuator, the state management, the state transmission, the state acquisition. The block chain service also performs consistency management, transaction services, block services, reputation systems and synchronization management. Consistency management can choose the round Robin, create or send blocks, block transactions. The transaction service establishes the bucket model, the block service establishes the bitmap, the reputation system carries on the user credit appraisal, and the synchronous management broadcasts the length of the local block chain, receives missing blocks and stores missing blocks; stores include: cache and database, the cache includes transaction cache, block cache, and run-time data cache.
The system architecture is divided into application layer, chain code layer, API interface layer, cache layer, basic block chain layer and storage layer from top to bottom. The application layer connects the spot exchange application, such as the banking system, the credit authentication system, the spot trading system and so on; the chain code layer verifies the legitimacy of the users of the spot transaction, conducts user interaction, account management, and delivery of transaction agreements based on spot trading rules and contracts. API interface layer provides internal and external spot trading application interface, such as communication, broadcasting, transaction, query and so on. The cache layer stores the temporary information in the memory, which includes the new transaction information received by the user and the code on the block chain. The cache layer stores the temporary information in the memory, which includes the new transaction information received by the user and the code on the block chain. The base block chain carries out the transaction data transmission service. During the spot transaction, the transaction information in the cache is concentrated in the unified service database and the bitmap is created and sent to other nodes. The ABC block chain ensures that each node maintains a consistent state and provides the account secret key service. TBC block chain performs execution chain code transaction, and then stores the results in the database; storage layer for data storage services in the database. Storage layer performs the storage service of the data in the database.
The block chain interface used in spot exchange system based on block chain technology is a unified interface of JBCC, which stores the data involved in the stock exchange in the block chain and provides a query interface to find the required information for the user. The JBCC interface is shown in Fig. 3.

JBCC interface.
The JBCC interface layer writes the interface put (action, data) and the query interface get (condition). Block chain Core layer establishes the consensus mechanism, builds the block, and synchronizes the management, the signature/the unselecting. Reputation system storage layer uses MySql database, which is written into the block chain through the put (action, data) definition. The parameter action handles the intent data of the user’s spot transaction, including creation, insertion, uploading data, deletion, and so on. Each operation is treated as the only fixed data to prevent tampering. Data parameter records the user data, queries the block chain through the get (condition), and sets the query condition through the condition. The query condition is a keyword or block and the hash value of the transaction. In the spot exchange chain system JBCC use process, the isomorphic call mode uses the interface function, the client sends the block chain request to the server side, the server publishes the request to each node, returns the requested information to the client. The use process of JBCC in the spot exchange block chain system is shown in Fig. 4.

Spot exchange block chain system JBCC use flow.
The user applies the block chain system. The JBCC client agent sends a request to the JBCC server-side proxy to enter the block-chain core system, and returns the information to the JBCC server-side agent by querying and confirming the user’s call information and sends it back to the JBCC client agent to the user. In the face of spot transactions, multi-user, multi-product, multi-transaction characteristics, the JBCC interface supports multiple block-chain applications that can be applied across systems. The JBCC interface design can improve the scalability of the spot exchange based on the block chain technology, shorten the development cycle and improve the operating efficiency of the system.
In this paper, the ABC+TBC architecture proposes an independent block chain for spot trading accounts to ensure the anti risk ability and controllability of the block chain. ABC account block chain and TBC transaction block chain work independently of each other. The ABC account of block chain stores the information after the user information and transaction. The TBC transaction block chain performs transaction information storage. The ABC+TBC binding architecture is shown in Fig. 5.

ABC and TBC combined architecture.
A block chain can be divided into multiple block chains, each with a timestamp, and each transaction is verified by a hash encryption. ABC has good scalability, when a block chain in the process of data processing beyond its size limit, then it divided a number of ABC sub-block chains, so that it is distributed through the cloud storage in a different server to be managed to ensure that the balance of data storage. The scalability architecture of the ABC block chain is shown in Fig. 6.

ABC block chain extensibility architecture.
Blocks containing 1, 2, 3 blocks are divided into two block chains, containing 1, 2, 3, 4A and 1, 2, 3, 4B, respectively. Each block is an independent block chain, which can be run in different hardware devices so as to achieve load balancing. As a result, each unit of the spot transaction can be independent of the block chain of the corresponding account, which has the closed characteristics of the block chain and is only shared on the transaction block chain at the time of the transaction.
The data stored in the library is passed by the control platform. To ensure the synchronization between the control platform operation and database storage, there is a certain delay in the traditional data manipulation and storage process, so the legal effect of the transaction can’t be guaranteed, at the same time, the transaction process can’t be recorded in the monitoring database, which is not conducive to the regulation of spot transactions. The data in the database is also easy to change internally, or external hacking, which leads to inaccurate transaction information and information disclosure. Therefore, the application of the stock exchange chain needs to be carried out under the effective legal framework, and needs to meet the timeliness of data collection, the integrity of the acquisition process and the original of the data. The principle of block chain law is shown in Fig. 7.

Block chain legal principle.
In the block chain technology, the user operation information is sent to the transaction block chain, and then the user operation information is processed by the transaction block chain, and the time stamp is attached to the other block chain. Thus, according to the timestamp, the user’s transaction information can ensure the timeliness, each block chain are independent operation and backup, which can maintain the independence of the block chain. Even if a block chain is hacked or invaded, it will not affect the normal work of other block chain. The process of spot trading block chain is shown in Fig. 8.

The spot transaction block chain process.
Users view spot transactions and carry trade payments through transaction block chains. The transaction block chain calls the data information for the user, and the spot distribution block uploads the spot transaction information to the database. The user pays to the publisher of the spot transaction through the account block chain. Both the user and the spot publisher can view the transaction process information through the transaction block chain. The execution of the spot trading block chain is done by the code on the chain, and each time a block is created, the chain code data is placed in the account. Since spot transactions have periodic transactions, they need to wait for spot prices to rise before trading, so they need to wait for some time. And the spot trading block chain has multiple accounts on the chain code, and the implementation process will spend a lot of time and memory, so as to ensure the efficiency of the block chain trading block. The code execution model of the chain transaction chain is shown in Fig. 9.

Code execution model for spot trading block chain.
Through the framework of intelligent contract, transactions and information exchange is carried out. The smart contract controls the building blocks, and the code and database on the chain can create multiple blocks such as # i, # i + 1, # i + 2 and so on. To ensure the efficiency, accuracy and security of the system during complex spot trading, the user needs to put the implementation of the specific function in the application system. Most of the code requirements on the chain are quickly found and can be easily executed as needed without having to perform a wide range of search queries. The code on the account chain is independent, which solves the account’s own business on the account block, or associates a small number of account operations to ensure efficient execution of the code on the chain.
Taking a spot exchange as an example, a spot exchange application system based on block chain technology was established. The spot exchange has 83.8465 million users in 2017, the daily trading volume of 10.8 million transactions, trading platform transactions 832 times per second. Thus, 120 (n) compute nodes were established. Each node building block transaction communication is 4 times, node communication total of 480 times, the transaction time is fixed for 4 hours.
The exchange information for each block transaction is R × 1202 (n2) =7.2 million. If the time for building blocks is 1 s, then we can build a daily 4 × 602 = 1.44 million pieces. The daily exchange of information on the block chain is: billion. To ensure the security of the spot transaction, the transmission of each information needs to be encrypted and decrypted a total of 4 times, respectively, for the encrypted transmission, decryption transactions, encrypted return, decryption view, so the message exchange encryption calculation needs to be calculated 10.368 × 4 =41.472 billion times. If 10 million transactions per day within 4 hours, the system carries out 1000/4 ×602 = 694 times transactions per second. If every day requires 3 billion accounts per node, then the query calculation is 30 × 1000 = 3 ×1016 times, each node of the encryption and decryption calculations deals with 1000 × 4 =4000 million per day.
ABC block chain plus TBC block chain double-chain architecture model was used, a number of ABC account chains were set to record and query account information, and the TBC transaction block chain records and queries the transaction information. The double chain schema of ABC block chain plus TBC block chain of spot exchange application system based on the block chain technology is shown in Fig. 10.

Code execution model for spot trading block chain.
Each node of ABC block chain of spot exchange application system based on block chain technology requires 10 × 10 × R = 400 blocks per second to exchange information per second. Each ABC chain has 10 nodes. A node corresponds to a device, if the ABC chain is 150. The average block time is 1 s. The average processing account information of each ABC block chain is 30/150 = 0.2 billion. Each node on each ABC block is encrypted and decrypted 4 × 400 = 1600 times. Each ABC block chain handles an average transaction volume of
In the process of spot trading, the units participating in each transaction include transactions, liquidation, settlement, banking and so on, usually less than or equal to 10 organizations. Each ABC block chain is connected to multiple TBC transaction block chains, both of which can be changed in both the account and the quantity. Assuming that each TBC transaction block chain has 30 nodes involved in the calculation, the average node has 10,000 accounts at a time point, then all accounts are in this TBC transaction block chain, the block size of each block chain is 30 × 30 × R = 3600 per second and the 3600 × 4 =14400 times encryption and decryption calculation carried out, the workload is much less than the traditional trading platform.
The performance comparison of a chain with ABC block and TBC block chains is shown in Table 2.
Performance comparison of a chain with ABC block and TBC block chain
Spot exchange application based on block chain technology takes the block connector JBCC as the link object, and establishes the multi-block chain application system, which has the characteristics of high development efficiency, low development cost and fast running speed, and has good reliability and security for solving the transaction process of spot transaction and summarizing complicated affairs. Block chain technology was applied with spot exchange trading platform, double chain model was established, the data was divided into ABC account block chain and TBC transaction block chain, and both work independently. The ABC account block chain is responsible for storing and managing account information and post transaction information. TBC is responsible for the storage and management of transaction information, which has the characteristics of fast speed, large amount of data processing and account security and has code credibility and execution security within the framework of the chain code legal contract, facilitates the monitoring and management of spot transactions by regulators, has very good application effect on the standardized operation of spot transaction on spot exchange. Although the double-chain model of JBCC link and ABC+TBC in the application of spot chain technology in spot exchange is a good help to solve the problems of system pressure, low information security and difficult supervision, however, there are still some shortcomings in the research of this paper. For example, in the aspect of block subdivision, this paper only divided out the account information block and the transaction block, the contracts, funds, delivery and settlement of complex spot transaction still need to be improved in the following research.
