In this section, we compare the experiment results for several case studies running on the co-simulation platform for energy trading to demonstrate the effectiveness of the proposed transactive energy market.
5.1. Simulation Set-Up
We implemented the proposed secure transactive energy market (STEM) on a computer with an Intel(R) Core(TM) i5-9500 CPU at 3.00 GHz and 16 GB of RAM using GO (go 1.15.8 Linux/amd64, Google, Mountain View, CA, USA), Python (Python 3.8.10, Python Software Foundation, Portland, OR, USA) and Node.js (v10.19.0, Node.js Foundation, Portland, OR, USA). We used the consortium chain Fabric (V 2.2.3) as the distributed ledger to store transaction information, electricity meter usage and reputation values.
Hyperledger Fabric is an open-source blockchain framework developed by IBM, comprising a world state and transaction logs. The world state is the database of the ledger. We stored transaction information, electricity meter usage and reputation values in the world state in the form of key-value pairs. Smart contracts in Fabric are also called chaincode. When external programs interact with Fabric, the smart contracts are invoked using command line interface (CLI) commands or the Software Development Kit (SDK, V 2.2.3) [
30]. We used a Javascript interface written in Node.js to access the smart contracts published in Fabric.
Due to Fabric being a permissioned blockchain, although it supports tokens, it does not facilitate the issuance of commercial cryptocurrencies. To enable users holding Fabric tokens to make purchases outside the Fabric network, we opted for Ethereum. By utilizing a cross-chain exchange protocol [
31], asset exchange between Fabric tokens and Ether can be achieved, catering to the broader purchasing needs of users.
The co-simulation used in the experiments was developed based on the Transactive Energy Simulation Platform (TESP V1.0.0). We initialized 32 houses for simulations, including an Unresponsive_Buyer (meaning an urgent need for electricity). The market cycle of the simulation was 300 s.
In these experiments, the reputation threshold for user participation in the auction was set to = 0.1. The value of the time period n was set to 5 and initialized as to ensure that the total reputation value of honest users was greater than . The reputation decay factor array was set to . The value of was set to 0.1. In the double auction, if the price difference between two bidders was less than USD 0.00001, then was used to calculate the bidding scores. Please note that this price difference was quite small due to the sensitive energy unit price adopted in the simulation. In practice, this value can be adjusted to fit the system.
When the user participates in the energy trading market for the first time, user initialization smart contracts are used to authenticate the user’s identity, register the wallet and register the smart meter ledger [
7]. In addition, the user is initialized with the reputation value described above.
5.2. A Normal Case
This section presents a electricity trading situation without malicious users.
Table 2 and
Table 3 display the sellers’ and buyers’ bidding information, respectively. The reputation values exceeding the auction reputation threshold
= 0.5 indicate that the participating houses in this round met the auction requirements.
Table 2 shows the detailed bidding information from all participating sellers. In particular, we highlighted two rows of data in red. Without reputation values, the price of H12 was higher than that of H19, and the auction ranking of H12 should have been above H19. However, with the introduction of the reputation scheme, the prices of H19 and H12 satisfied the adjacent price threshold
. The set value
not only ensured that the price remained the primary bidding sorting parameter but also considered the reputation values of the participants when the price was insufficient as the main parameter for bid sorting. This encourages users to engage in honest transactions. Consequently, we utilized Equation (
6) to calculate
for H19 and H12. Subsequently, we rearranged their bidding order based on the ranking scores. Thus, as shown in
Table 2, the auction ranking of H19 was higher than that of H12.
Subsequently, a double auction market clearance was conducted, and we obtained the market clearing prices and quantity from
Figure 3. Based on the clearing results of the double auction, H10, H2 and H15 did not successfully bid in this round and were placed into the seller backup set
. Similarly, H21 did not successfully bid in this round and was placed into the buyer backup set
. The successful sellers and buyers in the auction were placed into sets
and
, respectively.
5.3. Case of Misreporting of Electricity Prices
In this case, houses gather, organize electricity consumption and generate data to participate in energy bidding. During the energy trading auction phase, there is a risk of malicious users misreporting prices to disrupt the integrity of the transaction. In this auction scenario, we assumed that buyer H21 intentionally inflated the price to secure a favorable position in the seller rankings, and seller H15 intentionally reduced the price to secure a favorable position in the buyer rankings. The highlighted entries in
Table 4 depict instances where H15 submitted a reduced price during the bidding phase to secure the top position among all participating sellers. Similarly, the highlighted entries in
Table 5 illustrate cases where H21 submitted an increased price during the bidding phase to secure a high position among all participating buyers.
Following the market clearing in
Figure 4, we observed noticeable changes in the clearing price and quantity compared with those in
Figure 3. The results unequivocally indicate that the deceptive pricing actions of H15 and H21 impacted the clearing price and quantity, causing severe disruption to the transaction market.
According to Algorithm 1, after the smart contract detected H15 and H21’s inability to pay the corresponding default penalty or prepayments, H15 and H21 should have been allocated to the seller backup set
and buyer backup set
, respectively. Following the rules of a double auction, new sellers and buyers were then supplemented from
and
, initiating a new round of a double auction. The second round of market clearance, as illustrated in
Figure 3, aligned with the normal market clearance process, effectively thwarting this particular attack. Notably, the attack did not result in transaction failure, as the multi-round auction ensured the robustness of the transactions.
Based on the clearance results, we compared the seller’s income and buyer’s cost of our current round of transactions with the BCTE scheme proposed by Chen et al. [
7].
Figure 5 and
Figure 6 illustrate the differences between the two schemes in terms of the seller’s revenue and buyer’s cost, respectively. When a false price reporting attack occurred, it can be observed that the proposed STEM yielded a higher average income and smaller variance compared with BCTE, where the average income of the buyers was higher due to malicious bidding leading to successful bids. However, malicious buyers can disrupt the energy trading market, causing harm to the respective interests of both buyers and sellers.
Table 6 presents bidding information in an auction where two sellers, attackers H15 and H02, misreported electricity prices. As all buyers participated in the transactions, the bidding information for the buyers remained as presented in
Table 5. From
Figure 7, it can be observed that the equilibrium price changed in a scenario where two sellers and one buyer acted as attackers. Due to the false reporting of electricity prices by H02, their ranking in the auction was higher, leading to a situation where, with unchanged buyer demand, H11 and H10 failed to successfully bid in this round. In comparison with a scenario involving one seller and one buyer as attackers, the scenario with two sellers and one buyer as attackers resulted in more severe disruptions to market transactions.
5.4. Case of Refusing to Pay
In this scenario, when the double auction bidding concludes, PEMT-CoSim stores the double auction market clearing results on the blockchain. Simultaneously, a smart contract on the blockchain is responsible for creating a shared wallet for buyers and sellers in sets and , respectively, and checks whether the buyers and sellers in sets and have stored the corresponding prepayment and default penalty on the blockchain. The successful bidders in and are expected to deposit the specified bidding amount or default penalty into the shared wallet to proceed smoothly to the following energy transmission phase. However, a malicious participant among the successful bidders may refuse to pay the bidding amount or default penalty, disrupting the transactions.
Assume that H24 in
is malicious. When the smart contract queries and identifies that H24 has failed to deposit the default penalty into the shared wallet, the next round of the double auction starts. From
Figure 8, we can observe the results of the second round, where H24 was removed from the buyer bidding set
. Simultaneously, since the price of H14 was higher than that of H10, H10 would be substituted into the buyer bidding set
from
.
In cases where H24 acts as a malicious seller without adopting our scheme, the absence of any penalty constraints may result in H24 facing no substantive repercussions when failing to transmit energy during the energy transfer phase. The lack of our scheme could potentially incentivize sellers to refrain from energy transmission while still receiving a prepayment from the buyer. This poses a significant threat to the robustness of the transaction market.
The results demonstrate an effective defense against refusal to pay attacks, ensuring the transaction’s robustness against potential financial defaults by individual users and safeguarding the interests of other users. Simultaneously, it facilitates the smooth progression of transactions without interruptions.
5.5. Case of Refusing to Transmit Energy
After completing the bidding phase and asset verification stage, the sellers in need to transmit the energy quantity from the double auction bidding to the buyers in . Although the sellers have already deposited the relevant default penalty into the shared wallet, some malicious sellers refuse to transfer the energy, disrupting the transaction. We assumed such an attack where H23 did not transmit energy.
Specifically, the energy transmitted by H23 was zero, and the smart meter of H23 uploaded the energy transmission result to the blockchain. During the transaction verification stage, the smart contract detected no related energy transmission information for H23 on the blockchain, identifying H23 as a malicious seller. Simultaneously, using Equation (
2), the reputation of H23 was updated and stored on the blockchain. As a result,
would be penalized and might not be qualified to participate in future auctions.
Figure 9 shows the energy transmission from the sellers in set
.