Boostrap the nodes having PeerIDs generated and passed

I’m having some issue to configure kubo nodes.
I would like to set Peering.Peers with the command:

ipfs config --json Peering.Peers

In order to do that I need the PeerID of the nodes to put in the configuration

[
    {
      "ID": "",
      "Addrs": [
        "/dns4/gnome-kubo-ipfs01-0/tcp/4001",
        "/dns4/gnome-kubo-ipfs01-0/udp/4001/quic-v1"
      ]
    },
    {
      "ID": "",
      "Addrs": [
        "/dns4/gnome-kubo-ipfs02-0/tcp/4001",
        "/dns4/gnome-kubo-ipfs02-0/udp/4001/quic-v1"
      ]
    }
  ]

The PeerIDs are generated at the bootstrap time witht he command ipfs init which is executed at the first run of the node when the IPFS_PATH folder is not present.

How can I generate PeerID and add in the config to be passed at the bootstrap time?

You could find relevant go code for generating private and public keys from a seed in rainbow repo:

With this, you can write small tool and have a secret seed and use it for generating arbitrary number of PeerIDs in deterministic fashion. Just make sure to not leak seed / b57secret :slight_smile:

Kubo uses the same key format, just serialize it into Identity section of Kubo config (in PeerID and PrivKey).

What I’m super curious about is why this tooling doesn’t exist in kubo? Why do we all need to re-invent the wheel and write software to generate something that kubo can already generate?

Some manner of cli option that outputs those values without having to extract it from the config file would be really nice for automation purposes.

ipfs key gen appears to be half of the equation giving you the PeerID (I think?) but then you still need to get the PrivKey value to stuff into the config.

I think the answer is prosaic: it was not requested before because people worked around it in userland, and did not bother to ask because they needed a fix today, and not in N weeks.

Kubo RPC/CLI command for generating peerid / priv/pub key pair from some seed and index is a sensible quality of life feature request.

Feel free to fill feature request at Issues · ipfs/kubo · GitHub (or PR implementation if you’d like to see it sooner than later – I’m happy to lend review time).

I too need it today and not in N weeks. :smiley:

I’ll work around it for now, but I’ll definitely take the time to submit a PR. I think this would be a great thing to help facilitate people like me who are trying to setup private bootstrap nodes.

Thanks!

2 Likes