Installing and Testing PBFT¶
This procedure describes how to install PBFT, start a four-node network in Docker containers, and run a basic liveness test.
Prerequisites: Docker and Docker Compose must be installed.
Clone the PBFT repository.
$ git clone https://github.com/hyperledger/sawtooth-pbft.git
Run the following commands to install the dependencies for PBFT and connect to the interactive shell container,
$ cd sawtooth-pbft $ docker build . -f Dockerfile -t sawtooth-dev-pbft $ docker run -v $(pwd):/project/sawtooth-pbft -it sawtooth-dev-pbft bash
If you have already configured a
cargo-registryDocker volume, use the following
docker runcommand to speed up the build time in the next step.
$ docker run -v $(pwd):/project/sawtooth-pbft \ -v cargo-registry:/root/.cargo/registry \ -it sawtooth-dev-pbft bash
Build the PBFT project.
$ cargo build
After the project has finished building, exit the
Run the PBFT test script on your host system from the
% bin/run_docker_tests tests/test_liveness.yaml
This command builds several Docker images, starts up a network of four Sawtooth nodes with PBFT consensus, then goes through a liveness test of 55 blocks, as defined in the Docker Compose file
test_liveness.yaml. The default log level is
INFO, so the test script displays a large amount of information as it executes.
This script has several options, such as
--timeout. For more information, execute
To run a different test, specify a different Compose file for ` run_docker_test``. The
sawtooth-pbft/tests/directory includes several Docker Compose files for testing, such as
To adjust the <on-chain-settings-label>, edit the testing Compose file and change the
sawset proposal createparameter for the genesis validator container (
validator-0). For more information, see PBFT On-Chain Settings. This example shows the settings in
validator-0 ... sawset proposal create \ ... sawtooth.consensus.algorithm.name=pbft \ sawtooth.consensus.algorithm.version=0.1 \ sawtooth.consensus.pbft.members=\\['\\\"'$$(cat /etc/sawtooth/keys/validator.pub)'\\\"','\\\"'$$(cat /etc/sawtooth/keys/validator-1.pub)'\\\"','\\\"'$$(cat /etc/sawtooth/keys/validator-2.pub)'\\\"','\\\"'$$(cat /etc/sawtooth/keys/validator-3.pub)'\\\"'\\] \ ...
To adjust the <cli-options-label>, edit the testing Compose file and change the options used with the
pbft-enginecommand for each PBFT container. For more information, see <cli-options-label>. This example shows the options in
pbft-0 ... command: ./target/debug/pbft-engine --connect tcp://validator-0:5050 -vv ...