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.

  1. Clone the PBFT repository.

    $ git clone
  2. Run the following commands to install the dependencies for PBFT and connect to the interactive shell container, sawtooth-dev-pbft.

    $ 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-registry Docker volume, use the following docker run command 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
  3. Build the PBFT project.

    $ cargo build
  4. After the project has finished building, exit the sawtooth-dev-pbft shell container.

  5. Run the PBFT test script on your host system from the sawtooth-pbft directory.

    % 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 --clean, --no-build, and --timeout. For more information, execute run_docker_test --help.
    • 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 grafana.yaml, client.yaml, and pbft_unit_tests.yaml.
    • To adjust the PBFT on-chain settings, edit the testing Compose file and change the sawset proposal create parameters for the four validator containers. This example shows the settings in test_liveness.yaml for the first validator container:
       sawset proposal create \
         sawtooth.consensus.pbft.peers=\\['\\\"'$$(cat /etc/sawtooth/keys/'\\\"','\\\"'$$(cat /etc/sawtooth/keys/'\\\"','\\\"'$$(cat /etc/sawtooth/keys/'\\\"','\\\"'$$(cat /etc/sawtooth/keys/'\\\"'\\] \
         sawtooth.consensus.pbft.block_duration=100 \
         sawtooth.consensus.pbft.checkpoint_period=10 \
         sawtooth.consensus.pbft.view_change_timeout=4000 \
         sawtooth.consensus.pbft.message_timeout=10 \
         sawtooth.consensus.pbft.max_log_size=1000 \