Skip to content

Commit 4f9516f

Browse files
authored
Merge pull request #22 from paritytech/automation-common-steps
Update parachain deployment guide to use chain-spec-builder
2 parents 5788252 + 4b600ff commit 4f9516f

File tree

6 files changed

+263
-279
lines changed

6 files changed

+263
-279
lines changed

src/SUMMARY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
- [Grafana](./monitoring/grafana.md)
2222
- [Alertmanager](./monitoring/alertmanager.md)
2323
- [Loki](./monitoring/loki.md)
24-
- [Keys And Accounts](./keys_accounts.md)
25-
- [Custom Relay/Solo Chain](./customchain.md)
24+
- [Keys And Accounts](./explanations/keys_accounts.md)
25+
- [Chainspecs](./explanations/chainspecs.md)
2626
- [References](./references/index.md)

src/customchain.md

Lines changed: 0 additions & 56 deletions
This file was deleted.

src/explanations/chainspecs.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Custom Chain - Chainspecs
2+
3+
This section will explain what is required to build a custom chain spec for your own network.
4+
For more in depth explanations on how chainspecs works internally, refer to the [Polkadot-sdk Chainspec docs](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/reference_docs/chain_spec_genesis/index.html)
5+
6+
## Create Chain Spec
7+
8+
Create a non-raw chainspec for your network with:
9+
10+
```bash
11+
./binary build-spec –chain chain-name --disable-default-bootnode > custom-chainspec.json
12+
```
13+
14+
**Important Fields**:
15+
16+
| Field | Purpose |
17+
|------------------------|----------------------------------------------------------------------|
18+
| Name | Name of the network |
19+
| id | Id of network, also used for the filesystem path |
20+
| bootNodes | List of multiaddr’s of bootnodes for the network |
21+
| protocolId | A unique identifier for the protocol |
22+
| para_id | (Parachains only) numerical ID of the parachain slot |
23+
| relay_chain | (Parachains only) Id of the relaychain to connect to |
24+
| genesis.runtimeGenesis | (Plain chainspec only) Configuration of the genesis runtime |
25+
| genesis.raw | (Raw chainspec only) Serialization of the raw of the genesis storage |
26+
27+
Once the values have been updated this chainspec should be converted in raw format using the command:
28+
29+
```bash
30+
polkadot build-spec –chain custom-chainspec.json –raw > custom-chainspec-raw.json
31+
```

src/explanations/keys_accounts.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Keys And Accounts
2+
3+
This page will describe some basic information on keys and accounts. For a more general and detailed explanation see [learn accounts](https://wiki.polkadot.network/docs/learn-accounts) on the polkadot wiki page.
4+
5+
## Encryption Schemes
6+
7+
| Name | Type |
8+
| ------- | ---------------------------------------------------------------------------- |
9+
| ed25519 | The vanilla ed25519 implementation using Schnorr signatures. |
10+
| sr25519 | The Schnorrkel/Ristretto sr25519 variant using Schnorr signatures. (default) |
11+
| ecdsa | ECDSA signatures on secp256k1 |
12+
13+
## Session Key Types
14+
15+
| Name | Type |
16+
|---------------------| ------- |
17+
| grandpa | ed25519 |
18+
| authority_discovery | sr25519 |
19+
| aura | sr25519 |
20+
| babe | sr25519 |
21+
| para_validator | sr25519 |
22+
| para_assignment | sr25519 |
23+
| beefy | ecdsa |
24+
25+
## Key Generation and Inspection
26+
27+
You can use `polkadot-parachain keys` or the `subkey` command to generate and inspect keys.
28+
29+
Two important subcommands are:
30+
31+
- `generate` Create a new random account and print the private key data or save to a file.
32+
- `inspect` View the account data for an account by passing a secret phrase or seed.
33+
34+
Some important options are:
35+
36+
- `--network` specify the network the keys will be used on, default is substrate.
37+
- `--scheme` the scheme for the keys, default is sr25519.
38+
39+
## Generate
40+
41+
### Create a Random Account Key
42+
43+
```bash
44+
$ polkadot-parachain key generate
45+
Secret phrase: test test test test test test test test test test test junk
46+
Network ID: substrate
47+
Secret seed: 0x4ca479f5e0dc0ee04ebcbadb64c220267dad42b8cfa4da1f0874787523b4709c
48+
Public key (hex): 0xd000ac5048ae858aca2e6aa43e00661562a47026fe88ff83992430204a159752
49+
Account ID: 0xd000ac5048ae858aca2e6aa43e00661562a47026fe88ff83992430204a159752
50+
Public key (SS58): 5GmS1wtCfR4tK5SSgnZbVT4kYw5W8NmxmijcsxCQE6oLW6A8
51+
SS58 Address: 5GmS1wtCfR4tK5SSgnZbVT4kYw5W8NmxmijcsxCQE6oLW6A8
52+
```
53+
54+
You can save it to a file using
55+
56+
## Inspection
57+
58+
### Inspect Created Key
59+
60+
```bash
61+
$ polkadot-parachain key inspect "test test test test test test test test test test test junk"
62+
Secret phrase: test test test test test test test test test test test junk
63+
Network ID: substrate
64+
Secret seed: 0x4ca479f5e0dc0ee04ebcbadb64c220267dad42b8cfa4da1f0874787523b4709c
65+
Public key (hex): 0xd000ac5048ae858aca2e6aa43e00661562a47026fe88ff83992430204a159752
66+
Account ID: 0xd000ac5048ae858aca2e6aa43e00661562a47026fe88ff83992430204a159752
67+
Public key (SS58): 5GmS1wtCfR4tK5SSgnZbVT4kYw5W8NmxmijcsxCQE6oLW6A8
68+
SS58 Address: 5GmS1wtCfR4tK5SSgnZbVT4kYw5W8NmxmijcsxCQE6oLW6A8
69+
```
70+
71+
### Inspect Created Key With Hard Derivation //Stash//0
72+
73+
```bash
74+
$ polkadot-parachain key inspect " test test test test test test test test test test test junk//Stash//0"
75+
Secret Key URI ` test test test test test test test test test test test junk//Stash//0` is account:
76+
Network ID: substrate
77+
Secret seed: 0x88f170a1438f83de6c2b845282ebb577dfcaee4c896655e64777ba220b3ad33d
78+
Public key (hex): 0xa2a73aaf576ed83371c92642a80706bf4b007c40f689d649aa7b075833d7242c
79+
Account ID: 0xa2a73aaf576ed83371c92642a80706bf4b007c40f689d649aa7b075833d7242c
80+
Public key (SS58): 5FjyHtMBm7kArqgSX52DAQvZeJ2Tq5sQBwFfSmZ3NWMHs4Be
81+
SS58 Address: 5FjyHtMBm7kArqgSX52DAQvZeJ2Tq5sQBwFfSmZ3NWMHs4Be
82+
```
83+
84+
## Managing a node session keys
85+
86+
In Polkadot, **Session Keys** refer to the hot keys set on a node to perform various network operations, such as collating or validating blocks.
87+
88+
### Create new session keys on a node via the `author_rotateKeys` RPC method
89+
90+
On the remote machine hosting the node, you can create new session keys with the following commmand:
91+
92+
```bash
93+
curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "author_rotateKeys", "params":[]}' http://localhost:9944
94+
```
95+
96+
The response output will then show the hex-encoded concatenation of the session public keys. This is intended to be submitted on-chain using the [session.setKeys extrinsics](https://wiki.polkadot.network/docs/maintain-guides-how-to-validate-polkadot#submitting-the-setkeys-transaction).
97+
98+
### Insert a specific key onto a node keystore via the `author_insertKey` RPC method
99+
100+
To inject a key via RPC, use the following command:
101+
102+
```bash
103+
curl -H "Content-Type: application/json" \ --data '{ "jsonrpc":"2.0", "method":"author_insertKey", "params":["'"${KEY_TYPE}"'", "'"${KEY_SEED}"'"],"id":1 }' http://localhost:9933
104+
```
105+
106+
Set:
107+
* `KEY_TYPE` to a session key type (eg. `babe`, `grandpa`)
108+
* `KEY_SEED` to a secret seed or private key
109+
110+
### Insert a specific key onto a node keystore using the node binary
111+
112+
To inject a key via the node binary, use the following command:
113+
114+
```bash
115+
polkadot-parachain key insert -d <my_chain_folder> --key-type ${KEY_TYPE} --scheme ${KEY_SCHEME} --suri ${KEY_FILE}
116+
```
117+
118+
* `KEY_TYPE`: a session key type (eg. `babe`, `grandpa`)
119+
* `KEY_SCHEME`: an encryption scheme (eg. `sr25519`, `ed25519`, `ecdsa`)
120+
* `KEY_FILE`: a plain text file which contains the seed or private key

0 commit comments

Comments
 (0)