Skip to content

Instantly share code, notes, and snippets.

@insipx
Created August 16, 2023 14:42
Show Gist options
  • Save insipx/f08f1afc3742dfac4380dda55e62bb09 to your computer and use it in GitHub Desktop.
Save insipx/f08f1afc3742dfac4380dda55e62bb09 to your computer and use it in GitHub Desktop.
Run Chains
#!/bin/bash
FOLDER=$1
if [ -e "/tmp/parachain" ]; then
rm -rf /tmp/parachain
fi
RELAY_PEER_ID=$(curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "system_localPeerId"}' http://localhost:9941 | jq -r '.result') || exit 1;
$FOLDER/target/release/efinity --alice \
--force-authoring \
--collator \
--chain ./realdata-efinity.dev.json \
--base-path /tmp/parachain/alice \
--port 40446 \
--rpc-port 8844 \
-l runtime=debug,parachain=debug,system=debug,sc_basic_authorship=debug,cumulus-consensus=trace,cumulus-collator=trace,collator_protocol=trace,collation_generation=trace,aura=debug \
-- \
--execution wasm \
--chain ./realdata-enjin.dev.json \
--port 30447 \
--rpc-port 9988 --bootnodes /dns/127.0.0.1/tcp/30444/p2p/$RELAY_PEER_ID &> alice.log &
# Get peerid of Alice collator
sleep 20 # Sleeping to allow node to go up before curl quries
COLLATOR_PEER_ID=$(curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "system_localPeerId"}' http://localhost:8844 | jq -r '.result')
echo "COLLATOR"
echo $COLLATOR_PEER_ID
$FOLDER/target/release/efinity --bob \
--force-authoring \
--collator \
--chain ./realdata-efinity.dev.json \
--base-path /tmp/parachain/bob \
--port 40447 \
--rpc-port 8855 \
-l runtime=debug,parachain=debug,system=debug,sc_basic_authorship=debug,cumulus-consensus=trace,cumulus-collator=trace,collator_protocol=trace,collation_generation=trace,aura=debug \
--bootnodes /dns/127.0.0.1/tcp/40446/p2p/$COLLATOR_PEER_ID \
-- \
--execution wasm \
--chain ./realdata-enjin.dev.json \
--port 30448 \
--rpc-port 9989 --bootnodes /dns/127.0.0.1/tcp/30444/p2p/$RELAY_PEER_ID &> bob.log &
#!/bin/bash
FOLDER=$1
if [ -e "/tmp/relay" ]; then
rm -rf /tmp/relay
fi
$FOLDER/target/release/enjin \
--force-authoring \
--alice \
--validator \
--base-path /tmp/relay/alice \
--chain ./$FOLDER/realdata-enjin.dev.json \
--port 30444 \
-lsystem=debug,runtime=debug,parachain=debug,sc_basic_authorship=debug,nomination_pools=debug \
--ws-port 9940 \
--rpc-port 9941 &> alice.log &
sleep 20 # sleep to allow node to start before curl queries
# SESSION_KEYS_ALICE=$(curl -H "Content-Type: application/json" -d '{"id": 1, "jsonrpc":"2.0", "method": "author_rotateKeys","params":[]}' http://localhost:9941 | jq -r '.result')
PEER_ID=$(curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "system_localPeerId"}' http://localhost:9941 | jq -r '.result')
$FOLDER/target/release/enjin \
--bob \
--force-authoring \
--validator \
--base-path /tmp/relay/bob \
--chain ./$FOLDER/realdata-enjin.dev.json \
--port 30445 \
--ws-port 9950 \
--rpc-port 9951 \
-lsystem=debug,nomination_pools=debug,runtime=debug --bootnodes /dns/127.0.0.1/tcp/30444/p2p/$PEER_ID &> bob.log &
sleep 20
# SESSION_KEYS_BOB=$(curl -H "Content-Type: application/json" -d '{"id": 1, "jsonrpc":"2.0", "method": "author_rotateKeys","params":[]}' http://localhost:9951 | jq -r '.result')
# npx @polkadot/api-cli@latest --seed //Alice --ws ws://localhost:9940 tx.session.setKeys $SESSION_KEYS_ALICE 0x00
# npx @polkadot/api-cli@latest --seed //Bob --ws ws://localhost:9950 tx.session.setKeys $SESSION_KEYS_BOB 0x00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment