diff --git a/README.md b/README.md index c4f1ab5..629afd5 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,14 @@ If you do not, or have already run the above, run: GOEXPERIMENT=arenas go run ./... +## Peer ID + +In order to find the peer id of a running node, execute the following command from the `node/` folder: + + GOEXPERIMENT=arenas go run ./... --peer-id + +The peer id will be printed to stdout. + ## EXPERIMENTAL – gRPC/REST Support If you want to enable gRPC/REST, add the following entries to your config.yml: diff --git a/node/main.go b/node/main.go index 7467094..c2bd6b9 100644 --- a/node/main.go +++ b/node/main.go @@ -38,11 +38,27 @@ var ( false, "starts the node in database console mode", ) + + peerId = flag.Bool( + "peer-id", + false, + "print the peer id to stdout from the config and exit", + ) ) func main() { flag.Parse() + if *peerId { + config, err := config.LoadConfig(*configDirectory, "") + if err != nil { + panic(err) + } + + printPeerID(config.P2P) + return + } + if *importPrivKey != "" { config, err := config.LoadConfig(*configDirectory, *importPrivKey) if err != nil {