## 5 Case Study and Experiments
### Simulation Results  
In this work, we deployed the compiled smart contract on the Ethereum blockchain to perform the inventory risk assessment function. In order to evaluate the blockchain system, we record the time, cost, and CPU (Central Processing Unit) usage when the smart contract performs the function. Our experiments were performed on two types of blockchain networks. One is the test chain, and the other is the private chain. On the test chain, the test network of [PERSON] and Ropsten was selected for experimentation. On the private chain, we choose the system go-ethereum provided by the Ethereum official website to develop the experimental environment. The consensus mechanisms used by [PERSON] and Ropsten on the test chain are different. Therefore, their performance is not the same. Table 1 illustrates a comparison of the test chain. The block output speed is about 15 s.  
First, we deployed the designed smart contract on the Ethereum Rinkeby and Ropsten testnets for functional testing. Figure 9 shows the time trend of each transaction. It can be found that Ropsten's time fluctuates greatly. Ropsten's consensus mechanism is PoW \begin{table}
\begin{tabular}{c c c c c} \hline
**Network** & **Network ID** & **Consensus** & **Mining** & **Block Time** & **Status** \\ \hline
**Ethereum Main** & 1 & PoW & Yes & 15 s & Available \\ \hline
**Morden** & 2 & PoW & Yes & 15 s & Stop \\ \hline
**Ropsten** & 3 & PoW & Yes & 15 s & Available \\ \hline
**Rinkeby** & 4 & PoA & No & 15 s & Available \\ \hline
**Kovan** & 42 & PoA & No & 4 s & Available \\ \hline \end{tabular}
\end{table} 
Table 1: The Ethereum testing network. Figure 7: The example of the “Oraclize” smart contract. (Proof of Work), in which the transaction speed is quite slow and unstable. Therefore, it is not as good as PoA (Proof of Authority) in transaction speed. Figure 8: An example of the developed smart contract for adaptive supply chain management. Subsequently, we calculate the cost of the smart contract deployed to the blockchain and the inventory risk assessment function on the test chain, as shown in Figure 10. The cost calculation method is to multiply the Transaction Gas by the Gas price plus the cost required to execute the Oraclize function. In the inventory risk assessment function, we use the Oraclize function six times to retrieve the data we need, and each transaction requires an extra 0.06 Ether fee. We can find that the computational cost is not very different between the functional tests performed on the Ethereum and Rinkeby and Ropsten networks. Table 2 presents the values of time and cost of smart-contract experiments in the test environment. In terms of execution time, it can be clearly found that the result of the Rinkeby testnet is better than the Ropsten testnet. The consumption value required for transaction gas execution is not much different. In addition, the gas price is calculated based on the value on 2020/8/10. We need to retrieve the external data 6 times to perform the inventory risk assessment function by using the Oraclize function. Therefore, the cost consumed is 0.06 Ether. Finally, we add up the complete consumption value and calculate it on 8/10 2020. On that day, 1 Ether was converted to USD395.42. Figure 10: Performance of transaction cost on the Ropsten and Rinkeby testnet. Figure 9: Performance of callback time on the Ropsten and Rinkeby testnet. In the next part, we examine the experimental result of the private chain we established. As shown in Figure 11, the construction on the private chain requires the establishment of a genesis block as the original zeroth block. The private chain utilizes the PoW (Proof of Work) method as its consensus mechanism. First, we deployed the smart contract on the private chain for functional testing. Figure 12 shows the time trend of each transaction. Since the difficulty level of mining on the private chain can be set by ourselves, it is much faster than the test chain in terms of block verification.