|
| 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 | + |
| 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 | +``` |
0 commit comments