# BPET: A Unified Blockchain-Based Framework for Peer-to-Peer Energy Trading
## 6 Case Study
### Evaluation Results  
Figure 6 shows the benchmark results of the Registry contract. We observe that the throughput of both registration operations increases near-linearly and then drops to a steady level of around 40 TPS as the transaction send rate increases from 10 TPS to 80 TPS. The throughput of registering consumers is slightly higher (around 10% in most cases) than registering suppliers, which is expected because registerSupplier stores one more parameter blockAmount than registerConsumer, and it includes an additional step of updating the total supply capacity for each registered supplier. Accordingly, the latency of registerConsumer is slightly lower than that of registerSupplier. But, both remain at a low level of around 0.75 s.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Contracts** & **Operations** & **Send Rates** & **txNum** \\ \hline \multirow{2}{*}{EnergyToken.sol} & transfer & & \\ \cline{2-4}  & query & & \\ \hline \multirow{2}{*}{PoolMarket.sol} & submitOffer & & \\ \cline{2-4}  & submitBid & & \\ \hline \multirow{2}{*}{Registry.sol} & registerSupplier & & \\ \cline{2-4}  & registerConsumer & & \\ \hline \hline \end{tabular}
\end{table}
Table 3: Overview of benchmarking workloads.  
Figure 7 shows the benchmark results of the EnergyToken contract. As we can see, the query throughput dramatically decreases as the transaction send rate increases from 10 TPS to 80 TPS. The blockchain has a relatively high throughput of over 250 TPS under a low query request rate of 10 TPS. When the query request rate increases to an extent, e.g., 80 TPS, network congestion happens, causing a significant performance drop with a throughput of 50 TPS. However, the query latency always maintains a negligible level. The transfer throughput increases to around 48 TPS when the send rate reaches 40 TPS then fluctuates between 30 TPS and 50 TPS. The transfer latency is relatively low and steady, around 0.7 s. The observed experimental results indicate that up to 50 users can send transfer transactions to pay for their energy simultaneously and will obtain a response from the blockchain system within one second.  
Figure 6: Registry contract benchmarking results. Solid lines represent throughput (left y-axis); dashed lines represent latency (right y-axis).  
Figure 7: EnergyToken contract benchmarking results. Solid lines represent throughput (left y-axis); dashed lines represent latency (right y-axis).  
Figure 8 shows the benchmark results of the PoolMarket contract. As can be seen, both transactions have similar performance trends. The throughput increases linearly from 10 TPS to the maximum of 43 TPS for submitBid and 46 TPS for submitOffer when the send rates reach 30 TPS and 40 TPS, respectively. Then, the throughput drops significantly, followed by a slow and slight increase when the send rate increases to 80 TPS. Accordingly, the latency of both transactions drops from 0.75 s to 0.5 and 0.6 s for submitBid and submitOffer, respectively, at the send rate of 40 TPS. Then, it increases to around one second as the send rate reaches 80 TPS.  
The observed experimental results indicate that the blockchain system can process up to 43 submitBid or 46 submitOffer transactions per second. In other words, if 40 users submit their offers or bids simultaneously, they will obtain a successful subsecond response from the blockchain system. In the Alberta electricity wholesale market with a maximum of 245 offer updates in the first daily hour, it only takes up to 6 s for the proposed BPET system to process all offer submission transactions.