I have set up a public sync node and a private baking node. The private baking node only gets blocks from the public node.

As recommended in the Tezos Docs, I start the private node with: ./tezos-node run --rpc-addr --private-mode --no-bootstrap-peers --bootstrap-threshold=1 --connections 1 --peer A.A.A.A:9732 (where A.A.A.A is my public nodes IP).

Both nodes are configured to trust each others identity.

Every time my private node is started, it does not connect to the public node. But if I run ./tezos-admin-client connect address A.A.A.A:9732 after startup, it connects fine until after next restart or any loss of connection.

Nothing in the private or public nodes logs indicate that the private node tried to connect by itself at startup.

How can I configure my private node to automatically connect to my public node?

  • does it help upping the --connections 1? I think even one public node takes more than 1 connection. – Frank Apr 18 '19 at 16:04

The --connections argument is actually a helper for setting several different configuration fields.

To see this you can use the tezos-node config init and tezos-node config update commands to convert the command line arguments into configuration JSON, e.g.:

tezos-node config init ... --connections 1 ...

In the config file (~/.tezos-node/config.json by default) you will find:

  • p2p.limits.min-connections
  • p2p.limits.expected-connections
  • p2p.limits.max-connections
  • shell.chain_validator.bootstrap_threshold

Unfortunately, using --connections 1 sets nonsensical values to these fields. For one connection to a peer, I recommend editing the config file manually. The following values have worked well for me:

  • "min-connections": 1
  • "expected-connections": 1
  • "max-connections": 1
  • "bootstrap_threshold": 1

The min/expected/max fields can only be directly supplied in the config file, not via command line arguments.

  • Non-sensical indeed. "--connections 1" apparently gives "min-connections": 0 - so it never tries to connect automatically. – Svante Apr 23 '19 at 8:45

These are settings of my private node which are registered in config.json

{ "data-dir": "/usr/data/.tezos-node", "rpc": { "listen-addr": "" }, "p2p": { "bootstrap-peers": [ "A.A.A.A:9732", "A.A.A.A:9732", "A.A.A.A:9732" ], "listen-addr": "[::]:9732", "private-mode": true, "limits": { "connection-timeout": 10, "min-connections": 1, "expected-connections": 2, "max-connections": 3, "max_known_points": [ 16, 12 ], "max_known_peer_ids": [ 16, 12 ] } }, "shell": { "chain_validator": { "bootstrap_threshold": 1 } } }

These are settings of my public node which are registered in config.json

{ "rpc": { "listen-addr": "" }, "p2p": { "listen-addr": "[::]:9732", "limits": { "connection-timeout": 10, "min-connections": 250, "expected-connections": 500, "max-connections": 750, "max_known_points": [ 4000, 3000 ], "max_known_peer_ids": [ 4000, 3000 ] } }, "shell": { "chain_validator": { "bootstrap_threshold": 2 } } }

Works great

  • Thank you for your answer! I accepted Toms answer because it explains more of the background of the problem, but your config example definitely also helped me. – Svante Apr 23 '19 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.