subsembly
  • Introduction
  • Getting Started
    • Overview
    • Substrate Essentials
    • CLI
      • subsembly init
      • subsembly compile
      • subsembly spec
  • Development
    • Runtime Development
    • Chain Specification
    • Runtime Execution
  • Modules
    • Core
      • System
      • Executive
      • Crypto
      • Log
    • Pre-built
      • Aura
      • Balances
      • Timestamp
      • TransactionPayment
  • Advanced
    • as-scale-codec
    • subsembly-core
    • Metadata
      • Dispatcher
  • Guides
    • Create Your First Subsembly Runtime
      • Set Up
      • Start the Node
      • PolkadotJS
    • Start Your Network
      • Prepare the Network
      • Launch Validator Nodes
      • Launch the Third Node
    • Create a New Module
      • Nicks Module
      • Launch the Node
      • PolkadotJs
Powered by GitBook
On this page
  • Overview
  • Option 1: Subkey
  • Option 2: PolkadotJs
  • Modify the Chain Spec

Was this helpful?

  1. Guides
  2. Start Your Network

Prepare the Network

PreviousStart Your NetworkNextLaunch Validator Nodes

Last updated 4 years ago

Was this helpful?

Overview

Each node who wants to participate as validator in the blockchain network must generate their own private/public keys. In this section, we will generate two keys for the 2 validator nodes - Alice and Bob.

Option 1: Subkey

Subkey is a tool that generates keys specifically designed to be used with Substrate. The installation instructions can be found .

After you've installed the tool, it's time to generate the validator keys. We need to generate sr25519 keys that will be used by Aura for block production.

subkey generate --scheme sr25519

You should see output similar to this:

Secret phrase `lady demand candy vacuum warm nurse shaft garment horror list burst strike` is account:
  Secret seed:      0xfd3a2bd1b11943302b4a007857189629be5ae7ba55bf90a15f6eca939d6c763b
  Public key (hex): 0xec9fd69c119fb45b6f6efca397db3e864649e6903cf227d4609ed53a66d3bf1e
  Account ID:       0xec9fd69c119fb45b6f6efca397db3e864649e6903cf227d4609ed53a66d3bf1e
  SS58 Address:     5HQxe4hw4bZm5uK4kUeq3Wkvw7Uem7NesYjB53BjAUizNZN6

Important

Make sure to save your mnemonic phrase, public key and SS58 address variables as they will be used later.

Perform the key generation twice, for both of the nodes and save the mnemonic, public key and SS58 address for the second generation as-well.

Option 2: PolkadotJs

You can also generate your own keys using PolkadotJs interface. In the Accounts tab, select Add Account button. This will generate sr25519 keys by default. Again, make sure to save your mnemonic seed and public key.

For example:

Modify the Chain Spec

//--snip--//
"runtime": {
      "system": {
        "code": "0x"
      },
      "aura": {
        "authorities": [
          "5H49oi57ktRnYTbhVtKpGGk79rB9QXNcApYELLWcKa9W8nfs"
        ]
      }
    }
    //--snip--//

aura.authorities property in the chain spec defines the list of public keys or authorities that have the right to produce blocks. Delete the already specified authority in the list and add the 2 SS58 addresses that you generated

//--snip--/
"runtime": {
      "system": {
        "code": "0x"
      },
      "aura": {
        "authorities": [
          "5H49oi57ktRnYTbhVtKpGGk79rB9QXNcApYELLWcKa9W8nfs",
          "5HQxe4hw4bZm5uK4kUeq3Wkvw7Uem7NesYjB53BjAUizNZN6"
        ]
      }
    }
    //--snip--/

And don't forget to convert your modified chain spec into raw:

subsembly spec --src=./chain-spec.json

We have already done this step in the last and in the section. So the default content of chain-spec.json looks like this:

here
guide
Development
Picture 1. Account generation