A Novel Decentralized E-Commerce Transaction System Based on Blockchain

: With the rapid development of e-commerce systems, the centralized service model gradually fails to meet the needs of SMEs. In the existing centralized e-commerce system, users’ transaction data and reputation scores are stored in a centralized cloud server, which has high storage cost, low processing efﬁciency, and the data is vulnerable to attacks and leaks. However, the existing decentralized e-commerce systems more than its reputation system to store the average credit score evaluation are receiving unfair evaluations against risk. The system of malicious nodes and no disciplinary measures, is not conducive to system development. To solve this problem, this paper proposes a blockchain-based decentralized e-commerce transaction system. The system commodity information is stored in the Interplanetary File System (IPFS) and the returned commodity addresses are stored in the blockchain to enhance the service performance. This paper proposes a reputation evaluation model based on multi-criteria decision making (MCDM), which can effectively resist unfair evaluation and collusion attacks, and proposes an incentive mechanism based on reputation value to reward and punish nodes, thus promoting the good circulation of the system. We implement the proposed system based on Ethereum. The experimental results show that the system has a small communication cost, accurately reﬂects the user’s reputation value, and has good availability and reliability.


Introduction
With the increasing popularity of Internet technology, commodity exchange has undergone profound reforms and innovations, gradually transforming from traditional offline exchange to online real-time transaction [1].The sales volume of retail e-commerce achieved totally USD 4.89 trillion in 2021 and is expected to grow to USD 6.39 trillion in 2024 [2].E-commerce has fundamentally changed people's way of life, shopping, office, medical, education, entertainment and other necessities of people's lives can be perfectly solved through the e-commerce system.The third-party network payment platform driven by the e-commerce industry has fundamentally overturned the original capital flow and brought greater convenience to people.However, current e-commerce platforms face some problems.For example, (1) the third-party organization (logistics party) is supervised by the platform only, probably leading to false logistics information and advanced signature [3]; (2) commodity data and buyer information are stored in enterprise servers centrally, which are vulnerable to be maliciously attacked, resulting in data leakage or theft; (3) Lack of incentive mechanism, buyers have an inactive enthusiasm for comments, and there are numerous false praise and comments, influencing buyers' judgment towards sellers.
Blockchain is a distributed ledger consisting of encryption algorithm, consensus mechanism and smart contract, featured by authenticity, unforgeability and traceability [4,5], whose core value lies in establishing the open and transparent rules of the algorithms, constructing a trust network [6], and ensuring the security and privacy of transactions [7].The combination of blockchain and e-commerce transaction systems can enhance the trust between users and platforms, protect the privacy of users and ensure that their evaluation cannot be modified, improving the reliability, security and credibility of the system [8,9].
In recent years, decentralized reputation systems (DRSs) have been proposed.However, researchers focus on decentralized reputation management for simple transactions rather than online shopping, and do not sufficiently consider transaction factors such as transaction time, transaction amount, and user's previous reputation score to prevent common attacks when performing reputation assessment.Therefore, this paper proposes an e-commerce transaction system based on blockchain and IPFS as well as a reputation value calculation model based on Multi-Criteria Decision Making (MCDM).Specifically, the seller stores the detailed information (name, price, etc.) of commodity in the IPFS system and obtains the return address in the chain.The buyer concludes the transaction through the smart contract [10].The logistics party updates the logistics information on the blockchain, which is then signed by the seller for evaluation.The platform can calculate and update the reputation value according to the transaction records.The main contributions of this paper are as follows.

1.
This paper proposes a new e-commerce transaction system based on blockchain.The buyer and seller temporarily store the deposit in a smart contract, and the logistics service provider updates the logistics information on blockchain [11].When the buyer receives the goods, the deposit will be automatically transferred to the seller.

2.
Unlike most decentralized e-commerce systems, this paper proposes to store the item details in IPFS and then store the item address in the blockchain.To reduce IPFS storage space, commodity records are periodically cleaned up.

3.
By investigating the common attacks on reputation evaluation, this paper proposes a reputation evaluation scheme based on simple weighting (SAW) and MCDM.By combining different factors (transaction completion time, reputation value of trading partners) to evaluate the reputation value of the participants, it can effectively defend against various attacks, such as collusion attacks and unfair evaluation attacks against reputation value.4.
We propose a blockchain-based incentive for e-commerce system to promote stable operation of the system.A good reputation is a reflection of the quality of the seller's service.Buyers with good reputation value can pay less deposit in the transaction.On the contrary, if the reputation value is low, there is a penalty.
The rest of this paper is organized as follows.Section 2 introduces the relevant work.In Section 3, the blockchain framework of the electronic transaction system and the system architecture of the paper are presented, and the proposed system is demonstrated in detail.Section 4 presents and analyzes the experimental results.Section 5 summarizes the research and puts forward the future research direction.

Related Work
Blockchain was proposed by Satoshi Nakamoto, which is a distributed ledger consisting of encryption algorithm, consensus algorithm and smart contract [12].As illustrated in Figure 1, It is a chained storage structure [13].Each block stores transaction data for a period of time, which is linked by the Hash value of the previous block and all blocks involved in the transaction can be traced.Therefore, blockchain data will not be easily changed and is applicable to be traced and is stored in tamper proof supply chain systems [14].
Smart contract is an executable program whose instances and statuses are stored in blockchains.Blockchains are trusted, traceable and tamper-proof without the need for trusted third parties that usually constitute a single point of failure [15].There is some explorations on the combination of blockchain and e-commerce.For example, the decentralized market Open Bazaar 1.0 for transaction with bitcoin was officially launched in April 2016, providing ideas to develop a secure e-commerce transaction system.Gao proposed a cross-border e-commerce system based on blockchain, which solved the problem of the difficult traceability of cross-border commodity sales by combining the blockchains features of credibility and traceability on transactions [16].Zhang et al. proposed a traceability system of agricultural product supply chain based on master-slave alliance chain.The master chain is the agricultural product supply chain, and the slave chain is the thirdparty organization supervision chain that is connected with the master chain by smart contract, which solved the problems of small storage capacity and low storage efficiency of a single blockchain [17].Zhang et al. proposed an efficient storage method based on cloud storage and dual blockchain, which encrypts and stores high-capacity data in the cloud, and saves the index in the blockchain, avoiding the limited storage capacity of blockchain and improving the speed of data chaining [18].Jiang and Chen designed a Blockchain-Supported E-Commerce Platform (BS-EP) for small-and medium-sized enterprises, which provides trust guarantee for transactions between small-and medium-sized enterprises.It also proposed three applications to solve the trade problems of enterprises based on the traceability and tamper proof characteristics of blockchain [19].Zhou et al. proposed a Decentralized Reputation System (BC-DRS) based on blockchain in e-commerce environment [20].The system stores users' comments in Interplanetary File System (IPFS), returns them to the corresponding address, and calculates the reputation value weighted by actual transaction factors.A monetary incentive mechanism was also proposed.The experimental results showed that the proposed decentralized reputation system has good usability and reliability.However, most of the proposed decentralized e-commerce systems are still focused on the transactions between buyers and sellers.That mean, they fail to record the information of third-party institutions in the chain, and there is no available corresponding reputation system to effectively prevent the attacks.Smart contract is an executable program whose instances and statuses are stored in blockchains.Blockchains are trusted, traceable and tamper-proof without the need for trusted third parties that usually constitute a single point of failure [15].There is some explorations on the combination of blockchain and e-commerce.For example, the decentralized market Open Bazaar 1.0 for transaction with bitcoin was officially launched in April 2016, providing ideas to develop a secure e-commerce transaction system.Gao proposed a cross-border e-commerce system based on blockchain, which solved the problem of the difficult traceability of cross-border commodity sales by combining the blockchains In this paper, we propose an e-commerce transaction system based on blockchain and IPFS, and establish a decentralized reputation model based on multi-criteria decision making (MCDM) method.In this system, merchants store the commodity details in the IPFS system and update the returned addresses to the blockchain to improve the efficiency of commodity data on the chain.To reduce the storage space of IPFS, we propose a mechanism to clean up the records periodically.The logistics party updates the logistics information to the blockchain for easy inquiry and supervision.In this system, a reputation evaluation scheme that fully considers transaction factors such as transaction time, transaction amount, and user reputation is proposed, and a monetary incentive mechanism is designed to promote the smooth operation of the e-commerce system.

Platform Design
Firstly, a framework combining blockchain and e-commerce system are proposed, including the node types in the system.Then, the platform architecture of e-commerce system is demonstrated and the procedure to implement it with smart contract is described in detail.

Node Types
The node types in the system are as follows: Seller: The seller is the party who sells the commodity, mainly involving retailers or enterprises.When registering identity information, the seller needs to upload relevant qualification information to blockchain.After successful registration, the seller can upload the details of commodity into the IPFS system, obtain the return address and upload it to the blockchain.Meanwhile, the status of commodity can be updated to saleable, and the buyer can be evaluated after completing the transaction.
Buyer: The seller is the party who is consuming and capable of viewing the commodity description from the platform, then confirming the purchase and changing the commodity into a lock status, as well as signing for the commodity and evaluating the seller.
Logistics: The logistics party collects the storage and logistics information of commodity and publicizes it to the blockchain for future accountability [21].

Conceptual Framework
The frameworks of blockchain are consisted of six layers, including the data layer, network layer, consensus layer, incentive layer, contract layer and application layer.Based on this framework, this paper proposes a conceptual framework of blockchain that can be applied to e-commerce system, as shown in Figure 2.
Appl.Sci.2022, 12, x FOR PEER REVIEW 4 of 16 IPFS system and update the returned addresses to the blockchain to improve the efficiency of commodity data on the chain.To reduce the storage space of IPFS, we propose a mechanism to clean up the records periodically.The logistics party updates the logistics information to the blockchain for easy inquiry and supervision.In this system, a reputation evaluation scheme that fully considers transaction factors such as transaction time, transaction amount, and user reputation is proposed, and a monetary incentive mechanism is designed to promote the smooth operation of the e-commerce system.

Platform Design
Firstly, a framework combining blockchain and e-commerce system are proposed, including the node types in the system.Then, the platform architecture of e-commerce system is demonstrated and the procedure to implement it with smart contract is described in detail.

Node Types
The node types in the system are as follows: Seller: The seller is the party who sells the commodity, mainly involving retailers or enterprises.When registering identity information, the seller needs to upload relevant qualification information to blockchain.After successful registration, the seller can upload the details of commodity into the IPFS system, obtain the return address and upload it to the blockchain.Meanwhile, the status of commodity can be updated to saleable, and the buyer can be evaluated after completing the transaction.
Buyer: The seller is the party who is consuming and capable of viewing the commodity description from the platform, then confirming the purchase and changing the commodity into a lock status, as well as signing for the commodity and evaluating the seller.
Logistics: The logistics party collects the storage and logistics information of commodity and publicizes it to the blockchain for future accountability [21].

Conceptual Framework
The frameworks of blockchain are consisted of six layers, including the data layer, network layer, consensus layer, incentive layer, contract layer and application layer.Based on this framework, this paper proposes a conceptual framework of blockchain that can be applied to e-commerce system, as shown in Figure 2.  As can be seen from Figure 2, the data layer is the underlying data structure of the blockchain, including data block, chain structure, Hash function, asymmetric encryp-tion [22], timestamp and Merkel tree [23], which is capable of realizing data storage and ensuring the security of accounts and transactions.The network layer is composed of point-to-point (P2P) network [24], transmission mechanism and authentication mechanism to maintain the communication between blockchain.The consensus layer is composed of consensus algorithm and consensus mechanism, promoting the nodes to reach a consensus in the chain.This paper adopts Ethereum ethash consensus mechanism [25].The contract layer encapsulates various codes and smart contracts to ensure the automatic execution of instructions.In the incentive layer, this paper proposes a reputation value incentive mechanism based on MCDM to reward and punish the nodes and improve chain operation efficiency based on Ethereum Gas incentive mechanism.As the most important layer in the framework, the application layer provides services for nodes through the application layer blockchain, including information storage, logistics information chaining and credit evaluation.As can be seen from Figure 2, the data layer is the underlying data structure of the blockchain, including data block, chain structure, Hash function, asymmetric encryption [22], timestamp and Merkel tree [23], which is capable of realizing data storage and ensuring the security of accounts and transactions.The network layer is composed of pointto-point (P2P) network [24], transmission mechanism and authentication mechanism to maintain the communication between blockchain.The consensus layer is composed of consensus algorithm and consensus mechanism, promoting the nodes to reach a consensus in the chain.This paper adopts Ethereum ethash consensus mechanism [25].The contract layer encapsulates various codes and smart contracts to ensure the automatic execution of instructions.In the incentive layer, this paper proposes a reputation value incentive mechanism based on MCDM to reward and punish the nodes and improve chain operation efficiency based on Ethereum Gas incentive mechanism.As the most important layer in the framework, the application layer provides services for nodes through the application layer blockchain, including information storage, logistics information chaining and credit evaluation.

Information Upload Stage
1.The seller sends the detailed information of commodity to IPFS, including the name, country of origin, specifications, and then IPFS returns an address.2. The seller launches the address and basic information of the commodity into the platform, including the name, unit price, and pay a certain deposit.The seller sends the detailed information of commodity to IPFS, including the name, country of origin, specifications, and then IPFS returns an address.

2.
The seller launches the address and basic information of the commodity into the platform, including the name, unit price, and pay a certain deposit.

3.
The smart contract uploads the address and information to the blockchain, and the deposit is stored in the smart contract.

4.
Blockchain feeds back the upload status information.Based on the price adjustment of commodity, the deposit is deposited in the smart contract.If an accident happens during the transaction, the buyer can get compensation from the deposit first.During the sale of commodity, if the commodity needs to be taken off from platform due to selling out, the seller can take the initiative to cancel the smart contract with unconcluded-transaction, and the rest of the deposit will be returned to seller's account except for the gas consumed.The introduction of deposit mechanism increases the cost of false transactions of sellers and effectively prevent the false transactions.
The buyer can view commodity's information and status through the interface on the platform, and decide whether to buy by referring the reputation score of seller.

2.
The buyer confirms the purchase and pays a certain deposit (the deposit will be transferred to the seller's account as the fund for purchasing commodity after the completion of the contract) and deposited in the smart contract.

3.
The smart contract sends the transaction action to blockchain.

4.
Blockchain feeds back the upload status information.
The logistics party checks the status of commodity.If the transaction is completed, the commodity will be transported.

2.
The logistics party uploads the transportation status to the platform and calls the smart contract to store in the chain.

3.
After receiving the commodity, the buyer can confirm the acceptance.At this time, the deposit stored in smart contract will be transferred to seller and the contract will be closed.User can also refuse to accept the commodity.Then, the deposit will deduct the cost of gas and returned to each account.

4.
The smart contract sends the transaction action to blockchain.

5.
Blockchain feeds back the upload status information.

Evaluation Stage
During the evaluation stage, the buyer and the seller can submit comments and evaluations to platform.

1.
After completing the transaction, the buyer and the seller can upload their evaluation of transaction to platform.

2.
The platform calls the smart contract and publishes the reputation score to blockchain.

3.
The blockchain stores reputation score and feeds back the successful evaluation to platform.
As shown in Figure 4, the system completes the transaction through four stages [26].

Reputation Evaluation Scheme
The definition on reputation is an opinion on intentions and norms of past behavior of one party [27].Assuming that the transactions of users in a cycle period are sufficient to reflect his reputation value, and the rest transactions have little influence on them, this paper proposes a reputation model.The model can reflect users' reputation value based on their transactions in a cycle.The platform can give higher priority to sellers with good reputation in the search process and supervise and sanction buyers with low reputation, and its incentive mechanism based on reputation value is conducive to the formation of a virtuous online shopping cycle.

Calculation of Node Reputation Value
After completing the transaction, the buyer and the seller can evaluate mutually according to smart contract.However, it is unreasonable to calculate the node reputation value by only relying on this evaluation.In the process of transaction, in addition to the subjective feelings of the buyer, time of transaction, amount of transaction and reputation score of both parties also play important roles.Therefore, this paper proposes a method based on SAW and MCDM.The proposed method calculates the node reputation value according to the difference between period of node transaction and time of transaction completion, amount involved in transaction, reputation value of transaction partner and the evaluation of buyers [28].Obviously, the earlier the transaction is completed, the higher reputation value of participating users.The more transaction amount, the higher reputation value of transaction user.In addition, the reputation of transaction partners is also a positive evaluation standard.

Reputation Evaluation Scheme
The definition on reputation is an opinion on intentions and norms of past behavior of one party [27].Assuming that the transactions of users in a cycle period are sufficient For a cluster with n* nodes (y 1 , y 2 , y 3 , . . .y n ), each node has a i (i ∈ 1, 2, 3, . . . ) transactions.For transaction j record of y i has the time interval t ij and the transaction amount c (the difference between the transaction period and the actual transaction time, t 1 is the deadline of each transaction, t 2 is the sign-off time of the transaction, t ij = t 1 − t 2 ), which can be normalized by: where t max ij and t min ij represent the maximum and minimum value of the historical transaction time difference of node y i in the cycle period, respectively; w max ij and w min ij represent the maximum and minimum value of historical transaction amount of node y i in the cycle period, respectively.If the transaction time exceeds the time limit, the transaction is cancelled and the deposit is returned to each account, meaning that t ij cannot be negative.
Recording c ij as the reputation value of the other party node in the jth transaction, we perform the normalization operation by: where c max is the historical maximum reputation value of a node.If there is no historical maximum reputation value with node of transaction partner, then c ij is recorded as 1.
Recording s as the score of the other party node in the jth transaction (the score value is within 0-10), we have: Recording the reputation value of node as R i , and ϕ ij as the influence of a single transaction on reputation value of the node, we have: where α, β, γ and δ are the weights that are adjusted according to the actual needs, which satisfies α + β + γ + δ = 1; T ij is a collusion factor, whose function is to prevent excess influence on the reputation of transaction partners from one node, and to prevent two nodes from colluding with each other to update a higher reputation.Therefore: where θ is the adjustment coefficient, and num ij is the same transaction number of node i in the jth transaction in the cycle period.If the two parties have the same transaction users and the same transaction commodity, it will be judged as the same transaction.By taking Equation ( 7) into Equation ( 6), the reputation value of the node can be obtained.The pseudo-code for calculating reputation value is shown in Algorithm 1.

Incentive Mechanism of Reputation Value
As shown in Figure 3, sellers with higher reputation value are more likely to be recommended by the platform and have more advantages in the competition.To obtain higher reputation value, sellers will choose faster logistics and better commodity quality to improve buyer's evaluation.For buyers, buyers with higher reputation need to pay less deposits stored in smart contracts, whose reputation value incentive mechanism is beneficial to form a positive online shopping cycle.for i = 1 to a i do 3: 6: end for 7: return R i

Experimental Results and Analysis
This section analyzes the functionality and performance of the proposed system, and explains its function integrity and performance by the comparison with other similar systems.Also, the reliability and security of the proposed e-commerce system are analyzed.The experimental configuration information is shown in Table 1.This paper adopts Geth to build and test private blockchain.The system proposed in this paper was arranged in the private Quorum, written in Solidity language and with version 0.8.4,which was tested by Remix.

Test and Analysis of Smart Contract
Before testing, it is necessary to compile and arrange the smart contract.The smart contract on Remix platform was compiled and tested.The smart contract was deployed as soon as being compiled.The account in Ganache was applied to imitate the transaction account.The compilation result is shown in Figure 5.With the transaction, the currency of transaction account would change, and the transaction could be concluded normally.
After completing the transaction, the transaction information was stored in the chain.As shown in Figure 6, the logistics information was stored in the chain through hash encryption.
The proposed transaction system could realize the function of chaining and storage of transaction and key information, and meet the general requirements of e-commerce transaction system.

Functional Comparison of the State-of-Art E-Commerce Systems
The proposed system was compared with the state-of-art systems.The results are shown in Table 2.
Gao et al. proposed a cross-border e-commerce-driven foreign trade research based on blockchain [16].However, the operation speed was slow due to the processing of large amount of data to be stored on chain.
Jiang et al. describes an e-commerce platform for small-and medium-sized enterprises without an incentive mechanism [19].After completing the transaction, the transaction information was stored in the chain.As shown in Figure 6, the logistics information was stored in the chain through hash encryption.The proposed transaction system could realize the function of chaining and storage of transaction and key information, and meet the general requirements of e-commerce transaction system.

Functional Comparison of the State-of-Art E-Commerce Systems
The proposed system was compared with the state-of-art systems.The results are shown in Table 2.

Functional Characteristic
Ref. [16] Ref. [19] Ref. [20] Ref. [29] This Gao et al. proposed a cross-border e-commerce-driven foreign trade research based on blockchain [16].However, the operation speed was slow due to the processing of large amount of data to be stored on chain.
Jiang et al. describes an e-commerce platform for small-and medium-sized enterprises without an incentive mechanism [19].
Zhou et al. describes a decentralized e-commerce system in an e-commerce environment based on blockchain, with no introduction on third-party institutions except buyers and sellers, and more improvements are required for supply and logistics [20].
Lahkani et al. proposed a supply chain finance based on blockchain, while fails to perform credit evaluation.By comparison, the system proposed in the paper could satisfy the above requirements and show a good functionality [29].
Zhou et al. describes a decentralized e-commerce system in an e-commerce environment based on blockchain, with no introduction on third-party institutions except buyers and sellers, and more improvements are required for supply and logistics [20].
Lahkani et al. proposed a supply chain finance based on blockchain, while fails to perform credit evaluation.By comparison, the system proposed in the paper could satisfy the above requirements and show a good functionality [29].

Performance Analysis and Test of the Proposed System
This section presents the testing of the communication overhead of the proposed system, and analyzes the gas consumption and time cost of the system to evaluate its performance.

Analysis of Gas Consumption
Ethereum executes commands step by step according to smart contract during the transaction.To perform each step, there exists the consumption called gas [30].Gas Limit is the maximum available amount of gas for a transaction execution.However, if a transaction execution requires more gas than the gas Limit, the System will emit an out-of-gas exception immediately, and all executed operations will be reverted [31].The user loses all of Gas.For users, smart contracts with low gas consumption are more popular.This research arranged the smart contract on Remix to predict the consumption of gas, and compared the proposed system with the BC-DRS and BS-EP.The results are shown in Figure 7.
exception immediately, and all executed operations will be reverted [31].The user loses all of Gas.For users, smart contracts with low gas consumption are more popular.This research arranged the smart contract on Remix to predict the consumption of gas, and compared the proposed system with the BC-DRS and BS-EP.The results are shown in Figure 7.As can be found from Figure 7, the gas value consumed by our contract confirmation purchase functions was minimum.For smart contracts, upload numerous data consumed more gas than simply signing the transactions.The systems of Literature BC-DRS and BS-EP shall upload numerous data in upload stage of commodity, so that the cost of gas was high.The proposed system stored the IPFS address of commodity information on blockchain.The address was a fixed size bitstream.Therefore, the cost of gas processing address data would not increase, so that the upload time of commodity information was less.the gas costs for loops are higher than that for other functions in smart contracts [31,32].In this paper, the smart contract used is optimized so that it still has good functionality and reduces gas consumption even with fewer loop functions.The BC-DRS had no evaluation function, so that it consumed less gas.In general, the proposed system had more comprehensive functions and less gas consumption.As can be found from Figure 7, the gas value consumed by our contract confirmation purchase functions was minimum.For smart contracts, upload numerous data consumed more gas than simply signing the transactions.The systems of Literature BC-DRS and BS-EP shall upload numerous data in upload stage of commodity, so that the cost of gas was high.The proposed system stored the IPFS address of commodity information on blockchain.The address was a fixed size bitstream.Therefore, the cost of gas processing address data would not increase, so that the upload time of commodity information was less.the gas costs for loops are higher than that for other functions in smart contracts [31,32].In this paper, the smart contract used is optimized so that it still has good functionality and reduces gas consumption even with fewer loop functions.The BC-DRS had no evaluation function, so that it consumed less gas.In general, the proposed system had more comprehensive functions and less gas consumption.

Analysis of Time Consumption
This paper takes the time taken by Ethereum blockchain to call smart contract as dependent variable and different block length as independent variable, and compares it with the BC-DRS and BS-EP.The results are shown in Figure 8.
Through analyzing the experimental results, we can draw the following conclusions.

1.
The time cost of the three functions of the proposed system increases slightly as the increase in the number of blocks.Smart contracts need to upload information to the blockchain.Therefore, as number of blocks increase, the consumption of the proposed system increases.2.
The proposed system consumes the most time in accepting and evaluation function.
The accepting and evaluation function of the system needs to call smart contract to realize accepting in function and upload the information to blockchain.Therefore, compared with the information upload and transaction completion functions, it consumes the most time.

3.
Compared to storing massive information data into blockchain, we only store fixed size addresses of product information.Therefore the time consumption of the proposed system is low.The amount of information in the confirmation of purchase and the signing and evaluation stages is relatively small.Therefore, the system time consumption is low.Therefore, according to the above results in cost and time cost, we can conclude that the proposed system has good usability for online shopping.Through analyzing the experimental results, we can draw the following conclusions.
1.The time cost of the three functions of the proposed system increases slightly as the increase in the number of blocks.Smart contracts need to upload information to the blockchain.Therefore, as number of blocks increase, the consumption of the proposed system increases.2. The proposed system consumes the most time in accepting and evaluation function.
The accepting and evaluation function of the system needs to call smart contract to realize accepting in function and upload the information to blockchain.Therefore, compared with the information upload and transaction completion functions, it consumes the most time.3. Compared to storing massive information data into blockchain, we only store fixed

Reliability and Safety Analysis
The current reputation evaluation systems are mostly based on average score.There are numerous good and malicious comments in the system, which is difficult to resist collusive attacks and unfair attacks.To improve the reliability and security of the system, this paper proposes a reputation evaluation method based on SAW and MCDM, as demonstrated in Section 3.4.1.We randomly generated the transaction records of users a, b, c by Python, including transaction period, transaction completion time and transaction amount, The reputation of users was evaluated.The results are shown in Figure 9.
are numerous good and malicious comments in the system, which is difficult to resist collusive attacks and unfair attacks.To improve the reliability and security of the system, this paper proposes a reputation evaluation method based on SAW and MCDM, as demonstrated in Section 3.4.1.We randomly generated the transaction records of users a, b, c by Python, including transaction period, transaction completion time and transaction amount, The reputation of users was evaluated.The results are shown in Figure 9. Figure 9 suggests that with the increase in the number of transactions, the reputation value of user tends to be stable.That is, the proposed reputation value calculation model could effectively reflect the reputation value of user.Sellers with high reputation value have high priority in the search results and buyers with low reputation value will be supervised by the platform for unreasonable return behavior.In addition, the transaction system with the reputation evaluation scheme is capable of resisting the following attacks: 1. Unfair evaluation attack.The attack means that the malicious evaluator deliberately places an unfair evaluation to reduce the reputation value of transaction partner.In the reputation calculation model proposed in this paper, the reputation value is not only connected with the evaluation, but also related to the completion time of transaction, amount involved and reputation value of counterparty.The single malicious evaluation of malicious attacker has little influence, while the reputation value of malicious attacker will be influenced.When its reputation value is too low, malicious attacker will be subjected to system supervision and sanctions.2. Reputation accumulation attack.To avoid the node accumulating rights and interests for a long time, the age of currency owned by the node will be limited generally in blockchain system.The proposed system selects transactions in a certain period according to the timeliness to reflect the current reputation value of the node, aiming at avoiding the node accumulating too high reputation value.3. Collusive attack.It means that multiple users collusively give good comments to each other to obtain high reputation value.This paper proposes a collusion factor to avoid Figure 9 suggests that with the increase in the number of transactions, the reputation value of user tends to be stable.That is, the proposed reputation value calculation model could effectively reflect the reputation value of user.Sellers with high reputation value have high priority in the search results and buyers with low reputation value will be supervised by the platform for unreasonable return behavior.In addition, the transaction system with the reputation evaluation scheme is capable of resisting the following attacks: 1.
Unfair evaluation attack.The attack means that the malicious evaluator deliberately places an unfair evaluation to reduce the reputation value of transaction partner.
In the reputation calculation model proposed in this paper, the reputation value is not only connected with the evaluation, but also related to the completion time of transaction, amount involved and reputation value of counterparty.The single malicious evaluation of malicious attacker has little influence, while the reputation value of malicious attacker will be influenced.When its reputation value is too low, malicious attacker will be subjected to system supervision and sanctions.

2.
Reputation accumulation attack.To avoid the node accumulating rights and interests for a long time, the age of currency owned by the node will be limited generally in blockchain system.The proposed system selects transactions in a certain period according to the timeliness to reflect the current reputation value of the node, aiming at avoiding the node accumulating too high reputation value.3.
Collusive attack.It means that multiple users collusively give good comments to each other to obtain high reputation value.This paper proposes a collusion factor to avoid collusion attack, as shown in Equation (7).With the increase of node transactions, the interaction degree of nodes gets lower, effectively avoiding the collusion between malicious nodes.

Conclusions
In recent years, researchers have proposed blockchain-based decentralized e-commerce systems.However, no reputation value calculation method and incentive mechanism have been proposed to match it, and the motivation of nodes in the system is low, which is not conducive to the long-term and smooth development of nodes.In this paper, we propose a multi-criteria decision-based reputation evaluation scheme to evaluate merchants and

Figure 2 .
Figure 2. E-commerce system framework based on blockchain.Figure 2. E-commerce system framework based on blockchain.

Figure 2 .
Figure 2. E-commerce system framework based on blockchain.Figure 2. E-commerce system framework based on blockchain.

Figure 3
Figure 3 shows the architecture established for e-commerce platform, including four stages, i.e., information upload stage, purchase confirmation stage, logistics stage and evaluation stage.

Figure 3 Figure 3 .
Figure 3 shows the architecture established for e-commerce platform, including four stages, i.e., information upload stage, purchase confirmation stage, logistics stage and evaluation stage.

Figure 3 .
Figure 3. E-commerce system platform architecture.3.3.1.Information Upload Stage 1.The seller sends the detailed information of commodity to IPFS, including the name, country of origin, specifications, and then IPFS returns an address.2.The seller launches the address and basic information of the commodity into the platform, including the name, unit price, and pay a certain deposit.3.The smart contract uploads the address and information to the blockchain, and the deposit is stored in the smart contract.

1
Update product Information 5.2 Return storage address

Figure 4 .
Figure 4.The UML Sequence diagram of e-commerce transaction system.

Figure 4 .
Figure 4.The UML Sequence diagram of e-commerce transaction system.

Algorithm 1 :
Reputation Assessment Input: Transaction Records Output: Reputation 1: for i = 1 to y n do 2:

4. 1 . 1 .
Test and Analysis of Smart ContractBefore testing, it is necessary to compile and arrange the smart contract.The smart contract on Remix platform was compiled and tested.The smart contract was deployed as soon as being compiled.The account in Ganache was applied to imitate the transaction account.The compilation result is shown in Figure5.With the transaction, the currency of transaction account would change, and the transaction could be concluded normally.

Figure 5 .
Figure 5. Smart contract compilation and testing: (a) Smart contract compilation tests; (b) Ganache simulates account token changes.

Figure 5 .
Figure 5. Smart contract compilation and testing: (a) Smart contract compilation tests; (b) Ganache simulates account token changes.

Figure 6 .
Figure 6.Logistics information encryption on the chain.

Figure 6 .
Figure 6.Logistics information encryption on the chain.

Figure 7 .
Figure 7.Comparison of gas consumption in smart contract.

Figure 7 .
Figure 7.Comparison of gas consumption in smart contract.

16 4. 2 . 2 .Figure 8 .
Figure 8.The time cost of invoking smart contracts: (a) Time cost of commodity upload function; (b) Identify the time cost of purchasing features; (c) Time overhead of sign-in and evaluation functions.

Figure 8 .
Figure 8.The time cost of invoking smart contracts: (a) Time cost of commodity upload function; (b) Identify the time cost of purchasing features; (c) Time overhead of sign-in and evaluation functions.

Table 1 .
Experimental configuration information.

Table 2 .
Functional comparison of e-commerce system.

Table 2 .
Functional comparison of e-commerce system.