Local Pendulum chain setup
Before running the test chain locally you need to be run the relay chain!
First, you need to clone the Pendulum repository.
git clone https://github.com/pendulum-chain/pendulum.git
Then compile the project executing
cargo build --release
Connect to the relay chain using this link. Reserve a parachain slot for ID 2000 by clicking on the button "+ ParaId".
To run and connect your parachain collator to the relay chain you first need to generate some files. Run the following commands from the root of the
First generate a plain chain spec of your parachain:
# Generate a plain chain spec of your parachain
./target/release/pendulum-collator build-spec --disable-default-bootnode > rococo-local-parachain-plain.json
By default, the para ID in the generated
rococo-local-parachain-plain.jsonis set to
1000. But in the step earlier, we reserved a parachain slot for ID
2000. That's why you will have to manually change the contents of the generated JSON file to match the setup of your leased parachain ID. For more information, see the Substrate docs. You have to modify two fields, similar to this snippet:
"para_id": 2000, // <--- your already registered ID
"parachainId": 2000 // <--- your already registered ID
Afterwards, you can generate the other necessary files with the following commands:
# Generate a raw chain spec derived from the plain chain spec
./target/release/pendulum-collator build-spec --chain rococo-local-parachain-plain.json --raw --disable-default-bootnode > rococo-local-parachain-2000-raw.json
# Generate the WASM runtime validation function
./target/release/pendulum-collator export-genesis-wasm --chain rococo-local-parachain-2000-raw.json > para-2000-wasm
# Generate a parachain genesis state
./target/release/pendulum-collator export-genesis-state --chain rococo-local-parachain-2000-raw.json > para-2000-genesis
These commands generate the following files:
rococo-custom-2-raw.jsonfile that you downloaded in the previous step to the root of the
Run the following command but replace
<ALICE_NODE_ID>with the node Identity of one of the validators that you started in the previous chapter. It doesn't matter if you use Alice's or Bob's ID.
--chain rococo-local-parachain-2000-raw.json \
--base-path /tmp/parachain/alice \
--port 40333 \
--ws-port 8844 \
--enable-offchain-indexing TRUE \
--execution wasm \
--chain ./rococo-custom-2-raw.json \
--bootnodes /ip4/127.0.0.1/tcp/30333/p2p/<ALICE_NODE_ID> \
--port 30343 \
--bootnodesparameter is used to make sure that the parachain collator finds the peers of the relay chain. You can see if the relay chain peers are found in the logs. It should read something like
[Relaychain] Idle (2 peers)...
[Relaychain] 💤 Idle (2 peers), best: #22 (0xf4fc…7c5e), finalized #19 (0x561e…9ced), ⬇ 1.0kiB/s ⬆ 0.7kiB/s
[Parachain] 💤 Idle (0 peers), best: #0 (0x1249…11f9), finalized #0 (0x1249…11f9), ⬇ 0 ⬆ 0
[Relaychain] ✨ Imported #23 (0xe86a…a30f)
After some minutes the collator node of the parachain will start to produce blocks. This is easiest to identify on the polkadot.js explorer. First identify the websocket port of the collator node. This is
8844by default but can deviate occasionally. For this purpose check the line
Listening for new connections on 127.0.0.1:<ws-port>in the console output.
Expand the sidebar of the polkadot.js explorer and enter
ws://localhost:<ws-port>as "Custom Endpoint" below the "Development" area or alternatively use this link to directly access the page with the endpoint filled in for you. After that head to "Network -> Explorer" and you should be able to see that the parachain is producing blocks.