Network layer

The underlying communication network of CS Token blockchain adopts the P2P architecture, and then adds an authentication mechanism and a permission model to ensure data security on the blockchain.

The user registration service provides an interface for new user registration, and the user submits enterprise information and recommends enterprise, waiting for approval of the nodes on the chain. The information submitted by the user can be entered into the alliance chain after distributed auditing, which is conducted by Byzantine fault tolerance. Once the user enters the alliance chain, the corresponding authority is obtained, and the certification center also assigns the corresponding attribute to the enterprise, so that the enterprise can view the data within its authority.

Blockchain layer

1. DAG data structure

DAG is an iconic technology of Blockchain 3.0. It is a block data structure that is different from Merkle Tree. Its purpose is to solve the problem of transaction efficiency on traditional chain structure. At present, many projects such as IOTA and Byteball have been utilized. DAG has built a stable and efficient public chain, which greatly improves the throughput of the blockchain. At present, IOTA's TPS (transactions per second) can reach 600-900, which has exceeded the trading capacity of Paypal. The new public chain based on DAG optimization, such as InterValue, claims that TPS has reached a million levels. The supply chain involves data storage, anti-counterfeiting, and asset trading. Therefore, the traditional chain structure is difficult to meet the high-performance demand of the supply chain. Therefore, CS Token adopts the latest DAG technology as the underlying data unit. Units and units are linked together to form a DAG map. Unlike block chain structure, DAG units can be linked to any one or more of the previous units, so there is no need to wait for strong synchronization between nodes, which can greatly increase the amount of concurrency of transactions and reduce the confirmation time to the minimum.

DAG is a common data structure in the computer field. It is mainly used to deal with dynamic planning, navigation seeking shortest path, data compression and other issues. The DAG data structure is shown in Figure 8. The directed edges between the cells indicate that there is a reference relationship between the two cells. There is a directed edge from 1 to 2 in the figure, indicating that 1 refers to 2, 1 is the parent of 2 , 2 is a subunit of 1, at the same time, we call unit 4 indirect referring to 1, 1 is the ancestor unit of 4; unit 1 does not have any parent unit, called the creation unit, the creation unit is unique; unit 8 does not With any subunit, such a unit is called a top unit.

2. Encryption mechanism

The data uploaded by the node can be set with an encryption mechanism. The system provides multiple encryption mechanisms to encrypt the data. Only users with certain attributes, permissions or keys can view the data.

Performance and security are the cornerstones of blockchain applications. This is especially true in the supply chain field. The supply chain involves core data. If enterprises want to take the initiative to put data on the chain, security is the top priority. Therefore, CS Token adopts the latest security technology in security mechanism, including signature algorithm against quantum attack, threshold encryption based on secure multi-party computing and attribute-based data access control to ensure the security of data on the chain.

2.1 Asymmetric encryption

Asymmetric encryption is an encryption technology integrated into the blockchain to meet the security requirements and ownership verification requirements of the trading platform. The encryption algorithms implemented in this scheme include RSA, Elgamal, Rabin, DH, and ECC. The access control mechanism of data is realized by asymmetric encryption.

Asymmetric encryption algorithm requires two keys: a public key and a private key. The public key and the private key are a pair, and the corresponding private key cannot be derived from the public key. If the data is encrypted with a public key, it can only be decrypted with the corresponding private key, and vice versa. Because encryption and decryption use two different keys, this algorithm is called asymmetric encryption algorithm.

The characteristics of asymmetric encryption algorithm: the strength of the algorithm is complex, and the security depends on the algorithm and the key. However, due to the complexity of the algorithm, the encryption and decryption speed is not as fast as the symmetric encryption and decryption. There is only one kind of key in the symmetric encryption algorithm, and it is non-public. If you want to decrypt, you have to let the other party know the key, so to ensure its security is to ensure the security of the key. The asymmetric encryption algorithm has two kinds of keys. Since other people cannot calculate the corresponding private key through the public key, the public key can be disclosed to others, and the private key is kept secret. In this way, it is not necessary to provide the other party's key like symmetric encryption, which eliminates the need for the end user to exchange the key, reduces the risk of key leakage, and improves security.

The basic process of asymmetric encryption algorithm implementing exchange for confidential information is: Party A generates a pair of keys and discloses the public key. Party B, which needs to send information to Party A, uses Party A's public key to encrypt the confidential information before sending it to A. Party A then decrypts the encrypted information with its own private key. When Party A wants to reply to Party B, the process is just the opposite, Party B's public key is used to encrypt the data. In the same way, Party B uses its own private key to decrypt it.

2.2 Anti-quantum digital signature

Digital signature is a series of digits that only the sender of the information can produce and it cannot be forged by others. This digit string is also a valid proof of the authenticity of the information sent by the sender of the message. Digital signature is the application of asymmetric encryption technology and digital abstraction technology.

Transaction data requires a valid signature to be stored. In order to ensure that transaction data is not tampered with, in addition to saving the original data or transaction records, the blockchain also stores its hash function value, that is, the original data is encoded into a string of numbers and letters of a specific length and then recorded in the blockchain. Generally, a hash calculation is performed on the data to obtain a hash value. When the sender sends the information out, the hash value is encrypted with its own private key and sent out as a signature and information. After receiving the information, the receiver recalculates the hash value of the information, and uses the sender's public key to decrypt the hash value attached to the information, and then compares them. If the two are consistent, the content of the information is not modified. Because as long as the content is modified, the hash value calculated according to the information content will change, so this effectively prevents the message from being tampered with.

The hash algorithm can ensure that the transaction data is not tampered with, but the simultaneous replacement of the data and the abstract and the non-repudiation of the transaction data cannot be guaranteed. The core data of the supply chain design enterprise, once attacked, is likely to cause huge losses, so it is necessary to consider a more complete signature algorithm. CS Token adopts the current cutting-edge anti-quantum signature algorithm: the public key encryption system algorithm based on lattice theory. At present, the public-key cryptosystems against quantum attacks mainly include the public-key cryptosystems based on lattice theory, the error-correcting code based public-key cryptosystem, and Multivariable polynomials based public-key cryptosystems. The security based on the encoded public key system is based on the error correction code problem, and the security is strong, but the calculation efficiency is low. The public key cryptosystem based on multivariate polynomial is mainly based on the intractability of multivariate quadratic polynomial equations on finite fields, and the shortcomings in security are obvious. The public key encryption system based on lattice theory is simple, fast in calculation and small in storage space. It is a common anti-quantum attack encryption system.

2.3 Threshold encryption

When the data involves multiple enterprises, how to ensure that data between multiple enterprises is not viewed by external enterprises is an important issue. CS Token blockchain uses a multi-party secure computing mechanism, using threshold passwords and attribute-based encryption mechanisms to achieve internal sharing and external protection of data.

Threshold cryptography is a combination of secret sharing and cryptographic algorithms. It is an important branch of cryptography and one of the research hotspots. Threshold cryptography plays an important role in enhancing network security and reliability. This technology can be effectively used for key escrow, digital signature and authentication, and has important applications in secret recovery systems.

Secret sharing is a kind of cryptographic technology that divides secret storage. The purpose is to prevent the secret from being too concentrated, so as to achieve the purpose of dispersing risk and tolerating intrusion. It is an important means in information security and data confidentiality. Secret sharing provides the possibility to share secrets with multiple people. The so-called secret sharing divides a total secret S into N sub-secrets, which are respectively mastered by N participants. Some specified combinations of participants can recover the total secret S by cryptographic operations, while other combinations cannot obtain any information of S, thus achieving the purpose of confidentiality. If in any secret sharing scheme, any T or more participants can recover the secret S together, T-1 or fewer participants can not get any useful information of the secret S, then we call T the threshold. The corresponding secret sharing scheme is called the (T, N) threshold scheme and is the most commonly used secret sharing scheme in threshold cryptography.

Commonly used threshold secret sharing mechanisms are the Lagrangian interpolation scheme proposed by Shamir and the geometric space vector scheme proposed by Blakley. Among them, Shamir's solution is complete, and Blakley's solution needs to be modified to be complete, so the system adopts Shamir's solution.

2.4 Attribute encryption

Attribute-based encryption is a powerful cryptographic mechanism that enables fine-grained access control. It is another common way to share encrypted data with others.

In the access control based on attribute encryption, users can obtain access rights as long as they have specific attributes, which are not affected by physical environment factors, can realize multi-value distribution of attributes, and solve fine-grained access control and scale user dynamic expansion problem in complex network information systems. This is a more practical public key encryption method for shared data access control in an open complex network environment. In a system based on attribute encryption, each type of authority can be represented by a set of attributes. An authority authenticates all sets of visitor attributes and distributes the corresponding attribute keys. The data owner's resources are encrypted and stored in the system server, the data owner can flexibly formulate an access policy for encryption according to needs. If the visitor meets the access policy, the access authority for the data owner's encrypted resource can be obtained through the decryption operation.

For example, if a data owner wants to share a message, he can set the access policy to be: a node that has both attribute A and attribute B or attribute C can be accessed. The policy can be expressed as a Boolean expression as shown in the above figure. Encrypting the information to be shared under this policy enables effective control of the visitor.

3. Consensus

The consensus mechanism is an important part of the blockchain. It involves the two most important aspects of security and performance. It affects the operation of the entire blockchain. It needs to consider the impact of operational efficiency and security. Different application scenarios may need different consensus mechanism.

CS Token is based on the supply chain. To meet the needs of different scenarios, the solution implements a customizable and pluggable consensus mechanism framework, develops a consensus mechanism management engine, implements the consensus algorithm modularly, and configure a consensus algorithm based on the needs of the actual top-level application. At the same time, the program will specify the participant interface standard, the event processing interface standard and the event manager interface mode, and provide the plug-in configuration process of the consensus mechanism, which can realize the flexible configuration and custom extension of the consensus mechanism. CS Token mainly implements the following consensus mechanisms:

(1) PoW (Proof of Work). PoW is a consensus mechanism used in the Bitcoin. A consensus mechanism based on workload proof, including independent verification of transactions, block construction (mining), new block verification, blockchain assembly and selection. The advantage of PoW is that the algorithm is simple and easy to implement, and there is no need to exchange additional information between nodes to reach a consensus, and cost a huge to destroy the system. However, there are also shortcomings such as wasting resources, too long confirmation time of the block, and prone to bifurcation.

(2) PoS (Proof of Stake). PoS is based on the Coin age and is generated by a hash operation of each node similar to PoW. The logic behind it is that the blockchain should be protected by those who have economic interests in it. Coin age refers to the length of time the currency is held multiplied by the amount of coin. PoS has alleviated the energy consumption of PoW to a certain extent, but the accounting is not professional, because the participants with equity may not want to participate in accounting.

(3) DPoS (Delegated Proof of Stake). DPoS is similar to the Decentralized Autonomous Company (DAC). Each shareholder has the right to vote according to its shareholding ratio. The result of 51% shareholder voting will be irreversible and constrained. Each shareholder in DPoS can award his or her voting rights to a representative. The top 100 delegates with the highest number of votes are rotated to generate blocks according to the established schedule.

(4) PBFT (Practical Byzantine Fault Tolerance). Byzantine Fault Tolerance (BFT) is derived from the problem of General Byzantine and is a type of fault-tolerant technology in the field of distributed computing. Byzantine assumptions are models of the real world, and computers and networks may exhibit unpredictable behavior due to hardware errors, network congestion or disruptions, and malicious attacks. In a distributed system, especially in a blockchain network environment, it is similar to the Byzantine general environment, with a functioning server (like a loyal Byzantine general), a faulty server, and a vandalized server (like a rebellious Byzantine general), but the original Byzantine fault-tolerant system lacked practicality because of the need to demonstrate its theoretical feasibility. In addition, additional clock synchronization mechanism support is required, and the complexity of the algorithm increases exponentially as nodes increase. Practical Byzantine Fault Tolerance (PBFT) reduces the operational complexity of the Byzantine protocol, from index level to polynomial, making it possible to apply Byzantine protocols to distributed systems and solving the problem that the original Byzantine fault-tolerant algorithm is not efficient. The time complexity of the algorithm is O(n2).

PBFT is a state machine replica replication algorithm, in which the service is modeled as a state machine, and the state machine performs replica replication at different nodes of the distributed system. A copy of each state machine saves the state of the service and also implements the operation of the service. A collection consisting of all copies is represented by an uppercase letter R, and each copy is represented by an integer from 0 to |R|-1. For convenience of description, it is generally assumed that the number of fault nodes is m, and the number of service nodes is |R|=3f+1, where f is the maximum number of replicas that are likely to fail. Although there may be more than 3f+1 copies, the extra copy reduce performance but do not improve reliability.

PBFT requires a state to be maintained together, and all nodes take the same action. To do this, you need to run three basic types of protocols, including a coherency protocol, a checkpoint protocol, and a view replacement protocol. We focus on the coherence protocol that supports the day-to-day operation of the system. A coherence protocol consists of at least several phases: request, pre-prepare, and reply. Depending on the design of the protocol, it may include phases such as mutual preparation and sequence commition.

(5) Redundant Byzantine Fault Tolerance (RBFT). The core of RBFT is to use parallel instances to achieve consensus. The ordered request message sent by RBFT from a single entity to the master is used to update the ledger, but the performance (throughput, delay, etc.) of the master is periodically compared to the average of other entities. If the master is found to be underperforming, a view change occurs, assigning different instances to the role of the master. Like PBFT, RBFT requires at least 3f+1 nodes to handle f erroneous nodes.

The biggest benefit of RBFT is that the classic BFT algorithm is solved mainly because of the existence of a "primary" for sorting. If the primary is evil, the performance of the entire system will drop significantly and will not be discovered. RBFT proposes a new model: a multi-core machine parallel execution of multiple PBFT protocol instances, only the results of the master instance will be actually executed, each protocol instance will be monitored for performance and compared with the master instance, if the performance of the master is not good, the primary node of the master is considered to be a bad node and initiates a replacement process. It is estimated that the performance degradation of RBFT in the presence of BFT attacks is up to 3%.

(6) Ripple consensus algorithm. The Ripple consensus algorithm enables a group of nodes to reach consensus based on a list of special nodes. The initial special node list is like a club. To accept a new member, 51% of the club members must vote. Consensus follows 51% of the power of this core member, while outsiders have no influence. Since the club started with “centralization”, it will always be “centralized”.

4. Turing Complete Smart Contract

Smart contract is an event-driven, stateful program that runs on a replicable, shareable ledger and is able to hold assets on the ledger. The goal is to have a complex set of digital commitments with triggering conditions executed correctly by the will of the participants. Smart contracts can not only receive and store value, but also send out information and value. The whole process can be automated and intelligently executed without centrality and trust.

The trading script of the Bitcoin is the prototype of smart contract of the public chain. It belongs to the non-turing complete smart contract, which has the advantages of low complexity and light weight, and there have been no security issues in the Bitcoin network for nearly a decade, but the Bitcoin transaction verification script supports very limited functionality and is only used for payment verification. The Ethereum supports the use of Turing's complete intelligent contracts written in contractual programming languages such as Solidity and Viper, which greatly enriches the functions of smart contracts and extends the application areas of blockchain technology. However, non-professional Ethereum smart contracts are prone to security breaches. The DAO incident was caused by the security breaches in the Ethereum smart contracts that caused the Ethereum community to split.

Smart contract of the alliance chain mainly represents the Chaincode of Fabric, but its function is relatively weak. At present, it can only be used by using programming languages such as Golang, Node.js and SDK to develop applications.

In the supply chain finance field, it is necessary to fully consider privacy and security. Therefore, smart contracts in the chain needs to have powerful functions and convenient development environment, fully expand the upper layer business, and adapt to many practical application scenarios of the supply chain financial blockchain.

CS Token will design a smart contract system that is compatible with EVM and general programming language. First, it can realize the bytecode compiled by Solidity, Viper and other languages in the alliance chain. Secondly, the system will provide a set of Ethereum JSON RPC interfaces to simulate similar logic, for example, submitting a transaction and deploying an application; then, we combine the pluggable mechanism to provide a secondary development interface based on the SDK and form a smart contract code base; finally form a secure and trusted intelligence with EVM smart contract support. Contract system.

At the same time, we will build a smart contract security audit engine, automatically audit contract code, find contract vulnerabilities, and avoid events like The DAO as much as possible.

PaaS Layer

1. Payment service

The use of chain assets for payment to achieve asset transfer between enterprises, compared to traditional asset transfer, reduces the strong relationship between transaction parties and the third party institutions. The blockchain-based payment process diagram shown in Figure 15:

In the above transfer process, the two parties will first convert the assets and finances into digital assets on the blockchain, and then register the assets transfer procedures according to the methods stipulated by both parties. Once the transfer of digital assets occurs, there will be a successful payment behavior by both parties.

2. Query service

Traditional transaction records, transfer records, and details of multiple transactions are usually stored in the core trading hub. Other newly added traders or newly established trading objects, wanting to obtain detailed information of the counterparty, including transaction records, credit information, etc., need to conduct cross-system inquiry or information collection, and the cost of information acquisition is relatively high. The supply chain financial blockchain focuses on solving the transaction trust establishment mechanism between enterprises. For all the builders participating in the system, they have equal access to information (under the corresponding authority control).

(1) Bill inquiry. Support various types of combined conditions for inquiries, based on all on-chained transactions. For example, the type of the ticket, the time when the ticket is generated, and the details of the related party of the ticket.

(2) Enterprise credit inquiry. The establishment of enterprise credit information is based on the mastery of various types of accounts payable, debt collateral and other key date sensitive information related to the date of payment of the enterprise, as well as comprehensive evaluation of the third party's credit information with the company's usual transactions, forms the information database of the participating companies, constitutes the credit data of the enterprise as the agent and is provided to each other company that needs to rely on the information for the pre-trade evaluation.

(3) The data needs to be entered into the system according to the admission rules for all the transaction records involved. Usually, the transaction data entry involves the related party, the opposite end and the confirmation of the guarantee data.

(4) Traceability service. The service provides mortgage services for payments made on a transaction, such as accounts receivable from core businesses. Existing services are often complicated by the query process, and it is difficult to solve the first-level and second-level derivatives derived from them. The tracking source often needs to span multiple database terminals, which brings difficulties to the authenticity of the query verification. However, if blockchain technology is used to record all valid data records, the chain-dependent association of the blockchain itself solves the problem of data query across different departments, which brings great convenience to tracking a payment. Data validation can be resolved by traceability when subsequent derivatives need to be re-funded.

The service can also support the logistics traceability query, upload the material information to the chain, and trace the traceability of materials from raw materials, processing, production and transportation through the query service.

Application layer

1. Coin Storage

The coin wallet is a typical application based on the blockchain. Due to the limitations of the performance and use of the mobile device, it is difficult to deploy a complete blockchain node on a mobile phone or other mobile device. Therefore, it is necessary to develop a centralized application based on the blockchain to adapt the characteristics of the mobile device, design the query and transaction API interface, so that the user can use the function of the blockchain node on the mobile device, and through the centralized server the mobile device performs queries and transactions.

On the server side, the data is converted to Json format and sent to the mobile terminal, while responding to various types of queries and transaction requests of the mobile terminal. CS Token provides scan code access by converting all the available data into a two-dimensional code format, which facilitates data entry and query functions. CS Token will develop a wallet called Coin Storage, which has the following features:

(1) Cross-chain

A single blockchain project is an independent value network with network isolation issues. The collaborative operation between different blockchain projects is difficult, which greatly limits the space for blockchain projects. CS Token uses the Coin Stage to achieve value interconnection between different blockchains.

The coin wallet will support the digital assets of the Bitcoin series, the Ethereum series, the EOS series, and the CS Token series, so that users can simultaneously manage assets of different value networks.

(2) Online community

Coin Stage supports online communities and instant messaging to create an online social platform for digital assets. At the same time, Coin Stage also aggregates and pushes information on the mainstream currency media, using big data and artificial intelligence to model the topics of interest to users, accurately pushing the information of users' attention in real time, and reducing the information load of users. Coin Stage also also docks with the real-time market of the mainstream exchanges, providing market analysis functions. Users only need one APP to master the real-time price and trend of different digital assets on different platforms.