Renewable Energy Certificate Trading via Permissioned Blockchain

With the continuous advancement of the green certificate trading mechanism, information verification needs to span multiple departments, which causes the application process cumbersome and human errors. In order to solve problems of cumbersome issuance process of the renewable energy certificate (REC) and the inflexible pricing mechanism, in this paper, a hybrid REC trading system was proposed based on an permissioned blockchain technology (BT), which combined advantages of the BT and the continuous double auction (CDA)./e operation process of the system was introduced in detail, and the view change protocol in the Practical Byzantine Fault Tolerance algorithm was revised according to the characteristics of the system to improve the system stability. /e continuous double auction rule was also introduced in the system. And corresponding bidding strategies were designed to maximize the revenue of users (buyer and seller) and transaction probability. /e simulation experiment proves that the bidding mechanism can flexibly adjust the REC price according to the supply and demand relationship. At the same time, the effectiveness and feasibility of trading rule and bidding strategy were also verified.


Introduction
e REC is an electronic certificate issued to the qualified producer of renewable energy power. It is a recognition of the renewable energy generation capacity of power generator and a certificate for consumer to consume green power. e REC is a market-based instrument that certifies the producer who owns one megawatt-hour (MWh) of electricity generated from a renewable energy resource. Once the power provider has fed the energy into the grid, the REC can then be sold on the open market as an energy commodity. e REC represents environmental benefits of certain actions that help to mitigate greenhouse gas emissions. e REC arbitrage is a green power procurement strategy used by electricity consumers to simultaneously meet two objectives: (1) decrease the cost of renewable electricity use and (2) substantiate renewable electricity use and carbon footprint reduction. e strategy is used by consumers installing selffinanced renewable electricity projects or consumers who directly purchase renewable electricity from a renewable electricity project.
China started the voluntary subscription of RECs in 2017. Firstly, the "Renewable Energy Medium and Long-Term Development Plan" requires that renewable energy consumption should account for more than 15% of the total energy consumption by 2020 [1]. For consumers, purchasing the REC is an important way to accomplish this goal. Secondly, the REC is a powerful way of attracting investment in the wind power project [2]. irdly, the REC transaction can promote adjustment of energy structure to support clean energy in a more market-oriented manner [3]. After China initiated the REC subscription, the purchase volume on the market did not meet expectations [4]. Before the verification and issuance of the REC were introduced [5], companies need to submit audit materials to various departments for review if they want to apply for the REC. Such cumbersome processes consume a lot of labour costs and other resources. Besides, the traditional approach cannot avoid human error.
Recently, most RECs were traded on the trading platform through listed sales. is transaction method not only brings about the problem of unequal information between the two parties of the transaction but also fails to fully reflect market demand, resulting in the REC price not changing in time.
erefore, an efficient REC issuance and a trading system are needed.
Satoshi Nakamoto proposed that using the BT to build the distributed database is suitable for all transactions in P2P network, which has the characteristics of decentralization, security and credibility, and data traceability [6][7][8]. With the rises of bitcoin and other cryptocurrency, the potential value of the BT in other fields is gradually reflected. e BT is widely used in finance, supply chain, health, education, and other fields [9]. A sharing scheme of blockchain-enabled secure data was proposed based on BT in mobile-edge computing [10]. Especially, the BT is promoting the development of information interaction in the direction of energy interconnection due to its decentralized nature that makes the system more robust without data loss [1,[11][12][13]. For example, a 3-layer energy trading framework based on the BT was designed, and problems and challenges faced by the application of blockchain were also analysed in energy trading [14]. A market-oriented transaction of distributed power generation based on the BT was proposed, and the corresponding transaction mechanism, settlement mechanism, and reward and punishment mechanism were constructed [15]. e BT was also applied to build the logistics supply chain system, and its operation mode was analysed [16]. Kang et al. [17] introduced the BT into the power energy transaction of rechargeable cars and used BT to complete operations such as power energy transaction, price setting, and transaction record. e application of the blockchain in the energy industry has achieved good results. However, the above models are all researched in the simulated environments.
A trading method of the renewable energy and green certificate based on quota system was proposed [18]. is method only analyses the dynamic process of the relationship between price and supply and does not give specific transaction cases. A distributed energy trading model based on blockchain was proposed [19], but it does not comply with China's relevant policies. e implementation of the renewable energy system and the difference between fixed electricity prices and renewable energy quotas were summarized [20]. Zhou et al. [21] analysed the impact of transmission congestion on electricity prices and constructed a model for minimizing transmission congestion costs based on the nodal electricity price method. Xie et al. [13] described the application of blockchain in the interactive trading market and analysed the computing performance, storage capacity, and potential problems in practical applications. ese studies focus on the impact of the renewable energy quota mechanism and REC trading, but the details of the specific transaction method need to be further studied. A lightweight protocol based on blockchain was proposed to solve the problem of low throughput [22]. But the security of data interaction cannot be guaranteed. A green certificate transaction technology was proposed based on Hyperledger Fabric 1.1, which improves the security level of transaction information [12]. However, this method has some shortcomings in transaction timeliness.
On the basis of existing researches, we introduced the BT in the green certificate transaction and aimed to solve problems of cumbersome green certificate issuance process and opaque information. We used the BT in the process of the REC issuance and trading to make the REC data collation and review easier and improve the efficiency of issuance and the transparency of information.
e double auction is that multiple buyers and multiple sellers bid to buy and sell items, and the CDA enables buyers and sellers to adjust their bids in real time, which more accurately reflects market demand [23][24][25][26]. At present, the CDA has been widely used in market transaction such as stocks and futures. For example, the CDA was used in document to price cloud computing service, and a bidding strategy was proposed to maximize the interests of buyers and sellers [27]. erefore, the CDA can be considered to implement the REC transaction. In this way, the market can adjust prices to promote the formation of supply and demand relationship and further activate the trading market. In addition, the CDA model can force some backward green power companies to make technical improvement to achieve the purpose of reducing transaction cost. In this paper, we also introduced the CDA in order to promote more marketoriented REC transaction, to improve the efficiency of REC transaction and realize the flexible adjustment of the supplydemand relationship and price customization. e traditional BT application based on on-chain model cannot meet the real-time requirements of the CDA. Onchain transactions refer to cryptocurrency transactions which occur on the blockchain and depend on the validity of the blockchain. All such on-chain transaction occurrences are considered to be valid only when the blockchain is modified to reflect these transactions on the public database record. en, an efficient model of off-chain processing was proposed [28]. e off-chain transactions refer to those transactions occurring on a cryptocurrency network, which move the value outside of the blockchain. Due to their zero/ low cost, the off-chain transactions are gaining popularity, especially among large participants. Based on the off-chain model, we proposed a hybrid REC trading system for the offchain bidding and on-chain transaction, which combined advantages of the BT and CDA and was based on permissioned blockchain (HRECTS-PBC). In order to make the paper more readable, all abbreviations and their spelt-out forms are listed.

System Components.
e structure of the HRECTS-PBC trading system is shown in Figure 1. is system includes a power plant, agent server, auction server, buyer, seller, smart meter, and power grid. e power plant and agent server were nodes in the network, and they were connected to each other to form a blockchain system. e seller and the buyer can use the agent server to conduct transaction without bearing the pressure of communication and computing on the network. e order information was published on the auction server. After the price reached an agreement, the REC was traded in the form of a smart contract. e smart contract was the code that was stored on a blockchain and automatically executed when predetermined terms and conditions were met. ey were typically used to enforce some type of agreement so that all participants could be certain of the outcome without an intermediary involvement. e smart meter recorded the power consumption of each power plant and the amount of green electricity provided to the grid. e smart contract automatically verified the power generation status of the power plant based on the records of the meter and issues of the REC.
Currently, the application model based on the public chain is widely developed, but it still has some disadvantages. It is mainly reflected in the following. (1) Renewable energy power plants have to be qualified for network access after being reviewed by authoritative agencies, such as the government, which does not satisfy the completely open nature of the public chain. (2) Nodes in the public chain do not trust each other, and the work proof and other mechanisms are used to account after reaching a consensus, which not only causes a lot of waste of computing power and other resources but also leads to the low transaction efficiency. It currently takes about 10 minutes to generate new blocks, meaning that a transaction takes 10 minutes before being confirmed by the whole network [29]. e alliance chain is a network composed of authorized nodes. e trust between nodes is weak, but the trust confirmation can be completed using mutual communication confirmation method, which can improve the transaction efficiency. e simulation experiments conducted by Knezevic indicate that the confirmation time of the alliance chain block using the practical byzantine fault tolerance algorithm (PBFT) is less than 1s, and the throughput reach 50 k/s [30]. e PBFT algorithm solves the problem of low efficiency of the BFT algorithm and reduces the algorithm complexity from exponential to polynomial, making the PBFT feasible in practical applications. Although the performance will be reduced in real complex situations, it can be well applied to the alliance chain and can accommodate not only faulty nodes, but also malicious nodes. erefore, a hybrid trading system based on alliance chain is proposed Figure 2.

Operation Model
(1) System initialization: after the renewable energy power plant received an identification IDi after review, the power plant i joined the on-chain system by virtue of the IDi. And then the system allocated public key (decryption key, PKi), private key (encryption key, SKi), wallet address (bank account, WAi), and certificate (Certi) to it for the first time. e certificate included the basic information of the electricity plant connected to the network, such as company name, address, installed capacity, smart meter ID, and other information. e newly added power plant node downloaded the database through the surrounding nodes after distributing the above information. After the synchronization was completed, the power plant officially became a node in the network. After the buyer completed the registration in the system, the public key, private key, and wallet address were assigned. e buyer could log into the system with the public key or the private key.
(2) Approval of the REC: based on the smart contract on the chain, the REC was regularly issued for the power plant by calculating the power meter of the power plant according to the regulations of 1MWh. e smart contract issued the REC to the wallet address of the power plant in the form of a transaction. Each REC was expressed as REC � { ID, t, c, m }, where ID, t, and c are the REC number, issuance time, and the type of green electricity, respectively, and m is some additional information, such as the affiliated company and project number. Security and Communication Networks the corresponding information was displayed in the sale list. If not all of the sale was completed after a period of time, the smart contract returned the remaining REC to the seller. (4) Purchasing the REC: the buyer published the purchase price and quantity in the auction system and pledged the required currency in the auction transaction smart contract, that is, sent buyOrder � 〈 buyer ID, Pbid, d, Coin, t 〉 to the transaction smart contract address; Pbid is the purchase unit price, d is the purchase quantity, Coin � Pbid × d is the amount of money pledged into the contract, and t is the time of the pending order. e order information was sent to the bidding server with the digital signature, that was buyOrder � 〈 buyOrder, signSKi (MD5 ( buyOrder) ) 〉. After the server was verified, the corresponding information was displayed in the purchase list. If a sufficient number of the REC was not purchased after a period of time, the smart contract returned the remaining currency to the buyer. (5) Transaction: bidding transactions applied a two-way auction mechanism to match transactions in offchain bidding servers. e bidding system adopted the traditional client-server model and displayed the order status in real time through the visual interface. e auction and closing rules were introduced in detail in Section 3. Successfully matched transactions were marked with both orders and digital signatures of parties, that is, matchedOrder � 〈 sellOrder, signSKj (MD5 ( sellOrder) ), buyOrder, signSKi (MD5 ( buyOrder) ) 〉. Bidding server sent 〈 matchedOrder, signSKas (MD5 ( matchedOrder) ) 〉 to the agent server and updated the transaction information on the server. SKas is the private key of the bidding server. e agent server sent the information to the bidding transaction smart contract in the blockchain. After the smart contract was verified, the validity of the transaction information, the pledged currency, and the REC were used to conduct the transaction. If the REC of the seller cannot be fully sold in the transaction, the smart contract generates a new order for the remaining REC at the same price and issues a new time stamp for release. If the buyer fails in this transaction after purchasing enough RECs, the smart contract also generates a new order and issues a new time tamp for release. (6) Transaction packaging: the primary node collected transactions for a period of time and then packed them into a block after verifying the validity of the transaction locally. Similar to the Bitcoin block, a block included a block header and a block body. e block body was transaction information, which was stored in the form of a Merkle tree, and the hash value of the Merkle root was stored in the block header. e block header also includes the hash value, version, and time stamp of the previous block. Because we did not use the proof of work information, the block header did not need to contain random numbers. (7) Consensus: the application of PBFT was considered as a consensus mechanism [31]. ere were N nodes in the system, and the number of failed nodes was f. If N ≥ 3f + 1, the system reached agreement through PBFT. e consensus process is shown in Figure 2. In the prepreparation stage, the primary node broadcasted a message to the slave node; the message format was 〈〈 PREPREPARE, v, n, d 〉, m〉. Among them, m is the newly generated block, v is the view number, n is the message sequence number in the current view, and d � MD5(m) is abstract of m. After receiving the message from the node, the system verified the correctness of v, n, d. e node sent the preparation message 〈 PREPREPARE, v, n, d, i 〉 to all other nodes. I is the number of the current node in the system. When a node received at least 2f preparation messages from other nodes, and v, n, d were the same as the received prepreparation message, it entered the commit phase. e node checked the validity of the transaction in the block and the correctness of the block header. After the check was passed, a confirmation message 〈 COMMIT, v, n, MD5(m), i 〉 was generated and sent to all other nodes. When the node received at least 2f +1 identical confirmation information (including its own confirmation information), it entered the store stage, which wrote the block to the local block chain, and the consensus process was completed.

View Replacement.
In PBFT, when the primary node fails, the view is updated according to the view replacement protocol, and the new primary node is reselected. In the basic PBFT, there is no need to consider the stability of the node, because the selection of node is indiscriminately selected in turn (primary node p � v mod N). V � vpre +1 is the new view number. P is the number of the new primary node. Because the primary node has the function of generating blocks and leading consensus, it needs higher stability and performance. e agent server of the system on the chain is not only a node in the blockchain network, but also a portal server for other users to log in. ey are operated by a professional team, so they will have higher stability and performance than the machines in the electricity plant. It is also less likely to be maliciously manipulated. Considering the above situation, some view replacement strategies need to be changed. We set the number of the blockchain system of the agent server on the chain to 0 and sequentially number other nodes as 1, 2, . . ., N-1. e method of generating the primary node is where mod is modulo operation, v ∈ N is the number of the new view, [·] is the rounding up operation, and v pre is the number of the previous view. When the current primary node was 0 and the trigger condition for PBFT view replacement was met, then a new primary node for view replacement was selected according to (1). When the current primary node was not 0 and the trigger condition for PBFT view replacement was met, or the primary node received the confirmation message from node 0 in the commit phase of the consensus process for k consecutive times, a new primary node was selected according to the view change operation. Except for the change in the method of selecting the primary node, other operations in the view replacement protocol were unchanged. In order to make the system run in an efficient state, we let the agent server node act as the primary node most of the time, which reduced the burden on the power plant machines.

CDA Rules and Bidding Strategies
is section mainly introduces the continuous double auction rules and transaction rules used in the bidding stage. We also designed alternative bidding strategies for users based on the auction rules to maximize the probability of transaction and user benefit.

CDA Rules.
e market trading mechanism includes the market trading subjects, trading time, price mechanism, and the disclosure way of market information. Continuous twoway auction refers to the transaction form in which buyers and sellers can submit bids at any time during the trading cycle when market participants exist in many-to-many form, and once the prices match, the transaction can be concluded. In the continuous two-way auction mechanism, the buyers and sellers are sorted according to the principle of "price first, time first". e buyer's price is sorted from high to low, while the seller's price is sorted from low to high. In the case of the same price, the order is sorted according to the time before and after the submission of the offer. Under this auction mechanism, the buyer's highest price is called the optimal purchase price and the seller's lowest price is called the optimal offer price. A transaction occurs when the optimal purchase price is greater than or equal to the optimal offer price. In the matching process of transaction price, the buyer with the highest bid is matched with the seller with the lowest bid, and the transaction price is the average of the two prices. And so on, a round of transaction is completed until the optimal purchase price is lower than the optimal offer price, and each round of transaction has at least one transaction. In the transaction process, market participants can check the optimal purchase price, the optimal offer price, and the transaction price and then adjust their bid continuously according to the market information using bid strategy to carry out the next round of transaction, until all the transaction prices in the market are matched or the transaction time ends. e CDA is the process in which multiple buyers and multiple sellers bid to purchase and sell items. During the opening period of the trading day, each user can arbitrarily bid to complete the transaction [32]. e minimum time interval between two bids was set to T, and the opening time of one trading day was TD. en, the user can have TD/T round of bidding opportunities. In this CDA rules, there are the following contents: t indicates the current bid round of user. e current maximum bid of buyer was recorded as obid. e current lowest offer of seller was recorded as oask. Buyer (i) bid in the round t was recorded as bit, and the highest acceptable price of buyer (i) was Bi. Seller (j) offer in the round t was recorded as ajt, and the lowest acceptable price of seller (j) was Aj. e act submitting price and transaction quantity to the system by user are called pending order.
According to the results researched by Wang et al. [15], the CDA trading rules are formulated.
(1) If the buyer bids, the price should be greater than or equal to the highest bid at the previous moment, and if the seller offers, the price should be less than or equal to the lowest bid at the previous moment (2) If o t bid < o t ask , no transaction will be completed at the time t. If o t bid ≥ o t ask , the two parties of the transaction will trade at the price p � o t bid , and the transaction volume will be subject to the party with the smaller transaction volume reported by both parties. e remaining transaction volume of one party is still pended at the original price. If there are multiple orders with the same bid, the order with the earlier bidding time will be firstly executed.
(3) e user can cancel the order at any time after the transaction is pended order. If the pending order has not been completed after the time mT, the system will automatically cancel the order, and all unsuccessful pending orders will be withdrawn at the end of the trading day.

Bidding Strategy.
According to trading rules, a bidding strategy called PP strategy was designed, which allows users to obtain higher returns and trading probabilities. We first estimated the competitive equilibrium price p * with the help of the past transaction price which can reflect the current supply-demand relationship. When the transaction price p � p * , the current supply and demand is balanced. When p > p * , the supply is less than the demand, which increases the price of goods. When p < p * , the supply exceeds the demand, which decreases the price of the goods [33]. We used a moving average to estimate the current competitive equilibrium price, that is, where p * is the estimated competitive equilibrium price. α ∈ (0, 1) is the smoothing factor. e smaller the a is, the smoother the estimated competitive equilibrium price is, and the less it is affected by the current transaction price. Conversely, the larger the a is, the greater it fluctuates, and the greater it is affected by the current transaction price. In order to simulate the CDA trading market, the normal distribution was used to estimate the bid [34]. In our trading rules, the bid of buyer was greater than or equal to the current maximum bid, and the bid of seller was lower than or equal to the current minimum bid. Considering the above, we used the half-normal distribution to estimate user bids. e buyer bid and seller bid were represented by where hn belongs to the half-normal distribution. X ∼ N(0, σ 2 ) is a normal distribution with mean 0 and variance σ2, and then, hn � |X|. e variance depends on the transaction price, that is, where k > 0, and it is the scaling coefficient. When p t−1 − p * t−1 > 0, the trading price tends to rise, and σ t bid is larger. e difference between the price obtained by (3) and σ t−1 bid will be relatively larger. At this time, σ t ask will be smaller, and the difference between the prices obtained by (4) and σ t−1 ask is smaller, which indicates that both parties of the transaction expect to make a deal at a higher price. At this time, it is the seller market, and vice versa.
Based on the above assumptions, we formulated bidding strategies for both parties. For seller j, it can be traded at a t j ≤ o t bid , because the buyer bid was greater than or equal to the current highest bid. e o t bid must be generated by a buyers bid at t, and the probability that the seller offer can be traded as is the cumulative probability density function of the half-normal distribution. Similarly, for the buyer i, the probability that the bid can be concluded is Generally, the buyer hopes to complete the transaction with the bid b t i . At this time, the buyer i can get the benefit B i − b t i . e lower the bid is, the greater the benefit is. However, it can be seen from formula (8) that the probability of being able to trade is also smaller. In the same way, the seller wants to trade with the offer a t j (at this time, the specific transaction price in the rule is not considered to simplify the model solution). e profit that the seller j can obtain is a t j − A j . It can be seen that the higher the offer is, the greater the profit is, but it can be seen from formula (7) that the probability of being able to trade is also smaller. erefore, there is a contradiction between the revenue and the transaction probability. In order to complete the transaction as soon as possible and obtain a good profit, we multiplied the two parameters to determine the optimal bid; that is, Due to the influence of the nonelementary function in the above formula, it is difficult to directly calculate the optimal value. We considered that the original forms are continuously differentiable in the domain, and we applied the gradient descent method to solve it [26]. For buyers and sellers, we define the objective function as PP ask a t j � − a t j − A j P sell .
We set the maximum iteration number as the target parameter according to (11) and (12): where η is learning rate. b t i and a t j were respectively initialized by Bi and Aj. When the maximum number of iteration N or the difference between the objective function updates is twice less than ε, renewal ends. And the current parameters are taken as the final result. In our experiments, the objective function usually had only one minimum value point in the domain, and the value at the boundary was greater than the value at the minimum value point. erefore, the minimum value point can be guaranteed to be the smallest value point. e optimal bid above was used as a reference, but the demand of users in the actual transaction is different. erefore, we defined the turnover intention λ∈[−1, 1], where the bigger λ is, the more likely users tended to close the transaction as soon as possible. e smaller the λ is, the more the benefits users wanted to gain are. Combined with transaction intention, the bidding strategy of users is as follows: ask . If the constraint conditions of b t i , a t j in the formulas (12) and (13) are not satisfied, ask . e PP strategy does not offer reference for users in the t-th round. When the buyer gets the bid by formula (15) and b t i ≥ o t−1 ask , the transaction is concluded. According to rules in Section 3.1, the price of the transaction should be b t i . Regardless to the number of transaction, the buyer will try to reduce the price. erefore, the final buyer bid was further revised to e seller does not have to consider a t j and o t−1 bid , because a t j ≤ o t−1 bid , and the transaction price of o t−1 bid and the seller actual income will not be affected whether or not a t j was modified.
At the beginning of each trading day or when one party's orders are completely consumed, there are no parameters needed to obtain the final bid. We used the following strategies. (1) At the beginning of the trading day, the first bidder used the p and p * to calculate σ and used the last transaction price of the previous trading day p as the o. (2) If the seller order is completely absorbed at the last moment, the buyer has no enough order amount required by formula (10) o ask . Similarly, if the buyer order is completely consumed at the last moment, the seller has no enough order amount required by formula (11) o bid . At this point, we considered using the transaction price of the previous transaction time p t−1 as a corresponding o and completing calculation. In the current situation, the buyer bid is not considered in formula (14) and it directly used b t i as a final bid. (3) If the seller order is completely consumed at the last moment, the seller will lack the value of o t−1 ask in formula (16). We supposed that the maximum profit ratio expected by the seller is μ∈(0, +∞); when λ � -1, the seller shall offer in the way of maximum profit, where a t j � o t−1 ask � (1 + μ)A j . In this case, we used (1 + μ)A j to replace o t−1 ask . Similarly, we used the bid . Taking into account the market price, economic benefit, and other factors, in the follow-up experiments, the maximum return was assumed to be 20% (µ � 0.2).

New View Replacement Agreement.
We compared the new view replacement protocol with the original one and assumed that there are six active nodes in the network, numbered 0, 1, . . ., 5. Node 0 was the agent server. e relationship between primary node selection and view is shown in Figure 3. It can be seen that in the original view replacement protocol, each node turned to be the primary node, and node 0 in the new view replacement protocol Security and Communication Networks acted as the primary node most of the time, so as to improve the stability of the system.

Optimization Objectives.
e cost price A j was supposed to 125, the current o bid was 130, and the objective function ( PP ask ) was obtained by the curve of the ask versus bid which is shown in Figure 4. In formula (5), when σ bid is very small (p − p * ≪ 0), it indicates that it has just experienced a big decrease. Due to being uncertain whether it will continue decreasing, the bid will be close to the o bid that strives for the trading success and avoids further decrease. When the bid is greater than 0.01, the bigger σ bid is, the greater the value of p − p * is.
at is, in the current trend of price rise, the optimal seller offer will also increase, and the seller can make more profits and have a chance to trade. We supposed that the highest price Bi acceptable to buyer i was 125, and o ask was 120. e relationship between the objective function ( PP bid ) and the bid b is shown in Figure 5. In formula (6), when σ ask is very small (p * − p ≪ 0) , it indicates that it has just experienced a big increase. Due to being uncertain whether it will continue to increase, the offer will be close to o ask that strives for trading success and avoids further increase. When σ ask is greater than 0.01, the larger σ ask is, the greater the value of p * − p is. at is, in the current trend of price decrease, the optimal bid of the buyer will be reduced, and the buyer can save more and have a chance to trade. When the value of σ is too large, it will be deviated from the current price seriously, which does not agree with the actual situation of the transaction. erefore, it is necessary to reasonably select k in formulas (5) and (6). Generally, the k should be taken as a small value to ensure that σ will not be too large. Here, we only selected by experience. It can also be seen from the above two graphs that, in general, there was only one minimum value of the objective function in the definition domain, and this minimum value was also the least value. erefore, we can ensure the convergence to the minimum point by using the gradient descent method.

Transaction Simulation.
We supposed that there are 5 sellers and 5 buyers in the market. eir parameters are shown in Table 1. When the market initialized, we set p and p * both as 200, one trading day TD � 10000, and the minimum bid interval T �1. e time interval for the user to bid was 10000 rounds and the transaction platform canceled the order when m � 600. Users did not bid every round, and the interval between two bids obeyed exponential distribution when λ was set to 1/20. In other words, the average time interval between two auctions was 20, and the number of transactions per user followed a uniform distribution between 1 and 10. In the bidding strategy of a � 0.05 and k � 0.005, the gradient fell when N � 1000, η � 0.1, e � 10-8.
We used the above parameters to conduct 10 simulation experiments and got the results in Table 2. Each income was the income from selling or purchasing a REC. e quantity of RECs provided by the seller was less than the demand of buyer, and the cost price was reasonable. erefore, the seller can sell all RECs. Due to the high cost, s4 wanted to pursue higher income (λ < 0). erefore, it was sometimes impossible to sell all RECs. e cost price of s2 and s5 was almost equivalent, but the selling difference of each REC was about 4.09 just because of the different λ. In the initial stage of the transaction, some sellers (s2) with low cost were eager to sell at lower price, so that some buyers with lower bids can also finish the transaction. e bidding strategy was such that the price was in the falling stage, which makes the transaction price at a lower level. erefore, it can be seen from the table that the buyer income was generally higher than that of the seller. It also indicates that both sides of the transaction can complete the transaction with the help of bidding strategy and obtain good profits. We assumed that the number of both the buyer and seller was 500, and the reserve prices were B i ∼ U(190, 210) and A j ∼ U(190, 210), respectively. e transaction willingness was λ ∼ U(−1, 1). Firstly, when the situation was oversupply, the purchase volume and selling volume were taken from U(50, 60) and U(250, 300), respectively. Secondly, when the situation was such that the demand exceeded the supply, the buyer purchase was taken from U(250, 300). e selling volume was from U(50, 60). e transaction prices are shown in Figures 6 and 7. When the supply exceeded the demand, there almost were 8000 orders. When the demand exceeded the supply, there were more than 8000 orders. From the changes in the transaction prices in two figures, the market can adjust prices flexibly according to the relationship between supply and demand. e transaction price was at a low level at the beginning of the transaction and then was gradually adjusted.

Conclusions
In this paper, we analysed the problems of the REC approval process, inflexible pricing, and low enthusiasm and proposed a hybrid alliance chain REC trading system with off-chain bidding and on-chain trading. We also introduced the detailed operation process of the system, including system initialization, REC issuance, REC sale, REC purchase, bidding transaction, transaction packaging, block consensus, and other operations. According to the characteristics of the system, the view change strategy in PBFT consensus algorithm was changed. We used the CDA to adjust the price of green certificate, formulated the corresponding trading rules, and designed a bidding strategy to maximize the user income and transaction probability. e results show that the price of REC can be adjusted according to the CDA, and the bidding strategy can make both parties obtain considerable profits. e research in this paper shows that the proposed method can solve the problem of maintaining the consistency and security of the data ledger together by the power grid, platform operators, supervisory review agencies, and distributed entities. At the same time, the green certificate transaction mechanism based on the CDA model proposed in this paper can help the marketization of REC transactions and the healthy development of the green certificate market. Due to the limitation of research focus, some system parameter settings related to business operation have not been studied in depth. In the bidding strategy, we did not consider the number of transactions when orders were submitted, so subsequent research can take transaction volumes into account to obtain higher revenue and can try to use adaptive k which can reflect the market changes better. With the widespread popularity of mobile applications, we will carry out research on the secure data sharing based on BT in mobile-edge computing system.

REC:
Renewable energy certificate BT: Blockchain technology CDA: Continuous double auction MWh: Megawatt-hour HRECTS-PBC: Hybrid REC trading system based on permissioned blockchain PK: Public key SK: Private key WA: Wallet address Cert: Certificate.

Data Availability
e experimental data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
e authors declare that they have no conflicts of interest.