4

I am trying to change my consensus algorithm in the FishNet example.

In /sawtooth-supply-chain-master/fish_client/public/dist/bundle.js file I found this:

consensus":{"type":"bytes","id":5}

Does anybody knows what is the mapping of consenus ids in sawtooth?

By default it is Devmode. But I want to change the consensus type. Is this possible ?

And in /sawtooth-supply-chain-master/docker/compose/supply-chain-default.yaml

entrypoint: | bash -c " if [ ! -f /etc/sawtooth/keys/validator.priv ]; then sawadm keygen && sawtooth keygen my_key && sawset genesis -k /root/.sawtooth/keys/my_key.priv && sawadm genesis config-genesis.batch fi; sawtooth-validator -v \ --endpoint tcp://validator:8800 \ --bind component:tcp://eth0:4004 \ --bind network:tcp://eth0:8800 \ --bind consensus:tcp://eth0:5050 "

devmode-engine: image: hyperledger/sawtooth-devmode-engine-rust:1.1 container_name: sawtooth-devmode-engine-rust-default depends_on: - validator entrypoint: devmode-engine-rust -C tcp://validator:5050

umang garg
  • 41
  • 4

1 Answers1

1

Sawtooth Dynamic Consensus Overview

Hyperledger Sawtooth supports a dynamic consensus model. As you mentioned, the default consensus engine is Devmode.

Other supported consensus engines include:

The consensus type is an on-chain setting. From the documentation:

Each consensus type has a consensus engine that communicates 
with the validator through the consensus API. Each node in 
the network must run the same consensus engine.

Configuring The Network

To use a consensus type other than the default Devmode, you will need to update two on-chain settings:

  • sawtooth.consensus.algorithm.name
  • sawtooth.consensus.algorithm.version

This must be done through a sawset proposal create command, which can be done while the network is running, or included in a batch as part of the genesis block, e.g.:

sawadm keygen && \
  sawtooth keygen my_key && \
  sawset genesis -k /root/.sawtooth/keys/my_key.priv && \
  sawset proposal create \
    -k /root/.sawtooth/keys/my_key.priv \
    sawtooth.consensus.algorithm.name= pbft \
    sawtooth.consensus.algorithm.version=1.0 \
    sawtooth.consensus.pbft.members=["VAL1KEY","VAL2KEY",...,"VALnKEY"] \
    -o config.batch \
  && sawadm genesis config-genesis.batch config.batch

Note that config.batch (which contains our proposal to update the consensus mode) needs to be included in sawadm genesis.

I would suggest looking at the documentation on Setting Up a Sawtooth Network for more info - particularly step 4 of Creating the Genesis Block.

Community
  • 1
  • 1