Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to setup two validators in a network - dev_mode - sawtooth components running as a service
In a multi validator setup, one node should be genesis and the rest of the nodes would be peering from genesis node or each other.
Here, we'll setup a two validator network, i.e. two nodes - one a genesis validator and the other a peer validator
We'll use the default dev_mode consensus and the sawtooth components will run as a service.
Step-by-step setting up the genesis validator:(A fresh ubuntu 16.04 LTS x64 machine)
====================================================================================
# add the sawtooth repo in apt
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8AA7AF1F1091A5FD
sudo add-apt-repository 'deb [arch=amd64] http://repo.sawtooth.me/ubuntu/1.0/stable xenial universe'
sudo apt-get update
sudo apt-get install -y sawtooth
sawtooth keygen # keypair for cli apps like intkey,xo,etc. on this node
sawset genesis
sudo -u sawtooth sawadm genesis config-genesis.batch
sudo sawadm keygen # keypair for validator on this node
Get the validator.toml.example file from: https://github.com/hyperledger/sawtooth-core/blob/1-0/validator/packaging/validator.toml.example
and copy it over to /etc/sawtooth/validator.toml
It should contain following:
bind = [
"network:tcp://<YOUR_MACHINES_IP>:8800",
"component:tcp://127.0.0.1:4004"
]
peering = "static"
endpoint = "tcp://<YOUR_MACHINE_IP>:8800"
scheduler = 'serial'
minimum_peer_connectivity = 1
maximum_peer_connectivity = 10
[roles]
network = "trust"
More info here: https://sawtooth.hyperledger.org/docs/core/releases/latest/sysadmin_guide/configuring_sawtooth
Then, in a console start the validator, settings-tp, rest-api, etc.
sudo systemctl start sawtooth-validator
sudo systemctl start sawtooth-settings-tp
sudo systemctl start sawtooth-rest-api
sudo systemctl start sawtooth-intkey-tp-python
We're done here.
Step-by-step setting up the peer validator:(A fresh ubuntu 16.04 LTS x64 machine)
==================================================================================
# add the sawtooth repo in apt
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8AA7AF1F1091A5FD
sudo add-apt-repository 'deb [arch=amd64] http://repo.sawtooth.me/ubuntu/1.0/stable xenial universe'
sudo apt-get update
sudo apt-get install -y sawtooth
sawtooth keygen # keypair for cli apps like intkey,xo,etc. on this node
sudo sawadm keygen # keypair for validator on this node
Get the validator.toml.example file from: https://github.com/hyperledger/sawtooth-core/blob/1-0/validator/packaging/validator.toml.example
and copy it over to /etc/sawtooth/validator.toml
It should contain following:
bind = [
"network:tcp://<YOUR_MACHINES_IP>:8800",
"component:tcp://127.0.0.1:4004"
]
peering = "static"
endpoint = "tcp://<YOUR_MACHINE_IP>:8800"
scheduler = 'serial'
peers = ["tcp://<GENESIS_VALIDATORS_IP>:8800"]
minimum_peer_connectivity = 1
maximum_peer_connectivity = 10
[roles]
network = "trust"
More info here: https://sawtooth.hyperledger.org/docs/core/releases/latest/sysadmin_guide/configuring_sawtooth
and here: https://sawtooth.hyperledger.org/docs/core/releases/latest/app_developers_guide.html
Then, in a console start the validator, settings-tp, rest-api, etc.
sudo systemctl start sawtooth-validator
sudo systemctl start sawtooth-settings-tp
sudo systemctl start sawtooth-rest-api
sudo systemctl start sawtooth-intkey-tp-python
You're all set in the peer node.
Create intkey transactions here and the updated blockchain should be available in both validators.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.