# Design of Supply Chain System Based on Blockchain Technology
## 4 System Construction
### Rules for System Interaction
#### 4.3.1 Trade Chain Platform Interaction Rules  
The interaction of the trade chain platform involves the roles of producer, consumer, and trade smart contract. A complete transaction process has three stages: 1. The consumer calls a trade smart contract to initiate the transaction; 2. The trade smart contract verifies the request, and the transaction information is sent to the producer's account; 3. After the transaction is completed, the trade smart contract determines the results.  
We next analyze the information interaction of the trading process.  
(a) Transaction initiation phase. When initiating a transaction, consumers must send the transaction product, corresponding producer, transaction funds, and expected completion time to the smart contract account. The interaction content is as follows: \([id_{C},jur_{C},C\to P,tab_{C}(w,v,a,dl)]\), where \(id_{C}\) is the consumer account information, \(jur_{C}\) is the consumer transaction permission information, \(C\)\(\rightarrow\)\(P\) indicates that the transaction is initiated by consumer C and executed by producer P, \(tab_{C}\) is the information of the transaction, \(w\) is the consumer's target product, \(v\) denotes the funds for the transaction, \(a\) is the agreement for the transaction, and \(dl\) is the transaction completion period given by the consumer.  
(b) Smart contract verification phase. The trade smart contract verifies the transaction content upon receiving the request. After verification, the trade smart contract sends the transaction content to the producer account. The interaction content is \([T\to P,inf_{T}(tab_{C},st)]\), where \(T\)\(\rightarrow\)\(P\) indicates that the information is sent to the producer by the trade smart contract; and \(infT\) is the content of the transaction information sent by the trade smart contract to the producer, where \(tab_{C}\) is the transaction information sent by the consumer to the trade smart contract, and \(st\) is the time when the smart contract receives the request.  
(c) Transaction result determination phase. After the transaction is completed, the trade smart contract must determine the transaction completion status. If the producer delivers the product on time, then the trade smart contract forwards the funds to the producer's account and sends the transaction result information to the producer. The content of the information is \([T\to P,tab_{T}(v,ct,N)]\), where \(T\)\(\rightarrow\)\(P\) indicates that the information is sent by the trade smart contract to the producer, \(tab_{T}\) is the content of the information, \(v\) is the amount of funds, \(ct\) is the transaction completion time, and \(N\) indicates that the transaction is completed on time and is normal.  
If the producer fails to deliver a product on time, then the trade smart contract returns part of the funds to the consumer according to the agreement between the parties, sends the remaining funds to the producer's account, and sends the transaction result information to the producer. The content of the information is \([T\to P,tab_{T}(v^{\prime},ct,od)]\), where \(v^{\prime}\) is the remaining part of the original funds after deducting part, and \(od\) indicates that the transaction is overdue.