1

I'm new to sawtooth and I'm currently trying to put on two separated hosts (within the same LAN network for now) two sawtooth nodes.

I've used the sawtooth-default-poet.yaml compose file from the docs as a starting point. As you can see from my repository I've created two separated compose files:

On the second host I've also created a .env file with

SEEDS=tcp://<local-ip-of-first-node>:8800

To reference the first node.

Everything works fine when I lunch the two compose files on the same docker network but for some reason it doesn't work when they are separated.

Output on the second node:

sawtooth-shell                | creating key directory: /root/.sawtooth/keys
sawtooth-shell                | writing file: /root/.sawtooth/keys/root.priv
sawtooth-shell                | writing file: /root/.sawtooth/keys/root.pub
sawtooth-validator            | writing file: /etc/sawtooth/keys/validator.priv
sawtooth-validator            | writing file: /etc/sawtooth/keys/validator.pub
sawtooth-validator            | [2019-10-04 16:45:13.756 WARNING  (unknown file)] [src/pylogger.rs: 40] Started logger at level INFO
sawtooth-validator            | [2019-10-04 16:45:14.275 INFO     path] Skipping path loading from non-existent config file: /etc/sawtooth/path.toml
sawtooth-validator            | [2019-10-04 16:45:14.275 INFO     validator] Skipping validator config loading from non-existent config file: /etc/sawtooth/validator.toml
sawtooth-validator            | [2019-10-04 16:45:14.275 INFO     keys] Loading signing key: /etc/sawtooth/keys/validator.priv
sawtooth-validator            | [2019-10-04 16:45:14.278 INFO     cli] sawtooth-validator (Hyperledger Sawtooth) version 1.1.5
sawtooth-validator            | [2019-10-04 16:45:14.278 INFO     cli] config [path]: config_dir = "/etc/sawtooth"; config [path]: key_dir = "/etc/sawtooth/keys"; config [path]: data_dir = "/var/lib/sawtooth"; config [path]: log_dir = "/var/log/sawtooth"; config [path]: policy_dir = "/etc/sawtooth/policy"
sawtooth-validator            | [2019-10-04 16:45:14.278 WARNING  cli] Network key pair is not configured, Network communications between validators will not be authenticated or encrypted.
sawtooth-validator            | [2019-10-04 16:45:14.282 INFO     state_verifier] Skipping state verification: chain head's state root is present
sawtooth-validator            | [2019-10-04 16:45:14.282 INFO     cli] Starting validator with serial scheduler
sawtooth-validator            | [2019-10-04 16:45:14.290 INFO     interconnect] Listening on tcp://eth0:4004
sawtooth-validator            | [2019-10-04 16:45:14.291 INFO     genesis] No chain head and not the genesis node: starting in peering mode
sawtooth-validator            | [2019-10-04 16:45:14.292 INFO     interconnect] Listening on tcp://eth0:5050
sawtooth-validator            | [2019-10-04 16:45:14.294 INFO     interconnect] Listening on tcp://eth0:8800
sawtooth-validator            | [2019-10-04 16:45:14.329 WARNING  processor_handlers] Max occupancy was not provided by transaction processor: dcd9a6df19637eab1028f8de01d68cd5685fd013adb8f7d3f8bb878f2fd9e8e5b4d3022dfe0118cd66fef6ee3dce82cf993f12ce6bd72544e7af06a008eb9dd8. Using default max occupancy: 10
sawtooth-validator            | [2019-10-04 16:45:14.329 INFO     processor_handlers] registered transaction processor: connection_id=dcd9a6df19637eab1028f8de01d68cd5685fd013adb8f7d3f8bb878f2fd9e8e5b4d3022dfe0118cd66fef6ee3dce82cf993f12ce6bd72544e7af06a008eb9dd8, family=sawtooth_validator_registry, version=1.0, namespaces=['6a4372'], max_occupancy=10
sawtooth-validator            | [2019-10-04 16:45:14.342 WARNING  processor_handlers] Max occupancy was not provided by transaction processor: 8a563ac3d673e8bb3f6948afdff1330c4954aa5ab2de947cf33d8458a369f1720ac8b2482e1cc60e304fe6dfaae6e627579e9ed841ee8c58d7d4f4e9c9b41c2a. Using default max occupancy: 10
sawtooth-validator            | [2019-10-04 16:45:14.342 INFO     processor_handlers] registered transaction processor: connection_id=8a563ac3d673e8bb3f6948afdff1330c4954aa5ab2de947cf33d8458a369f1720ac8b2482e1cc60e304fe6dfaae6e627579e9ed841ee8c58d7d4f4e9c9b41c2a, family=xo, version=1.0, namespaces=['5b7349'], max_occupancy=10
sawtooth-xo-tp-python         | [2019-10-04 16:45:14.344 INFO     core] register attempt: OK
sawtooth-validator            | [2019-10-04 16:45:14.383 WARNING  processor_handlers] Max occupancy was not provided by transaction processor: 2491d626ce1ca6f4a26d2e1fbed090be730c7653f0b944626e0ea02947777da03e060612ada85a677896cfcb4bf36539f2036c9d540465a6ade56f80bda73de9. Using default max occupancy: 10
sawtooth-validator            | [2019-10-04 16:45:14.384 INFO     processor_handlers] registered transaction processor: connection_id=2491d626ce1ca6f4a26d2e1fbed090be730c7653f0b944626e0ea02947777da03e060612ada85a677896cfcb4bf36539f2036c9d540465a6ade56f80bda73de9, family=sawtooth_settings, version=1.0, namespaces=['000000'], max_occupancy=10
sawtooth-validator            | [2019-10-04 16:45:14.401 WARNING  processor_handlers] Max occupancy was not provided by transaction processor: c539c47206892b86bcf2d08359122faf2ec1dc14d5b5a1615b12578eca461101786d18315ea8b7db356a5fbd5ba8597db21a5846b1bbee413782916c2c420151. Using default max occupancy: 10
sawtooth-validator            | [2019-10-04 16:45:14.402 INFO     processor_handlers] registered transaction processor: connection_id=c539c47206892b86bcf2d08359122faf2ec1dc14d5b5a1615b12578eca461101786d18315ea8b7db356a5fbd5ba8597db21a5846b1bbee413782916c2c420151, family=intkey, version=1.0, namespaces=['1cf126'], max_occupancy=10
sawtooth-validator            | [2019-10-04 16:45:47.387 WARNING  dispatch] Attempted to remove send_message function for connection OutboundConnectionThread-tcp://192.168.1.118:8800, but no send_message function was registered
sawtooth-validator            | [2019-10-04 16:45:47.387 WARNING  dispatch] Attempted to remove send_last_message function for connection OutboundConnectionThread-tcp://192.168.1.118:8800, but no send_last_message function was registered

Where the last two messages are repeated every minute or so.

At first, I didn't knew the difference between using expose or ports in a docker-compose file.
Anyway, now, even if I use ports to expose the port 8800 to the external network, for the validator, my problem persists.

Why is this happening?

β.εηοιτ.βε
  • 33,893
  • 13
  • 69
  • 83

2 Answers2

1

The Docker compose files listed in the question are standalone and are not intended to work across Docker networks. You can try and carefully combine them into one Docker file.

If you want two Docker compose files, you must make sure that the network ports are open and accessible to the various containers. In case of running these Docker compose files on multiple hosts, you need to map the container port to the host machine. Otherwise, the containers running in another host cannot reach them. So to answer the question, you have to use "ports" tag for the validator container and make sure the validator's container port 8800 is seen by other host machine.

More information on using the "ports" can be found here https://docs.docker.com/compose/compose-file/

Additionally, see this list of Sawtooth TCP ports: https://sawtooth.hyperledger.org/faq/validator/#what-tcp-ports-does-sawtooth-use

Arun
  • 592
  • 3
  • 13
Dan Anderson
  • 2,265
  • 1
  • 9
  • 20
1

The Docker compose files you have mentioned in the question can run the Hyperledger Sawtooth network on same host. If you plan to run those compose files on different hosts and make the validator containers talk to each other, then they need to be discoverable.

Even though you set SEEDS in the .env file, the validator container in https://github.com/danipisca07/sawtooth_playground/blob/master/sawtooth-node.yaml is not discoverable to the validator container in https://github.com/danipisca07/sawtooth_playground/blob/master/sawtooth-default-poet-genesis.yaml

To make the validator services talk to each other, you can make use of the ports tag in the Docker compose file. This will allow you to map the container port to the host machine's port. Thus your host will now be available to another machine in the local network. You need to use ports on the genesis node's host as well. This is for the validator on other host to pair with.

For example, your genesis node's validator service would look like

validator-0:
image: hyperledger/sawtooth-validator:1.1
container_name: sawtooth-validator-0
expose:
  - 4004
  - 5050
  - 8000
  - 8800
ports:
  - "8800:8800"
...

The example shown above maps host machine's port 8800 to the containers 8800 port.

Here's the document on how to use the ports tag in the compose file https://docs.docker.com/compose/compose-file/

Arun
  • 592
  • 3
  • 13