Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Use Ed25519 for libp2p-level signing #1494

@webmaster128

Description

@webmaster128

When creating a chainspec including boot nodes, libp2p public keys are included, e.g.

  "bootNodes": [
    "/ip4/11.22.33.44/tcp/30333/p2p/QmSZcgM3nxwKMgDuy1FgoDVYbT7nSucwa7s8qnF9o7J8E6"
  ],

This public key is derived from a keypair set via --node-key, which can be auto-generated by substrate. Now if you create the initial bootNodes, the --node-keys must be known at build-spec time. This can be archived by an admin using

cat /dev/urandom | head -c 32 | xxd -p -c 256 > ~/.node_key
substrate --chain=staging --node-key "$(< ~/.node_key)" build-spec ...

As discussed in Rewrite the libp2p networking #742, secp256k1 is used for libp2p-level signing. The problem is: not every 32 byte key is a valid secp256k1 key (value must be < 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141). If we switch to Ed25519, we know that every 32 bytes key is a valid private key. Thus no special secp256k1 tooling is required to generate --node-keys.

Metadata

Metadata

Assignees

Labels

J0-enhancementAn additional feature request.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions