Skip to content

Commit e247153

Browse files
author
Max Gravitt
committed
adding parachain docs
1 parent b841b74 commit e247153

File tree

3 files changed

+202
-0
lines changed

3 files changed

+202
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Add your key to Genesis Spec for MD5
2+
3+
1. Install `subkey`
4+
https://docs.substrate.io/reference/command-line-tools/subkey/
5+
6+
7+
2. Generate a key
8+
```bash
9+
subkey generate
10+
```
11+
12+
Output looks like this:
13+
```
14+
Secret phrase: pear afraid genre damage fury visa gentle divert vocal risk local boil
15+
Network ID: substrate
16+
Secret seed: 0xddb2eb2b38cf69a0db0397e9aaf47bb48d71437d037a225be92acf178db3810c
17+
Public key (hex): 0x70140a32dbd165c862b5d1a51b8cebb4ffd07a92ab72fc0beef7c220b8050a5a
18+
Account ID: 0x70140a32dbd165c862b5d1a51b8cebb4ffd07a92ab72fc0beef7c220b8050a5a
19+
Public key (SS58): 5EbfB1K1xes3uywAZ5MwXZc1vUZMYbGZuMiY5BojSWs2r7FD
20+
SS58 Address: 5EbfB1K1xes3uywAZ5MwXZc1vUZMYbGZuMiY5BojSWs2r7FD
21+
```
22+
23+
3. Edit `node/src/chain_spec/md5.rs`
24+
25+
In the genesis configuration, there is a vector of addresses:
26+
27+
```rust
28+
vec![
29+
// 5HgAxuAcEybo448w5BZdoceCuHMAbEW9AetBKsj9s5GEBZT3
30+
hex!["f83a0218e100ce3ede12c5d403116ef034124c62b181fff6935403cea9396d2f"].into(),
31+
// 5DkJvQp2gqHraWZU1BNCDxEKTQHezn2Qy7z5hLPksUdjtEG9
32+
hex!["4a70d789b0f0897e0880e8d3d532187ac77cbda04228cfadf8bededdd0b1005e"].into(),
33+
get_account_id_from_seed::<sr25519::Public>("Alice"),
34+
get_account_id_from_seed::<sr25519::Public>("Bob"),
35+
```
36+
37+
Add a new `hex!` line with the hex public key from `subkey`. Be sure to remove the `0x` prefix.
38+
39+
4. Recompile, test, push

docs/parachain/quick-start.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Quick Start
2+
This is a quick guide on connecting the parachain to a local testnet relay chain.
3+
4+
# Launch the Relay Chain
5+
```bash
6+
cd ~/github.com/paritytech
7+
8+
git clone https://github.com/paritytech/polkadot
9+
cd polkadot
10+
11+
cargo build --release
12+
13+
# Generate a raw chain spec
14+
./target/release/polkadot build-spec --chain rococo-local --disable-default-bootnode --raw > ~/github.com/paritytech/polkadot/rococo-custom-2-raw.json
15+
16+
# Alice
17+
./target/release/polkadot --alice --validator --base-path /tmp/relay/alice --chain ~/github.com/paritytech/polkadot/rococo-custom-2-raw.json --port 30333 --ws-port 9944
18+
19+
# Bob (In a separate terminal)
20+
./target/release/polkadot --bob --validator --base-path /tmp/relay/bob --chain ~/github.com/paritytech/polkadot/rococo-custom-2-raw.json --port 30334 --ws-port 9945
21+
```
22+
23+
# Reserve the Para ID
24+
Go to https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/parachains/parathreads
25+
26+
and Click `+ParaID`
27+
28+
# Launch the Parachain
29+
```bash
30+
31+
cd ~/github.com/hashed-io
32+
33+
git clone https://github.com/hashed-io/hashed-parachain
34+
cd hashed-parachain
35+
36+
cargo build --release
37+
38+
./target/release/hashed-parachain build-spec --chain md5 --disable-default-bootnode > md5-local-parachain.json
39+
```
40+
41+
# Add the ParaID
42+
Update `md5-local-parachain.json` and change the parachain ID to 2000 in two places.
43+
44+
```json
45+
// --snip--
46+
"para_id": 2000,
47+
// --snip--
48+
"parachainInfo": {
49+
"parachainId": 2000
50+
},
51+
// --snip--
52+
```
53+
54+
# Build the Raw Spec File
55+
```bash
56+
# build raw spec
57+
./target/release/hashed-parachain build-spec --chain md5-local-parachain.json --raw --disable-default-bootnode > md5-local-parachain-raw.json
58+
```
59+
60+
# Building genesis state and wasm files
61+
```bash
62+
./target/release/hashed-parachain export-genesis-state --chain md5-local-parachain-raw.json > md5-genesis-head
63+
64+
./target/release/hashed-parachain export-genesis-wasm --chain md5-local-parachain-raw.json > md5-wasm
65+
```
66+
67+
# Start Collator
68+
```bash
69+
./target/release/hashed-parachain \
70+
--alice \
71+
--collator \
72+
--force-authoring \
73+
--chain md5-local-parachain-raw.json \
74+
--base-path /tmp/parachain/alice \
75+
--port 40333 \
76+
--ws-port 8844 \
77+
-- \
78+
--execution wasm \
79+
--chain ~/github.com/paritytech/polkadot/rococo-custom-2-raw.json \
80+
--port 30343 \
81+
--ws-port 9977
82+
83+
```
84+
85+
## Sudo Register the parachain
86+
![image](https://user-images.githubusercontent.com/2915325/99548884-1be13580-2987-11eb-9a8b-20be658d34f9.png)
87+
88+
89+
### Purging the Chains
90+
```bash
91+
# Purge a chain
92+
./target/release/hashed-parachain \
93+
purge-chain \
94+
--base-path /tmp/parachain/alice \
95+
--chain ~/github.com/hashed-io/hashed-parachain/md5-local-parachain-raw.json
96+
97+
# Purge relay chain
98+
./target/release/polkadot purge-chain --base-path /tmp/relay/alice --chain ~/github.com/paritytech/polkadot/rococo-custom-2-raw.json
99+
100+
# Sometimes I use this:
101+
rm -rf /tmp/relay && rm -rf /tmp/parachain
102+
```

docs/parachain/rococo.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Connecting MD5 to Rococo
2+
3+
The MD5 Network is `ParaId = 4088` for now. We are using a temporary status. Once we have a Kusama parachain slot, we can apply for a Rococo permanent slot for testing. This is hard-coded in the `md5.rs` chain_spec currently.
4+
5+
# Create the Rococo spec (could also download one)
6+
```bash
7+
cd ~/github.com/paritytech
8+
9+
git clone https://github.com/paritytech/polkadot
10+
cd polkadot
11+
12+
cargo build --release
13+
14+
# Generate a raw chain spec
15+
./target/release/polkadot build-spec --chain rococo --disable-default-bootnode --raw > ~/github.com/paritytech/polkadot/rococo-raw.json
16+
```
17+
18+
# Build the Collator
19+
```bash
20+
21+
cd ~/github.com/hashed-io
22+
23+
git clone https://github.com/hashed-io/hashed-parachain
24+
cd hashed-parachain
25+
26+
cargo build --release
27+
```
28+
29+
# Build the `md5-spec-raw.json` file using defaults
30+
31+
```bash
32+
# build raw spec
33+
./target/release/hashed-parachain build-spec --chain md5 --raw --disable-default-bootnode > md5-spec-raw.json
34+
```
35+
36+
# Building genesis state and wasm files
37+
```bash
38+
./target/release/hashed-parachain export-genesis-state --chain resources/md5-spec-raw.json > md5-genesis-head
39+
./target/release/hashed-parachain export-genesis-wasm --chain resources/md5-spec-raw.json > md5-wasm
40+
```
41+
42+
# Start Collator
43+
```bash
44+
./target/release/hashed-parachain \
45+
--alice \
46+
--collator \
47+
--force-authoring \
48+
--chain resources/md5-spec-raw.json \
49+
--base-path ~/chain-data/md5 \
50+
--port 40333 \
51+
--ws-port 8844 \
52+
-- \
53+
--execution wasm \
54+
--chain ~/github.com/paritytech/polkadot/rococo-raw.json \
55+
--port 30343 \
56+
--ws-port 9977
57+
```
58+
59+
# Register the parachain
60+
61+
### In Process

0 commit comments

Comments
 (0)