Construction of blockchain simulation experimental platform for practical teaching
[Objective]Blockchain technology,which originally stemmed from Bitcoin,has evolved significantly over more than a decade.It has now established its unique technological value,independent from Bitcoin.As the application of blockchain is rooted in distributed systems across large networks,practical experimentation is essential for teaching and researching this technology.However,conducting experiments on an in-use blockchain network is not feasible.Moreover,constructing a commercial dedicated network entails substantial software and hardware costs and requires implementing complex underlying technology,which complicates teaching efforts.To analyze the technical principles of blockchain systems and elucidate the impact of various components on blockchain operations,we have designed and implemented a blockchain experimental simulation platform named Blockchain Experimental Simulator(BCES).[Methods]1)The experimental platform BCES aims to simulate the system behavior of a blockchain,adhering to the principles of universality,simplicity,and extensibility.It ensures universality through a hierarchical architecture that decouples complex module dependencies.Simplicity is achieved by providing parameter configuration methods for core elements.Extensibility is facilitated using abstract classes and interface programming in the Java object-oriented language.BCES is designed as a four-layer architecture model consisting of data,network,configuration,and service layers.The data layer contains the most basic data storage structure in a blockchain:block and node.The network layer defines routing tables and consensus algorithms.The configuration layer provides parameter configuration methods for the block,node,and network.The service layer serves as the core engine of the simulator.2)We employed BCES as the teaching environment for practical instruction in blockchain courses.A 16-hour experimental lesson was arranged for the"Principles and Practice of Blockchain"course.The experimental content includes block structure,chain structure,node working principle,asymmetric encryption algorithm,peer-to-peer network,PoW consensus algorithm,Rotating Byzantine Fault Tolerant(RBFT)consensus algorithm,and smart contract development.3)Using the RBFT consensus algorithm experiment as an example,the design of the algorithm and the use of the BCES platform in the experiment class are described in detail.The traditional Practical Byzantine Fault Tolerance(PBFT)algorithm has good efficiency and fault tolerance.However,as the number of nodes in the blockchain network increases,its performance decreases rapidly.Given that the consortium chains adopt a permissioned membership mechanism for participating nodes,we propose an RBFT algorithm based on PBFT.This algorithm is suitable for weakly centralized alliance blockchain systems and can potentially enhance network efficiency.[Results]1)A comparative experiment between BCES and Gervais's simulator was conducted,with an evaluation experiment confirming that BCES can accurately simulate blockchain operations.2)We conducted delay and throughput experiments on the RBFT consensus algorithm.The delay experiment revealed that both the PBFT and RBFT algorithms experienced a gradual increase in delay with an increase in the number of nodes.However,owing to the small number of participating nodes in the RBFT consensus process,the RBFT algorithm exhibited lower delay.3)The throughput experiment demonstrated that the throughput for both the PBFT and RBFT algorithms gradually decreased with increasing the number of nodes.Nevertheless,the RBFT algorithm consistently outperformed the PBFT algorithm in terms of throughput.The result indicates that the RBFT algorithm provides better availability for blockchain networks and has considerable advantages over the PBFT consensus algorithm in improving the performance of the consortium chain.[Conclusions]BCES is the first simulation experiment platform based on the Java language in China,supporting the simulation of public or consortium blockchain for undergraduate teaching.BCES simplifies the complexities of blockchain teaching by emphasizing principles and implementation,enabling students to quickly grasp a comprehensive understanding of the technology.Through a series of progressive experiments,BCES aids students in understanding the application of data structures,computer networks,cryptography,and other technologies within blockchain.Furthermore,it promotes students'mastery of theoretical blockchain knowledge and improves their ability to design,develop,and implement blockchain projects.