Now that we know the fundamentals and the command line options, it's time to generate our own keys rather than using the well-known Alice and Bob keys. Each person who wants to participate in the blockchain should generate their own keys. This page explains several options for generating keys, and each participant only needs to choose one such option. Regardless of which option you choose, be sure to record all of the output from this section as you will need it later.
Option 1: Subkey
Subkey is a tool that generates keys specifically designed to be used with Substrate.
Begin by compiling and installing the utility. This may take up to 15 minutes or so.
cargo install --force subkey --git https://github.com/paritytech/substrate --version 2.0.0
We will need to generate at least 2 keys from each type. Every node will need to have its own keys.
Generate a mnemonic and see the
sr25519 key and address associated with it. This key will be used
by Aura for block production.
$ subkey generate --scheme sr25519 Secret phrase `infant salmon buzz patrol maple subject turtle cute legend song vital leisure` is account: Secret seed: 0xa2b0200f9666b743402289ca4f7e79c9a4a52ce129365578521b0b75396bd242 Public key (hex): 0x0a11c9bcc81f8bd314e80bc51cbfacf30eaeb57e863196a79cccdc8bf4750d21 Account ID: 0x0a11c9bcc81f8bd314e80bc51cbfacf30eaeb57e863196a79cccdc8bf4750d21 SS58 Address: 5CHucvTwrPg8L2tjneVoemApqXcUaEdUDsCEPyE7aDwrtR8D
Now see the
ed25519 key and address associated with the same mnemonic. This key will be used by
GRANDPA for block finalization.
$ subkey inspect --scheme ed25519 "infant salmon buzz patrol maple subject turtle cute legend song vital leisure" Secret phrase `infant salmon buzz patrol maple subject turtle cute legend song vital leisure` is account: Secret seed: 0xa2b0200f9666b743402289ca4f7e79c9a4a52ce129365578521b0b75396bd242 Public key (hex): 0x1a0e2bf1e0195a1f5396c5fd209a620a48fe90f6f336d89c89405a0183a857a3 Account ID: 0x1a0e2bf1e0195a1f5396c5fd209a620a48fe90f6f336d89c89405a0183a857a3 SS58 Address: 5CesK3uTmn4NGfD3oyGBd1jrp4EfRyYdtqL3ERe9SXv8jUHb
Learn more about Subkey in the Integrate section.
Option 2: Polkadot-JS Apps
The same UI that we used to see blocks being produced can also be used to generate keys. This option is convenient if you do not want to install Subkey. It can be used for production keys, but the system should not be connected to the internet when generating such keys.
A system that generates production keys should not be connected to the internet regardless of what method you choose. It is mentioned here specifically because having an internet connection is generally desired when using a webapp like Polkadot JS Apps.
On the "Accounts" tab, click "Add account". You do not need to provide a name, although you may if you would like to save this account for submitting transaction in addition to validating.
sr25519 key which will be used by Aura for block production. Take careful note of the
menmonic phrase, and the SS58 address which can be copied by clicking on the identicon in the top
Then generate an
ed25519 key which will be used by GRANDPA for block finalization. Again, note
the menmonic phrase and ss58 address.
Option 3: Use Pre-Generated Keys
If you just want to get on with the tutorial, you may use one of the pre-generated keypairs below. But realize that these keys should absolutely not be used in production, and are provided only for learning purposes.