Skip to content

How to use our chain spec and configure session keys on your local calamari nodes

Georgi Zlatarev edited this page Jul 27, 2021 · 1 revision

Pay attention: the manta chain spec has already been hardcoded in our manta-pc code. This tuturial helps you to try this process in your local node.

  1. Update your manta-pc node to the newest version.

  2. Install the tool subkey. You can install it with this command:

cargo install --force subkey --git https://github.com/paritytech/substrate
  1. Generate collator session key. You can use this following commands to generate five collator keys:
subkey inspect -n calamari //calamari-acco
subkey inspect -n calamari //calamari-aura

echo "----- acco,aura"

subkey inspect -n calamari //calamari-acco1
subkey inspect -n calamari //calamari-aura1

echo "----- acco1,aura1"

subkey inspect -n calamari //calamari-acco2
subkey inspect -n calamari //calamari-aura2

echo "----- acco2,aura2"

subkey inspect -n calamari //calamari-acco3
subkey inspect -n calamari //calamari-aura3

echo "----- acco3, aura3"

subkey inspect -n calamari //calamari-acco4
subkey inspect -n calamari //calamari-aura4

echo "----- acco4,aura4"

subkey inspect -n calamari //calamari-sudo

You can also write a script to generate it. The results you can see in the terminal it just like this:

Secret Key URI `//calamari-acco` is account:
  Secret seed:       0x10d57776617d1602fe65f07b62b9aa582d21f0148b6d05da9c979f7f633bedbd
  Public key (hex):  0xd6999583ed6a5bc6700c0f60f306f596c1c802602c53d5c7d0d31dbed2ecf532
  Public key (SS58): dmyncEXotSqUf8vEmyfkMSqfykwkc2xSyXuhWYUVfSC7HMz9m
  Account ID:        0xd6999583ed6a5bc6700c0f60f306f596c1c802602c53d5c7d0d31dbed2ecf532
  SS58 Address:      dmyncEXotSqUf8vEmyfkMSqfykwkc2xSyXuhWYUVfSC7HMz9m
Secret Key URI `//calamari-aura` is account:
  Secret seed:       0x306ef1dcdf694cf23add7647ebaeb5643679251bdfd59283e99ac433b9c94366
  Public key (hex):  0x9c8b4c7ad2a35c98e7a83cbe1b05dcc712aa9effc266990d8b623031301b0731
  Public key (SS58): dmxUVDKPpLkeNGag4mrnEyjsRFhBbgL4H54RGdCxyHb1VDGXU
  Account ID:        0x9c8b4c7ad2a35c98e7a83cbe1b05dcc712aa9effc266990d8b623031301b0731
  SS58 Address:      dmxUVDKPpLkeNGag4mrnEyjsRFhBbgL4H54RGdCxyHb1VDGXU
----- acco,aura
...
  1. Change the chain spec in your local node codes.

Go to the file in /Manta/node/src/chain_spec.rs. Find in line 691 to 728, you need to change the account ID and aura ID for each collator. For example, change the ID for collator 1:

\\before
hex!["a80a38004dcea90dd0b91c5194ad577fb7b19517ea97e2ad263fcc5df7f57e06"].into(),
hex!["7c4e5ea112f816c85f2bc77383cca50b73af038e327d39dca94252a4553b897e"]
				.unchecked_into(),

Then:

\\after
hex!["d6999583ed6a5bc6700c0f60f306f596c1c802602c53d5c7d0d31dbed2ecf532"].into(),
hex!["9c8b4c7ad2a35c98e7a83cbe1b05dcc712aa9effc266990d8b623031301b0731"]
				.unchecked_into()

The remaining four collators are performed in the same way.

  1. Clone or update your manta-pc-launch to branch add-calamarideploy-json. Start your local test node with:
yarn start calamari-deploy.json
  1. Insert the aura private session key into parachain. Use the following commands or write a script for it:
# node1
curl -vH 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "method":"author_insertKey", "params":["aura", "//calamari-aura", "0x9c8b4c7ad2a35c98e7a83cbe1b05dcc712aa9effc266990d8b623031301b0731"],"id":1 }' localhost:9971

# node2
curl -vH 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "method":"author_insertKey", "params":["aura", "//calamari-aura1", "0x9c07ef98665dd387e53b1f0ca3318d598bc15c60a4e2c4f7d54e858883e7c211"],"id":1 }' localhost:9972

# node3
curl -vH 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "method":"author_insertKey", "params":["aura", "//calamari-aura2", "0x8630c499d61863b0c35c77817e90e1eaeef043140f80e10d62cae7cc4011a829"],"id":1 }' localhost:9973

# node4
curl -vH 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "method":"author_insertKey", "params":["aura", "//calamari-aura3", "0x24dd46c1acfa5a19db36c6c39b5e51197852d5e17088e54e96614c8f759ba27d"],"id":1 }' localhost:9974

# node5
curl -vH 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "method":"author_insertKey", "params":["aura", "//calamari-aura4", "0xd4c201b78cf9c30460d8590173f83f25cb073f294d1a4de1f68466319b4b934c"],"id":1 }' localhost:9975

Here, you need to replace the auraID in the script with the auraID you generated yourself with subkey.

Then you can see the parachain start producing blocks: