Joystream / Joystream/joystream
Testing Parachain Locally
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.4k
- Forks
- 116
- PR merge metrics
- No merged PRs in 30d
Description
# Relay chain
git clone polkadot from https://github.com/paritytech/polkadot
cd polkadot/
git checkout release-v0.9.4
# Build polkadot
cargo update
cargo update -p jsonrpsee-types -p --precise 0.2.0-alpha.6
cargo build --release
# Generate a rococo-local chainspec
./target/release/polkadot build-spec --chain rococo-local --raw --base-path ~/tmp/alice > ~/tmp/test-relay-chain.json
# Run local rococo relay chain
./target/release/polkadot --chain ~/tmp/test-relay-chain.json --alice --base-path ~/tmp/alice --port 30333 --ws-port 9944
./target/release/polkadot --chain ~/tmp/test-relay-chain.json --bob --base-path ~/tmp/bob --port 30334 --ws-port 9945
# Open polkadot-js api and Reserve parachain id
https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/parachains/parathreads
Click on `(+) ParaId` button. Since this is first time it will get ID 2000
# Check registration
After Tx is finalized you should see `(+) Parathread` - click it to confirm that you can now submit a transaction
to register the parachain, you should see list of parachain ids owned by account used to reserve the parathread id.
# Build parachain code from
git clone https://github.com/iorveth/joystream
cd joystream/
git checkout sumer_parachain
cargo update
cargo update -p jsonrpsee-types -p --precise 0.2.0-alpha.6
cargo build --release
# generate the parachain chain spec
mkdir -p ./parachain-2000
./target/release/chain-spec-builder generate -a 1 -e 1 -k ./parachain-2000/ -c ./parachain-2000/parachain_spec_plain.json > ./parachain-2000/secrets.txt
You should see something similar to this in ./parachain-2000 folder:
.
├── auth-0
│ └── 617572610086f2ea4c86592cf3999875f1dd93115d1b4422e5d8aa2c55792e3df778eb79
├── parachain_spec_plain.json
└── secrets.txt
edit chain_spec_plain.json (name, id, protocolId, and para_id)
"name": "Joystream Testnet Parachain",
"id": "joy_testnet_parachain",
"chainType": "Live",
"bootNodes": [],
"telemetryEndpoints": [],
"protocolId": "/joy/testnet/parachain/0",
"properties": {
"tokenDecimals": 0,
"tokenSymbol": "JOY"
},
"relay_chain": "", // This is irrelevant we will override it
"para_id": 2000, // this would be the value we got during reservation of course
# State export is sensitive to para_id setting make sure to do this after editing the parachain chainspec file.
./target/release/joystream-node export-genesis-state --chain ./parachain-2000/parachain_spec_plain.json > ./parachain-2000/genesis-state
# Export parachain wasm blob
./target/release/joystream-node export-genesis-wasm --chain ./parachain-2000/parachain_spec_plain.json > ./parachain-2000/genesis-wasm
# Copy the Aura session key to the collators keystore
mkdir -p ~/tmp/collator/chains/joy_testnet_parachain/keystore/
cp ./parachain-2000/auth-0/* ~/tmp/collator/chains/joy_testnet_parachain/keystore/
# Run the collator
./target/release/joystream-node --collator --log runtime --chain ./parachain-2000/parachain_spec_plain.json --port 30335 --ws-port 9946 \
--base-path ~/tmp/collator -- --chain ~/tmp/test-relay-chain.json --execution wasm --port 30336 --ws-port 9947
# Register the parachain
https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/parachains/parathreads
By clicking `(+) Parathread` (You will upload wasm and genesis state)
Parathread should enter onboarding state, and in a few minutes become a parathread.
... Do we expect parathread to produce blocks as well?
Then use sudo: paraSudoWrapper->sudoScheduleParathreadUpgrade() to upgrade parathread to a parachain
Access The joystream websocket endpoint at: ws://localhost:9946
https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9946#/
Make sure to add our customer type defs in Developer settings: https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9946#/settings/developer
// replace definitions
"Address": "AccountId",
"LookupSource": "AccountId",
// with
"Address": "MultiAddress",
"LookupSource": "MultiAddress",
Otherwise you will see errors like this when submitting transactions:
balances.transferKeepAlive
1002: Verification Error: Runtime error: Execution failed: ApiError(FailedToConvertParameter { function: "validate_transaction", parameter: "tx", error: Error { cause: None, desc: "Could not decode `MultiAddress`, variant doesn\'t exist" } }): RuntimeApi, Execution failed: ApiError, FailedToConvertParameter { function: \"validate_transaction\", parameter: \"tx\", error: Error { cause: None, desc: \"Could not decode `MultiAddress`, variant doesn\\\'t exist\" } }
## If everything worked well we should see something like this...
2021-06-17 10:27:48 [Parachain] Starting collation. relay_parent=0x9fa5cf30261105df954d82f66b08c0f380971e283f93140a8cfc3b87a31db1c4 at=0xa12922dbae0f0b6e776b3bdc3b559fd779bb81aa71e7ec5b41e9a4bd9951b671
2021-06-17 10:27:48 [Parachain] 🙌 Starting consensus session on top of parent 0xa12922dbae0f0b6e776b3bdc3b559fd779bb81aa71e7ec5b41e9a4bd9951b671
2021-06-17 10:27:48 [Parachain] 🎁 Prepared block for proposing at 1 [hash: 0xd5ab08c8676cddf290b4f75c810bea58c77873aebdb277d198d77a9217238ee8; parent_hash: 0xa129…b671; extrinsics (2): [0xc5aa…8338, 0x749a…a609]]
2021-06-17 10:27:48 [Parachain] 🔖 Pre-sealed block for proposal at 1. Hash now 0x827dc68bc632c980ab26220abcdeb2086372892d33410ef28ca0c4439ca77b54, previously 0xd5ab08c8676cddf290b4f75c810bea58c77873aebdb277d198d77a9217238ee8.
2021-06-17 10:27:48 [Parachain] ✨ Imported #1 (0x827d…7b54)
2021-06-17 10:27:48 [Parachain] Produced proof-of-validity candidate. block_hash=0x827dc68bc632c980ab26220abcdeb2086372892d33410ef28ca0c4439ca77b54
2021-06-17 10:27:48 [Parachain] 💤 Idle (0 peers), best: #0 (0xa129…b671), finalized #0 (0xa129…b671), ⬇ 0 ⬆ 0
2021-06-17 10:27:48 [Relaychain] 💤 Idle (1 peers), best: #287 (0x9fa5…b1c4), finalized #284 (0x20a4…242b), ⬇ 0.6kiB/s ⬆ 224.0kiB/s
2021-06-17 10:27:53 [Parachain] 💤 Idle (0 peers), best: #0 (0xa129…b671), finalized #0 (0xa129…b671), ⬇ 0 ⬆ 0
2021-06-17 10:27:53 [Relaychain] 💤 Idle (1 peers), best: #287 (0x9fa5…b1c4), finalized #284 (0x20a4…242b), ⬇ 0.3kiB/s ⬆ 49 B/s
2021-06-17 10:27:54 [Relaychain] ✨ Imported #288 (0x5fef…29de)
2021-06-17 10:27:58 [Parachain] 💤 Idle (0 peers), best: #0 (0xa129…b671), finalized #0 (0xa129…b671), ⬇ 0 ⬆ 0
2021-06-17 10:27:58 [Relaychain] 💤 Idle (1 peers), best: #288 (0x5fef…29de), finalized #285 (0x388f…25e5), ⬇ 0.5kiB/s ⬆ 78 B/s
2021-06-17 10:28:00 [Relaychain] ✨ Imported #289 (0x240f…0f60)
2021-06-17 10:28:00 [Parachain] Starting collation. relay_parent=0x240fd557149bb88af0e68ecdb093c62d7d3d15e189a2f46da2fdd4d721f30f60 at=0x827dc68bc632c980ab26220abcdeb2086372892d33410ef28ca0c4439ca77b54
2021-06-17 10:28:00 [Parachain] 🙌 Starting consensus session on top of parent 0x827dc68bc632c980ab26220abcdeb2086372892d33410ef28ca0c4439ca77b54
2021-06-17 10:28:00 [Parachain] 🎁 Prepared block for proposing at 2 [hash: 0xa614baf73054027e3dce741165e559cc22dd529022fec5ca550c41e9e8e0117c; parent_hash: 0x827d…7b54; extrinsics (2): [0xde25…8ca6, 0x8937…3893]]
2021-06-17 10:28:00 [Parachain] 🔖 Pre-sealed block for proposal at 2. Hash now 0xda6c81b89bfaace43b25e4d3dbefccfd10e34a1bdbde739961242911b8e800c8, previously 0xa614baf73054027e3dce741165e559cc22dd529022fec5ca550c41e9e8e0117c.
2021-06-17 10:28:00 [Parachain] ✨ Imported #2 (0xda6c…00c8)
2021-06-17 10:28:00 [Parachain] Produced proof-of-validity candidate. block_hash=0xda6c81b89bfaace43b25e4d3dbefccfd10e34a1bdbde739961242911b8e800c8
2021-06-17 10:28:03 [Parachain] 💤 Idle (0 peers), best: #1 (0x827d…7b54), finalized #0 (0xa129…b671), ⬇ 0 ⬆ 0
2021-06-17 10:28:03 [Relaychain] 💤 Idle (1 peers), best: #289 (0x240f…0f60), finalized #286 (0x7a54…968f), ⬇ 1.0kiB/s ⬆ 224.4kiB/s
2021-06-17 10:28:06 [Relaychain] ✨ Imported #290 (0x5aa8…0898)
2021-06-17 10:28:06 [Relaychain] ✨ Imported #290 (0x490f…1936)
2021-06-17 10:28:08 [Relaychain] 💤 Idle (1 peers), best: #290 (0x5aa8…0898), finalized #287 (0x9fa5…b1c4), ⬇ 1.0kiB/s ⬆ 0.2kiB/s
2021-06-17 10:28:08 [Parachain] 💤 Idle (0 peers), best: #1 (0x827d…7b54), finalized #0 (0xa129…b671), ⬇ 0 ⬆ 0
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the relay-chain and parachain commands in the issue, including the polkadot and joystream builds, chain-spec generation, registration, and collator startup. Check whether the expected collation and relay-chain log output is produced, and clarify what local-testing procedure or documentation should be retained and what behavior is expected from the parathread.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- blockchain, documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100