Setting up a sawtooth network with 3 validators, each one is connected to a transaction processor. I'm testing consensus mechanism, so in my TransactionHandler did some intended mess up on setState. In 2 of processors I set the same object in the state and in the other one I set a different value. So every single transaction results in different state in validators.
Is it ok to have different states in different validators? So where is the consensus?

- 485
- 8
- 23
1 Answers
It seems to me if this is occuring, the validator nodes are not peering. The latter transaction will overwrite the former transaction in state. The 3 validator nodes need to be in a peer network. You only create a genesis block (block 0) in the first node. That node is copied to all other nodes in the Sawtooth network.
You can verify the genesis node is the same on all nodes (and that all other nodes are the same) with the sawnet compare-chains
command. Look for a different set of block(s) at the end of the chains.
I recommend starting out creating a Sawtooth network with Docker using a pre-built configuration. For example, use the sawtooth-default-poet.yaml
file found here:
https://sawtooth.hyperledger.org/docs/core/nightly/master/app_developers_guide/creating_sawtooth_network.html
Basically you start
sawtooth-validator -vvv --peering dynamic --seeds tcp://validator-0:8800
The --seeds
parameter specify initial network node(s) and the network dynamically peers with other peer nodes.

- 2,265
- 1
- 9
- 20
-
Hi Dan, again! I have problem setting up network in the way you recommend. After trying to up the file `sawtooth-default-poet.yaml`, got this error: `ERROR: manifest for hyperledger/sawtooth-validator:1.1 not found`. And cannot find related images in dockerhub. I currently use this [configuration](https://gist.github.com/samanshahmohamadi/b37fcf3961586163ed81ca5258f02835) to start the network, which I think includes the right peering setting.I will try to compare chains. Can you please tell me that is there a problem with different states on different validators or not? – saman.shahmohamadi Oct 16 '18 at 07:51
-
1Another point is after starting docker file, I get this debug log in the terminal: `sawtooth-validator-default-0 | [2018-10-16 08:21:29.747 DEBUG interconnect] No response from 2472eede25fd3a2b34d214b066e9263dfc4b62adc80c65bc5f766c210c59d758d195c6e6d3a082e9e4f665a76ef4ec9c194d3bcaf45d5f188f2cfd91336f6ee9 in 10.005146980285645 seconds - beginning heartbeat pings.` This means that the connection between genesis node and peer nodes has a problem. I commented the [log](https://gist.github.com/samanshahmohamadi/b37fcf3961586163ed81ca5258f02835#gistcomment-2733659) in the gist. – saman.shahmohamadi Oct 16 '18 at 08:31
-
The ERROR: manifest for hyperledger/sawtooth-validator:1.1 not found is because of a mismatch between the documentation (1.1) and installed packages (1.0). You need to use either Sawtooth1.0 documentation and packages, or 1.1 documentation and packages. Also Sawtooth 1.1 is not released yet and is in development (bleeding edge)--the Sawtooth 1.1 Docker image is not available yet. See my other answer at https://stackoverflow.com/questions/52793943/how-to-deploy-a-hyperledger-sawtooth-network-with-multiple-validators/52820869#52820869 – Dan Anderson Oct 17 '18 at 23:43
-
It seems that peering is done correctly. When I submit a transaction request to one of rest-apis, all of the 3 transaction processors receive that, new block is created and updating state is done as expected. And peering configuration is same as what you wrote in the answer. The problem begins when I intentionally update the state of validators in different ways, in response of single same transaction (by inserting different values in state in each transaction processor). So is there any type of **invalid** transaction? Is it ok to have different states in different validators?Thanks. – saman.shahmohamadi Oct 23 '18 at 11:31
-
I must add that first block of all chains are the same. The `sawnet compare-chains` command throws error but the block ids are the same. – saman.shahmohamadi Oct 23 '18 at 11:33