/mempool

实验代码

Primary LanguageGoMIT LicenseMIT

Stratus: Scaling Blockchain Consensus via Shared Mempool

Stratus is a shared Mempool protocol that effectively addresses the communication bottleneck of leader-based Byzantine fault-tolerant (BFT) consensus protocols. For technical details, please find the paper, which has been accepted to ICDE'23.

We implemented Stratus and integrated it with state-of-the-art BFT protocols, HotStuff and Streamlet, based on Bamboo, which is an open source project for prototyping, evaluating, and benchmarking BFT consensus and replication protocols. The native implementations of HotStuff and Streamlet can also be found in Bamboo.

WARNING: This is an academic proof-of-concept prototype, and in particular has not received careful code review. This implementation is NOT ready for production use.

What is included

Protocols:

  • HotStuff with a simple shared Mempool (SMP-HS)
  • Stratus enabled HotStuff (S-HS)
  • Stratus enabled Streamlet (S-SL)
  • HotStuff with a gossip-based shared Mempoo (S-HS-G)

Features:

  • Benchmarking

How to build

  1. Install Go.

  2. Download Bamboo-Stratus source code.

  3. Build server and client.

cd bamboo/bin
go build ../server
go build ../client

How to run

Users can run the protocols in simulation (single process) or deployment.

Simulation

In simulation mode, replicas are running in separate Goroutines and messages are passing via Go channel.

  1. cd bamboo/bin
  2. Modify ips.txt with a set of IPs of each node. The number of IPs equals to the number of nodes. Here, the local IP is 127.0.0.1. Each node will be assigned by an increasing port from 8070.

  3. Modify configuration parameters in config.json.

  4. Modify simulation.sh to specify the name of the protocol you are going to run.

  5. Run server and then run client using scripts. Note that the number followed by the runClient.sh is the number of clients that you wish to run.

./simulation.sh
./runClient.sh 10
  1. Close the simulation by stopping the client and the server in order.
./closeClient.sh
./stop.sh

Logs are produced in the local directory with the name of client/server.xxx.log where xxx is the pid of the process.

Deploy

Nodes can be deployed in a real network.

  1.  cd bamboo/bin/deploy/linux
  2. Authorize remote servers (send local public key to the remote) by adding the IP list into auth/server_auth.txt and modifying the user name and password in auth/server_auth.json. Then, run the script.

./auth/server_auth.sh
  1. Build server and client.
  2. Specify external IPs and internal IPs of server nodes in pub_ips.txt and ips.txt, respectively.
  3. IPs of machines running as clients are specified in clients.txt.
  4. The type of the protocol is specified in run.sh.
  5. Modify configuration parameters in config.json.
  6. Upload binaries and config files onto the remote machines.
./deploy.sh
./setup_cli.sh
  1. Start the server nodes.
./start_server.sh
  1. Start the clients by specifying no. of clients running on each machine.
./start_client.sh 10
  1. Stop the client and server.
./exp_stop.sh

Monitor

During each run, one can view the statistics (throughput, latency, view number, etc.) at a node via a browser.

http://127.0.0.1:8070/query

where 127.0.0.1:8070 can be replaced with the actual node address.