2

I am setting up a private Ethereum network using puppeth whic creates the sealer nodes on various servers.

To aid peer discovery, it has been suggested that we include a list of enodes in the file static-nodes.json for geth to use.

Where do we place static-nodes.json?

  1. The datadir directory containing folders geth and keystore, and the filegeth.ipc`

  2. The datadir/geth directory containing folders chaindata, lightchaindata, nodes, and the files LOCK, nodekey, transactions.rlp?

Additionally, where do we place trusted-nodes.json? Can we let geth use both files trusted-nodes.json and static-nodes.json, or must we choose one of the two to use?

Does the nodes added using admin.addPeer gets stored somewhere, or must we re-add these nodes again if we restart geth?

1
  • You've got too many questions. Split them up to increase the chance of getting an answer. Jul 17, 2018 at 21:05

1 Answer 1

4

Where do we place static-nodes.json? Additionally, where do we place trusted-nodes.json?

If you specify --datadir=./ when running your node, the files: static-nodes.json and trusted-nodes.json should be in the current directory.

If for example you do not specify the datadir directory, place the files next to the nodekey, keystore folders (on the same level)

Does the nodes added using admin.addPeer gets stored somewhere, or must we re-add these nodes again if we restart geth?

Using admin.addPeer is volatile, it will not be persisted on the disk.

3
  • If you do not specify a directory, will the datadir be ~/.ethereum? In this case, you will add static-nodes.json to ~/.ethereum, but in my case my directory has the directories geth and keystore, but nodekey file is inside the geth folder. Where then should I place static-nodes.json? Jul 17, 2018 at 22:34
  • 1
    @AthenaWisdom any resolution or workaround? I have the same question, and I'm thinking just put it in both places using a symlink.
    – CivFan
    Jan 20, 2021 at 18:42
  • It worked for me in the geth folder, so next to nodekey file, not next to keystore folder which is in the datadir folder (or ~/.ethereum in your case).
    – Thykof
    Mar 6, 2021 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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