Delegated Proof of Reputation Consensus Mechanism for Blockchain-Enabled Distributed Carbon Emission Trading System

Most carbon Emission Trading Systems (ETS) rely on a centralized system to manage the transactional tasks, and are vulnerable to security threats. This article proposes a Blockchain-enabled Distributed ETS (BD-ETS) to improve the security and efficiency of the system. The BD-ETS transforms the centralized Carbon Emissions Permit (CEP) trading mode to a distributed trading system in which the trading mode is based on a smart contract performed in Hyperledger Fabric. In a smart contract, every transaction considers both the offer price and reputation value of the emitting enterprises. The voting power of the emitting enterprise is determined by its reputation value, which stems from their contributions to carbon emission reduction. To achieve consistency of every node in the CEP transactions, we propose a Delegated Proof of Reputation (DPoR) consensus mechanism. Compared to the enhanced Delegated Proof of Stake, the DPoR decreases the attack intention of malicious enterprises and performs better in finding malicious miners faster, thus improving the security of the BD-ETS. A case study and numerical simulations are developed to illustrate how the CEP trading functions, and to validate the DPoR mechanism.


I. INTRODUCTION
Global issues such as population explosion, ecological destruction, and greenhouse gas emissions, contribute significantly to global warming [1], [2]. In response, many international organizations and meetings have sought to establish an emissions trading system (ETS) [3], [4] to reduce carbon emissions [5]. The ETS, performing as an authorized center, formulates a target of carbon emissions reduction to manage the Carbon Emission Permit (CEP) trading. After inspecting the emitting enterprises and setting the baseline, the ETS distributes the CEP to the emitting enterprises through allocation and auctions. The emitting enterprises can trade the CEP with each other to write off the carbon emissions [6]- [9].
While a centralized structure containing a central node is administratively expedient, this system poses several The associate editor coordinating the review of this manuscript and approving it for publication was Shagufta Henna. challenges: communication efficiency and data storage [10]. Relying on a centralized system decreases operational efficiency as the center has to handle nearly every trading transaction. Further, the data of CEP trading and user information are stored in a single center, which makes it vulnerable. Once the security of the center is compromised, data integrity and user privacy cannot be ensured. A decentralized system can avoid the full extent of damage caused by a single violent attack and improves the responsiveness of management, albeit the issues of privacy, consensus process, and security still prevail [11].
With the success of the Bitcoin trading system [12], the blockchain technique based distributed system has attracted much research attention. The blockchain is a data structure used to record transaction accounts, which shows transparency, anonymity, untouchable modification and the performance of distributed fault tolerance [13]- [16]. The blockchain technology can store complete data records reliably yet allowing users to view the data records securely.
This data transparency can encourage the emitting enterprises to reduce their carbon emissions [17]. Also, the blockchain approach uses public pseudonymous address and encrypted signatures to ensure anonymity [18], [19]. Third, we can trace the contracts of the participants and prevent the trade data from being maliciously monitored and alternated by adopting high-end digital signatures and hash algorithms [20]. Fourth, a consensus mechanism can realize transactions verification and confirmation with reduced latency [21], and avoid faulty information being disseminated [22]. Finally, the blockchain approach is suitable for low-frequency transactions such as transnational transfers and CEP transactions. For these reasons, applying blockchain techniques on the ETS has the miners will choose the contracts piqued scholarly attention [23].
Khaqqi et al. [24] proposed a novel ETS incorporating blockchain technology and reputation value system to separately handle the monitoring and verification issues and improve ETS efficacy. However, the distributed form of the blockchain nodes in their proposed ETS is unclear and it lacks a consensus mechanism, which renders all nodes to reach the consistency of CEP transactions. Kawasmi et al. [25] proposed a bitcoin-based decentralized carbon emissions trading infrastructure model. Kawasmi et al.'s model combines blockchain and carbon emissions trading. Blockchain technology protects data privacy, ensures a secured distributed system by using the system-of-systems engineering principles, and achieves the consistency of nodes by introducing a Proof of Work (PoW) consensus mechanism [26], [27]. However, the PoW consensus mechanism in a bitcoin blockchain has high latency and consumes much computing power (and generates much waste in the process) [27], [28]. Therefore, it is difficult and not necessary to apply the same mechanism to ensure the security of the ETS. In the Proof of Stake (PoS) [29] and Delegated Proof of Stake (DPoS) consensus mechanisms [30], [31], collusion between the high-stake nodes can generate malicious miners. To overcome this concern, Kang et al. [32] proposed an enhanced DPoS consensus mechanism to tackle the collusion issues in miner voting and block verification. In the enhanced DPoS, equal voting power of vehicles and multi-weighted subjective logic opinion [33] effectively decrease the reputation value of the malicious miners when they propagate wrong information. An incentive contract designed by the block manager increases the probability of correct block verification. Given the features of interaction between the emitting enterprises and the ETS, this distributed architecture can be applied to carbon emission tradings. However, in the enhanced DPoS consensus mechanism, the malicious voters may launch sustained attacks at the source, with little cost and time.
Thus, we design a distributed architecture for using blockchain technology in future ETS. The trading mode based on smart contract improves trading efficiency. Further, there is a need to have a consensus mechanism to prevent the malicious voters from launching repeated attacks on the system.
Our paper therefore proposes a Blockchain-based Distributed Emission Trading System (BD-ETS) model for carbon emissions reduction. The main work and contributions of this article are the CEP trading scheme and consensus mechanism. The novelty of the BD-ETS is to leverage the reputation value of the emitting enterprises (RoEE), which are determined by their contributions in emissions reduction. In particular, we design a CEP trading scheme and the corresponding smart contract based on the Go programming language. After satisfying the predefined conditions, the smart contract is triggered. We then introduce a reputation based transaction fee mechanism into the trading scheme to lift the efficiency of emissions reduction. When the emitting enterprises initiate their transactions, they pay a transaction fee based on their RoEE. The lower the RoEE, the more is the transaction fee.
For the consensus part, we propose a Delegated Proof of Reputation (DPoR) consensus mechanism to secure the BD-ETS. The voting power of the emitting enterprises is ruled by their RoEE. The higher the RoEE, the greater is the voting power. The emitting enterprises vote for the miner candidates based on past interactions [32] and the elected miners will participate in transactions packing and information validation.
This article is set as follows. Section II establishes a BD-ETS model with operation process. In Section III, we design a smart contract for CEP trading and propose a reputation-based transaction fee scheme. Section IV presents the ideal origin and details of the DPoR consensus mechanism. Section V presents a case study of a trading process and transaction fee scheme. Section VI discusses the results of the numerical simulation of the DPoR. Section VII concludes the paper.

II. BD-ETS MODEL
A. SYSTEM MODEL Fig. 1 presents the BD-ETS model. In the BD-ETS, centralized carbon trading management takes place by the direct trading between the emitting enterprises. This gives them greater autonomy in carbon trading. Without a central node's supervision and verification, the transactions need to be agreed by all emitting enterprises. The model comprises four parts: information interaction, CEP trading, miners voting, and block verification.

1) ENVIRONMENT SETUP
Environment initialization of the BD-ETS includes the CEP generation, CEP allocation, demand change of CEP, and smart meters setup.
The target of the carbon emissions reduction determines the total allowable emissions at the start of the next period. Every emitting enterprise holds a certain amount of CEP to write off their carbon emissions. Each year, the total emissions of all the enterprises globally is computed and a CEP is generated to cap the overall emissions for the next period. This CEP is then re-distributed to the emitting enterprises. The general CEP allocation method is divided into two parts. The main allocation method is free allocation. It is mainly determined by the emissions situation of the past period and industry type. The emission situation can be detected by the smart meters installed within the emitting enterprises. The other method is by auctioning; this method has increased in the past years. Within the validity period of the CEP, the enterprises may have demanded a change of the CEP, such as supernormal business conditions. When the enterprises want to increase their production capacity to cope with market demand during this period which could increase their carbon emissions accordingly, they would have to then buy additional CEP. Similarly, some enterprises may have invested in abatement technology and have optimized their production processes. Doing so helps these enterprises to reduce their dependence on the CEP allocated at the start of the period.

2) INFORMATION INTERACTION
In the BD-ETS, there are two actors: (i) emitting enterprises and (ii) miner candidates. The emitting enterprises are the light nodes in the BD-ETS. They trade the CEP according to their demands and download the blocks from the blockchain to check their behavior records and transaction results. The miner candidates are the full nodes. They are responsible for information provision, transactions validating, and maintaining the blocks in the BD-ETS. Every emitting enterprise can send a request to any miner candidate to obtain the relevant information.
There are two types of interaction between the light nodes and the full nodes in the BD-ETS. First, the emitting enterprises can send a request to the miner candidates to obtain relevant information about trading the CEP in the market and the RoEE of the other emitting enterprises. Second, the emitting enterprises may download relevant information about the reputation opinions, RoEE updating, and emission data verified by the miners from the blockchain and check on the correctness. Reputation opinions are generated by emitting enterprises and they represent the feedback of emitting enterprises on interactions.

3) CEP TRADING
When the demands of the CEP of the emitting enterprises change, they can trade the CEP to write off their own carbon emissions. In Fig. 1, enterprise A gets the CEP from enterprise C. Besides buying the CEP from the market, enterprise A also invests in abatement technology to write off a part of the emissions. Under this circumstance, they have excess CEP which enterprise A can then sell to enterprise B who has increased production. In this way, the emitting enterprises in the BD-ETS reach a balance between emissions and CEP through CEP trading.

4) MINERS VOTING
Based on the past information interactions, the enterprises will generate reputation opinions as feedback on interaction.
The BD-ETS will calculate the reputation of the miner candidates (RoM) using the reputation opinions from the enterprises [32]. If the RoM is higher than the threshold of election, the miner candidate will become a miner. The miner with the highest RoM will become the block manager in this time slot.

5) BLOCK VERIFICATION
In the tenure, the block manager packs the transactions and emission information into blocks and sends the blocks to the miners. Then, the verified blocks with the miners' signatures are sent back to the block manager, and the block manager will then append the blocks to the blockchain. The emitting enterprises in the BD-ETS can access the data in the blocks to check their reputation opinions on the miner candidates, carbon emissions, and the results of the transaction validation.

B. MODEL ANALYSIS
The BD-ETS is designed based on six-layer blockchain framework [34], as shown in Fig. 2.  The data layer, made of chain-structure data blocks is the lowest layer. Fig. 3 shows the blocks in the BD-ETS. The block body stores the CEP transactions, emissions data of the enterprises, reputation opinions, RoEE and RoM. The hash calculation on this information and encrypted digital signature ensure that data can be traced to source and cannot be altered. If the enterprises want to check the results of the CEP transactions validation, emissions data, and reputation opinions, they can require Merkle proof to display these data on Merkle trees.
The second layer is the network layer. A P2P network provides the access to interactions and information exchange and gives the emitting enterprises equal status. The communication mechanism in the network layer specifies ways and types of interactions between the emitting enterprises and the miner candidates.
In the consensus layer, the consensus mechanism realizes efficient consensus among the nodes (miner candidates and emitting enterprises) in the BD-ETS without a central node's supervision and management. We propose a DPoR consensus mechanism to ensure the consistency of the ledgers of all the trustworthy nodes.
In the incentive layer, the miners in the blockchain are encouraged to contribute their computing power for block verification. The allocation mechanism of verification rewards according to individual rationality and incentive compatibility is adopted in the BD-ETS. The block manager in the time slot design the contracts for the miners [32], and the miners will choose the contracts, to maximize their utilities, and to contribute their computing power. This mechanism renders more miners with high reputation to join in verifying the block. The higher the reputation, the more computing power the miners will contribute. Thus, it improves the security of the block verification.
In the contract layer, the smart contracts in the BD-ETS perform an automated execution of the CEP trading. The smart contract is a set of computer protocols which bear the characteristics of self-executing and are event driven [35]- [37]. Smart contract renders trading parties to trade with less cost and time, and it achieves trust, fairness, and transparency without centralized control and third-party conflicts of interest. After some conditions are satisfied, the built-in trading procedures are triggered [38], [39]. Therefore, each emitting enterprise does not need to worry about fraudulent transactions.

III. CARBON EMISSION PERMITS TRADING SCHEME
The process of the CEP trading in the BD-ETS is presented in Fig 4. When the emitting enterprises want to trade the CEP in the BD-ETS, they have to choose their roles in the system. There are four trading roles: i) active buyers who actively search offers of the CEP, ii) active sellers who actively search for bids of the CEP, iii) passive buyers who publish bids of the CEP waiting for active sellers, and iv) passive sellers who publish offers of CEP waiting for active buyers [24].
For the passive buyers (sellers), they first input the bid (offer) size, average price, and their RoEE. The size of the bids (offers) refers to the CEP amount they want to buy (sell). The average price refers to the price of CEP per unit.  The RoEE is used to obtain the transaction fee. Then BD-ETS will create new bids (offers) of CEP for passive buyers (sellers). The information of bids (offers) of the CEP include the CEP amount, average price, and RoEE.
In general, the RoEE obey a Normal distribution, and most enterprises' reputation values are clumped in the middle. Thus, we layer the RoEE based on percentiles. The emitting enterprises participating in the CEP trading are classified into three ranks according to their RoEE. In the BD-ETS, participants with the highest RoEE of a%, the middle RoEE of b%, and the lowest RoEE of c% are labelled as high, middle, and low rank respectively.
For the active buyers, the BD-ETS first calculates their RoEE ranks according to their RoEE. Then the BD-ETS filters and sorts the available offers according to their RoEE rank and the Priority Value of Offer (PVO) [24]. The active offers that buyers can access are determined by their RoEE rank. Buyers in high, middle, and low ranks can respectively access d% offers with the lowest average price, e% offers with a medium average price, and f% offers with the highest average price, with d + e + f = 100. The sequence of offers in the active buyers' list is determined by the PVO.
The smaller the PVO, the more advanced position of offers is in the list of active buyers. Besides paying a trading fund, the active buyers have to pay transaction fee. The active buyers in the high, middle, and low ranks should respectively pay an additional transaction fee which is at least x%, y%, and z% of the trading fund, with x < y < z.
The relationship between transaction fee and RoEE rank is presented in Table 1. For the active sellers, the BD-ETS filters and sorts the available bids for them according to their RoEE ranks and Priority Value of the Bids (PVB) after finding the RoEE rank. The PVB is the product of the average price and the RoEE of the passive buyers. The offers the active buyers can access are determined by their RoEE rank. The Sellers in the high, middle, and low rank can access p% of the bids with the highest average price, q% of the bids with a medium average price, and r% of the bids with the lowest average price, with p + q + r = 100, p = r < q. The sequence of bids in the active buyers' lists are determined by the PVB. The greater the PVB, the more advanced position of bid is in the list of active sellers. Besides the transaction fund, the passive buyers who publish bids have to pay a transaction fee according to their RoEE. The lower the RoEE, the higher transaction fee to pay. The transaction fee will be collected by block manager and will be used to incentivize the miners to verify the blocks.
The block manager collects all the transactions in this time period and unpacks the transactions in the previous periods. Next, the block manager finds the maximum RoEE of the transaction initiators (active sellers or active buyers) and the maximum transactions fees. The two properties (RoEE of transaction initiator and transaction fee) are regarded as the transverse and longitudinal axes in a two-dimensional coordinate system. The block manager then computes the distances between two properties of every transaction and the maximum of the two properties founded in the previous step. The distance between the transaction of A and e and the maximum of two properties is presented as follows: where ROEE max is the maximum RoEE of the transaction initiators, TF max is the maximum transaction fee of all transactions, ROEE A is the RoEE of enterprise A, TF A is the transaction fee paid by enterprise A, and r and s are the predefined parameters of the RoEE and transaction fee respectively.
Next, the block manager sorts the transactions packing order according to the distances. The smaller the distance, the more advanced position is the transaction. Finally, the block manager packs the transactions in order. After confirmation, the transactions are executed and the blocks are appended to the blockchain by the block manager. We introduce RoEE into the CEP trading scheme to incentivize the emitting enterprises to take long-term measures and invest more in carbon emission reduction instead of buying more CEP to write off the carbon emissions. For the active buyers and active sellers with low RoEE, the trading mechanism has two dual penalties. They would have lost the chance to access the offers and bids with better average price and have to pay a higher transaction fee for the CEP transactions and wait longer for the transactions packing as well. For the passive buyers and passive sellers with low RoEE, the positions of the bids and offers will not be high in the list of active sellers and buyers. We also adopt a percentage classification scheme to classify the participants into different ranks instead of a fixed threshold classification. Due to information asymmetry, if the participants want to sell or buy the CEP faster and allow the transactions to be packed faster, they have to increase their RoEE, and finally promote them to contribute more to carbon emissions reduction.

IV. DPOR CONSENSUS MECHANISM A. CONSENSUS MODEL
To achieve consistency in transaction information, emissions data and reputation opinions among the emitting enterprises and miner candidates, we propose a Delegated Proof of Reputation (DPoR) consensus mechanism. Fig. 6 shows the DPoR scheme. The DPoR consensus mechanism includes four parts: i) voting power calculation, ii) voting and calculation of Reputation of Miner (RoM), iii) block packing and propagation, and iv) block verification and appending.

1) VOTING POWER CALCULATION
First, we find each emitting enterprise that has information interaction with a miner candidate. The RoM is only related to the reputation opinions of these emitting enterprises, and the voting power of each emitting enterprises is not equal. The voting power of these emitting enterprises to the miner candidate j is determined by the proportion of their ROEE in the sum of the ROEEs of these enterprises. The higher the RoEE, the greater is voting power. The voting power of emitting enterprise j when it votes is presented as follows: where E is the set of all emitting enterprises which have interactions with miner candidate j in the previous period and e is one such enterprise.

2) VOTING AND MINERS ELECTION a: LOCAL OPINION GENERATION AND CALCULATION
When the emitting enterprises send requests to the miner candidates to obtain information about the bids and offers of the CEP, the miner candidates will send relevant information back to the emitting enterprises. The interactions between the emitting enterprises and miner candidates are labelled as either: i) positive interactions or ii) negative interactions [32].
If the emitting enterprises are satisfied with the feedback information which means that the data are useful and correct, this interaction will be appraised to be positive by the emitting enterprise. Similarly, if the feedback cannot satisfy the demand of emitting enterprise, the interaction will be appraised as negative interaction.
To ensure the security of the BD-ETS, a multi-weight subjective logic model including the weights of interaction timeliness and interaction effect is adopted [32]. Typically, the recent interaction is more noteworthy, and the negative interactions can reflect the credibility of miners and miner candidates better than positive interactions. Thus, it is reasonable to weight the recent interactions and negative interactions higher.
After finding the local opinion an emitting enterprise gives to a miner candidate or miner, the BD-ETS will download the recommended opinions of the other emitting enterprises. Since the voting power of the enterprises has been defined, the recommended opinions of emitting enterprise i of miner candidate j are presented as follows: where X is the set of all emitting enterprises which had interacted with miner candidate j in the past period except enterprise i, and x is one of the set. beli x→j , disb x→j and unce x→j are belief, disbelief and uncertainty of enterprise i to miner candidate j.
The local opinion will be combined with the recommended opinions to form a final local opinion of emitting enterprise i on miner candidate j [32].

b: RoM CALCULATION
The BD-ETS will collect the all opinions of the emitting enterprises on miner candidate j and then compute the RoM. The RoM of the miner candidates and miners is as follows: where OPIN final i→j is the final reputation opinion of emitting enterprise i of miner candidate j.

c: MINERS ELECTION
Next, the BD-ETS will compare the RoM of the miner candidates with the threshold of becoming miner. If the RoM of the miner candidates are higher than the threshold, they will become miners in the next time period. For the current miners, if their RoM's are higher than the threshold, they will stay as miners. If their RoM is lower than the threshold, they will then lose the right to verify the blocks. After the election, the miners are divided into active miners and standby miners according to their RoM. The active miners will take turns to be the block manager.

3) BLOCK PACKING AND PROPAGATION
The block manager packs the data into blocks in its time slot. The data include transaction information of the emitting enterprises, emissions data, and voting data. The transaction packing of the block manager is supposed to obey the processes as shown Section III. Besides packing the blocks, the block manager also designs contracts [32] for the miners to incentivise more miners with high RoM to join in the block verification so as to reduce the effect of miner collusion and ensure a secure blockchain. The block manager will then propagate the unverified blocks with contracts to miners.

4) BLOCK VERIFICATION AND APPENDING
The miners select the contract to maximize their utility and contribute their accordingly computation power resource to validate the blocks sent by block manager. The process of block verification includes two parts. The first is local verification which means each miner checks and audits the data and information in the unverified block. Both the active and standby miners join in the verification. The second part is mutual supervision. After miners finish the local verification, they need to send their results to the other verifiers to have mutual verification. After self-verification and mutual supervision, the miners send the verification blocks and results of the mutual supervision to the block manager.
As the consensus of all the nodes in the blockchain is converted to the consensus of the miners who have participated in the verification, the Byzantine consensus problem [27], [40], [41] is then considered in this step. After receiving the verified block with the miners' signatures, the block manager will append the new block ''n'' to the blockchain when more than two-thirds of the miners have the same verification results. Then, the emitting enterprises can upload the data from the new block to check the correctness of the information for themselves, and form new local opinions of these miners and the block manager in the next period.

B. CONSENSUS MECHANISM ANALYSIS
In general, a blockchain based distributed system has two aims. The first aim is to ensure the security of the system. The second aim is determined by the specific application scenario. For example, the final aim of the BD-ETS is to encourage emitting enterprises to reduce carbon emissions. When malicious nodes in the system want to launch an attack, they are mainly focusing on these two aims. In the BD-ETS, malicious nodes, i.e., emitting enterprises, may collude with the miner candidates and give them as many positive opinions as possible in order to render it to be miners in the blockchain. Then, the colluding miners generate fault blocks and information to cause damage to the system. However, if the voting power is determined by the contributions to the final aim of the system, it will be more difficult for the malicious voters to launch an attack. This design of voting power bears two benefits.

1) INTENTION VIOLATION
In order to let the colluding miner candidates have enough RoM to be miners, the malicious voters have to give as many positive opinions as possible and increase their voting power at the same time. The malicious voters may interact with the colluding miner candidates frequently and interact less with the other well-behaved miner candidates to render the interaction frequency as high as possible in the local opinion calculation. At the same time, the malicious nodes have to increase their contributions to the final aim of the BD-ETS to have more voting power. This contradicts one of their original aims. Thus, this rule of voting power can reduce the attack motivation of the malicious voters.

2) ATTACK COST
If the malicious voters attempt to launch an attack to the system, they will have to pay a heavy price for two reasons: (i) time cost and (ii) economic cost. The voting power is determined by the contributions in carbon emissions reduction. It is difficult to achieve significant emissions reduction outcomes as emission reduction requires much time since the emitting enterprises need to invest in carbon abatement technologies or optimize production process. At the same time, these enterprises also need to spend a lot of money to do so.
The DPoR consensus mechanism can effectively prevent the malicious voters from attacking at the origin due to its effect in reducing attacking willingness and the high cost of launching an attack. Even if the malicious nodes successfully increase their voting power, their contributions to emissions reduction will be greater which is beneficial to the final aim of the BD-ETS.

V. CASE STUDY
Here, we use a case study to highlight the process of CEP trading and the effect of an inner penalty mechanism. We first define the parameters in Section III: a = 30, b = 30, c = 40, d = 30, e = 30, f = 40, a = 30, p = 30, q = 30, r = 40, x = 6, y = 8, z = 10.
There are three emitting enterprises A, B and C who are active buyers trying to buy CEP in the market. This setting is arbitrary. The basic information of these three emitting enterprises is presented in Table 2. Their RoEE ranks are low rank, middle rank and high rank according to their RoEE, and the CEP they need are 48 units, 58 units and 34 units respectively. Enterprises A, B, and C determine that the average price of investment in abatement technology needed to write off their emissions in the future are 158, 139 and 140 per CEP unit respectively. As such, their offer price of the CEP in the market should be capped at 160, 141 and 142 per CEP unit. Table 3 shows the offers available in the market. The information on offers include the average price per CEP unit, VOLUME 8, 2020 RoEE of the passive sellers, offer size and PVO. There are 10 passive sellers whose average offer price range from 96 to 157 per CEP unit. We assume that the basic information on these offers are fixed.
The BD-ETS sorts the available offers for enterprise A according to the PVO and then automatically finds the transaction fund, transaction fee, and average price for enterprise A as shown in Table 4. According to the PVO, the sequence of offers enterprise A can receive is (e, d, f, h). The CEP offers from sellers e and d can meet their demands, so they only consider these two offers. If enterprise A only receive offer from seller e, the transaction fund is 4004 and transaction fee is 400.4. The average price of the transaction is 157.3. If enterprise A receive offers from seller e and d, the total transaction fund and transaction fee of two transactions is 7458 and 745.8. The average price of two transactions is 164.1. Therefore, enterprise A decides to buy CEP from seller e because the average price is less than 160 per CEP unit. Then, the transaction information is propagated to the network waiting to be packed. For enterprise B, the sequence of offers received is (a, j, g). The CEP offers from sellers a, j, and g can meet the demand of them, so they consider the three offers. Three trading choices including transaction fund, transaction fee, and average price are presented in Table 5.
As the final average price of the three transactions is less than 141 per CEP unit, enterprise B decides to buy CEP from sellers e, I, and a, and pays a transaction fee of 300, 320 and 260 respectively for these three transactions in order to render the transactions to be packed faster.
For enterprise C, the sequence of offers received is (b, i). Enterprise C considers the offers from sellers b and i. The two trading choices are presented in Table 6. Finally, C decides to buy 38 CEP units from sellers b and i at an average price of 102.9 per CEP unit. In order to render the transactions to be packed sooner, enterprise C pays a separate transaction fee of 220 and 200 respectively for each transaction. The final average price of CEP is still lower than the ideal price.  After buying 28 CEP units from seller e, enterprise A still needs 20 CEP units to write off the emissions. Thus, enterprise A will publish bids to buy enough CEP at a price below 160 per CEP unit. After all three transactions are packed into blocks, enterprise B intends to sell 16 CEP units at the price of 140 per CEP unit to recover cost. The available bids in the market are presented in Table 7.
The BD-ETS first sorts the bids for enterprise B according to the RoEE rank and PVB. The sequence of bids received is (m, k, A). The transaction fund, transaction fee, and average price for enterprise B are presented in Table 8.
Considering the transaction fee, the average price of CEP that enterprise B can obtain is 150.9 which is greater than 140. Thus, enterprise B chooses to undertake this transaction. As a result, bid from enterprise A is not selected by enterprise B, so enterprise A has to wait for other suitable active sellers.
We compiled the smart contract based on the trading logic in Section III using the Go programming language. Considering that the BD-ETS fits the characteristics of a permissioned chain and Hyperledger Fabric [42] is a typical permissioned chain, so we complete the CEP transaction     Further, enterprise A did not complete the transaction due to their low RoEE, but enterprise B and C have both satisfied their demands through trading. For enterprise A, the difficulty of waiting for sellers and the risk of producing more emissions can prompt them to focus more on carbon abatement by themselves instead of buying the CEP in the market.
To conclude, the CEP trading scheme in the BD-ETS has two benefits.
First, it can motivate enterprises with low RoEE to invest in carbon abatement. Doing so will reduce the CEP they need in the future. Our mechanism has a greater incentive effect. As a result of the link between the contribution of carbon abatement and RoEE, their RoEE will increase based on past work. Thus, they can access more offers with relatively lower average price and pay less transaction fee, and their bids will also be positioned ahead in the sellers' lists. Therefore, the double benefits can persuade the emitting enterprises with low RoEE to contribute more to carbon emissions reduction.
Besides, we also change the reputation rating system with fixed values into a percentage rating system which means that the emitting enterprises have to compete with the other enterprises. Due to information asymmetry, it can further stimulate them to increase their RoEE leading to more carbon emissions reduction.

VI. NUMERICAL SIMULATION
The simulations are performed according to the operation processes and reputation computation steps of the DPoR. The parameters in the simulations are presented in Table 9.
We randomly generate 50 normal emitting enterprises and 10 malicious emitting enterprises. In the BD-ETS, every emitting enterprise interacts with the miner candidates to obtain information about the bids and offers of the CEP. In the simulation, there is collusion amongst the 10 malicious emitting enterprises. They have the same attack target and compromise a miner candidate. In this simulation, we assume that attackers with high reputation values are less likely to be malicious nodes because they need to spend a lot of time and money to increase their RoEE, which could exceed the benefits they receive from attacking the blockchain network. Based on this assumption, emitting enterprises with lower contributions in carbon emission reduction are more likely to be malicious voters and attackers. Thus, the RoEE of the malicious enterprises is less than that of the other well-behaved emitting enterprises. The interaction number of each week between the malicious miner candidate and normal emitting enterprises is randomly generated from 20 to 30, and interaction number between the malicious miner candidate and malicious emitting enterprises is randomly generated from 30 to 40. The time scale of the simulation is 14 weeks. At the end of each week, the BD-ETS automatically obtains RoM of every miner candidate and miner. The initial RoM is calculated according to the interactions between the emitting enterprises and the miner in the first 5 weeks. The next 9 RoM's are determined by the interactions in the past 5 weeks before performing the RoM calculation. The malicious miner candidate who is compromised by colluding voters behaves well in the initial five weeks to achieve a high initial RoM in order to be a miner. It successfully becomes miner in the third week. From the eighth week, it propagates wrong information to the other miners and the emitting enterprises, and behaves maliciously to attack the blockchain.
The RoM of the malicious miner at the end of each week is found in Fig. 9. We obtain the RoM using 1,000 random generations and calculating the average values of each week. The simulation includes two algorithms of consensus mechanisms: (i) DPoR consensus mechanism and (ii) enhanced DPoS consensus mechanism. In each simulation, we use these two algorithms to calculate the RoM.
In Fig. 9, the curve of the RoM has three stages. In the first stage, the RoM of a malicious miner is almost steady in the first two weeks. The behavior of the malicious miner suggests that all interactions between the emitting enterprises and itself VOLUME 8, 2020  are positive interactions. In the second stage, the RoM of the malicious miner decreases because of the propagation of wrong and useless information. Normal voters give negative opinions and the malicious voters give positive opinions to the malicious miner. The RoM in the DPoR mechanisms decreases faster than that in ethe nhanced DPoS mechanism due to the introduction of voting power which is determined by the RoEE. The RoEE of the malicious emitting enterprises are relatively less than the other normal emitting enterprises, so their voting power are lessened. The weight of the opinions from malicious emitting enterprises cannot support them to maintain the high RoM of the malicious miner. In the third stage, the interactions between the emitting enterprises and the malicious miner are all negative interactions in the 5-week period. Thus, the RoM of the malicious miner is stable.
In the simulation, DPoR consensus mechanism can effectively identify the malicious miner at the end of the third week according to the RoM when the threshold of RoM is 0.7, and cancel the verification right. However, the enhanced DPoS consensus mechanism can only identify the malicious miner at the end of the fourth week. Identifying the malicious miners sooner can stem its dissemination of erroneous information in a timely manner and stop losses. Thus, the DPoR consensus mechanism improves the security of the BD-ETS compared to the enhanced DPoS consensus mechanism.

VII. CONCLUSION
In this article, we have proposed a blockchain-enabled distributed system involving a trading model based on a smart contract and consensus mechanism for carbon emissions trading to improve trading efficiency and security of the system. The features of data transparency, anonymity, and unalterable modification of the BD-ETS ensure data security and encourage the emitting enterprises to reduce carbon emissions. We introduced the reputation value of the emitting enterprises (RoEE) which is connected with contributions to carbon abatement into the BD-ETS in two parts. In the trading part, the access and selection order of bids and offers, transaction fee, and transaction packing order are determined by the RoEE for improving emission reduction of the emitting enterprises. In the consensus part, we proposed a DPoR consensus mechanism. We set the RoEE as the voting power of the emitting enterprises in the voting stage to decrease the attack intention and improve detection of a malicious miner. The case study illustrated the process of CEP trading and indicated that the inner penalty mechanism brought by RoEE can help to improve the efficiency of carbon emissions reduction compared to the traditional trading mode. The simulation results suggest that the proposed DPoR consensus mechanism performs better in finding malicious miners compared to the enhanced DPoS. This article also has some limitations. First, we need to establish a reasonable dynamic reputation evaluation system for emitting enterprises rather than taking only emission reduction into consideration. Second, the trading mechanism in this article need more further works to clarify the positive correlation between the reputation of emitting enterprises with the overall efficiency of carbon emission reduction. Third, we can introduce the principles of individual rationality and incentive compatibility to explore the possibility of improving the overall benefits of emission reduction in the future work. Last, we can apply the BD-ETS model in practice a lot to further optimize specifics of the smart contract and the consensus mechanism.
YUHAO DU received the B.E. degree from the School of Automation, Wuhan University of Technology, Wuhan, China, in 2020. He is currently pursuing the M.S. degree with the School of Continuing and Lifelong Education, National University of Singapore, Singapore. His research interests include the Internet of Things (IoT) and machine learning.
CONGJUN RAO received the Ph.D. degree from the Huazhong University of Science and Technology, China. From 2014 to 2015, he was a Visiting Scholar with the National University of Singapore, where he is also a Visiting Scholar for the period 2020-2021. He is currently a Professor with the School of Science, Wuhan University of Technology. His research interests include supply chain management, auction theory, and decision theory and method.
MARK GOH received the Ph.D. degree from the University of Adelaide. In the National University of Singapore, he holds the appointments of the Director (Industry Research) at the Logistics Institute-Asia Pacific, a joint venture with Georgia Tech, USA, the Principal Researcher at the Centre for Transportation Research, and was the Program Director of the Penn-State NUS Logistics Management Program. He is currently a Professor with the NUS Business School and The Logistics Institute-Asia Pacific, National University of Singapore. His current research interests include buyer-seller relationships, performance measurement, and supply chain strategy.