Skip to content

Instantly share code, notes, and snippets.

@laboon
Last active September 13, 2022 10:16
Show Gist options
  • Save laboon/adbc74c3eee13becdd24342c0432a242 to your computer and use it in GitHub Desktop.
Save laboon/adbc74c3eee13becdd24342c0432a242 to your computer and use it in GitHub Desktop.
Commands for "Build Your Own Blockchain with Substrate"

Setup Instructions

git clone https://github.com/paritytech/substrate
cd substrate/node-template
git checkout 53df5619c0273ef226ed9a470ca863d212ac917c
./scripts/init.sh
./scripts/build.sh
cargo build
cd ..
cargo install --force --path subkey subkey

Note: you may see numerous warnings from this. This is expected - if the build completes, you should be good.

Run the default initial blockchain node (Alice Node)

./target/debug/node-template \
  --base-path /tmp/alice \
  --chain=local \
  --key //Alice \
  --port 30333 \
  --validator \
  --name AlicesNode

Polkadot JS Explorer

https://polkadot.js.org/apps/#/explorer

Run the second blockchain node (Bob Node)

./target/debug/node-template \
  --base-path /tmp/bob \
  --chain=local \
  --key //Bob \
  --port 30334 \
  --validator \
  --name BobsNode \
  --bootnodes /ip4/<Alices IP Address>/tcp/<Alices Port>/p2p/<Alices Node ID>

Install subkey

cargo install --force --path subkey subkey

Generate Key / Address

subkey -e generate

Generate readable chainspec from local chainspec

./target/debug/node-template build-spec --chain=local > customSpec.json

Bill's address is 5CrAp3py6srR5jNc6tw3XFNQt8BHD2xETiXLxpWmcDkdEhTT

Convert readable chainspec to raw chainspec

./target/debug/node-template build-spec --chain customSpec.json --raw > customSpecRaw.json

Boostrapped (instructor's) initial node with modified chainspec, acting as validator

./target/debug/node-template \
  --chain customSpecRaw.json \
  --key <GENERATED KEY> \
  --validator

Run a node to connect to bootstrapped (instructor's) node (not a validator)

./target/debug/node-template \
  --chain customSpecRaw.json \
  --base-path /tmp/new \
  --key <YOUR SECRET KEY> \
  --name <YOUR NODE NAME> \
  --bootnodes /ip4/<Instructor’s IP Address>/tcp/<Instructor’s Port>/p2p/<Instructor's Node ID>

Instructor's IP is 10.10.230.111

Instructor's port is 30333

Instructor's node ID is QmREfrczwoeQWKxUaeQGP8Vhr3uuvLkqw5a3hxbf84mgZp

Link to chainSpecRaw.json

https://pastebin.com/zQ7eUTZ2

@colindean
Copy link

For debugging:

./target/debug/node-template   \
  --chain customSpecRaw.json   \
  --key 0xc8871ba96fce943bd21e15ed8ac74d0c8ad6bd100dd8a0c349816340abaae594 \
  --name ColinDean \
  --bootnodes /ip4/10.10.230.111/tcp/30333/p2p/QmREfrczwoeQWKxUaeQGP8Vhr3uuvLkqw5a3hxbf84mgZp/

@L8dySneaks
Copy link

Steph : 5DV2U5Vm8U4wAKaeDRBn6ePG44oae6Fv7SM7UmXHm5ziHCLU

@murali-koppula
Copy link

/ip4/10.10.230.243/

@RobbieMcKinstry
Copy link

5HHU2EY4zcqf5QCom2WNw5wJcn37cTWdBrVwmDVUKpfsK3st

@patelrohanv
Copy link

patelrohanv commented Jun 4, 2019

5FnCaCbmJeWtTyWspHd7RxgncrjkVcrEcVRxqych1QS8bK5w

@colindean
Copy link

5ECUciJS5a5vuys3iY87qAgCgkRoo92zCaGPtCfzJsku85F4

@murali-koppula
Copy link

/ip4/10.10.230.243/tcp/30333/p2p/QmX6pR88Q4z36VnoEsbhXSq1atzijeSqL2ndDguEi7Hux2

@murali-koppula
Copy link

0xca93cbb12b3985878735762821bc8b5188a5c704ff125b8c12f4fd2736cccc5f

@murali-koppula
Copy link

5GeKS9Rj2CpyJfFm6XevJFFDLQe4YcLgZRxKJj93z9t6Dmag

@L8dySneaks
Copy link

Steph : 0x3ec8c58f5e4c2c2ad0aa142fb1430de081c09d5fe768c10cd18b075c5fa47a69

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment