Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
update script
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptoAtwill committed Dec 5, 2023
1 parent 4a93e42 commit 28d02f5
Show file tree
Hide file tree
Showing 13 changed files with 220 additions and 28 deletions.
34 changes: 34 additions & 0 deletions infra/localnet/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Spin up fendermint local network
This will guide you through how to setup a 4-node fendermint network on local machine for debugging.

### Create validators
The validators are already created, their credential information are stored in `abci*`. If you want to use your own set
of validators, just regenerate the private key file on your own and replace the files.

### Fund validators
Fund your validators in subnet `/r314159`.

### Create subnet
Create subnet with the following command, make sure you have `ipc-cli` installed.
```shell
<PATH TO IPC>/ipc-cli subnet create --parent /r314159 --min-validator-stake 0.04 --min-cross-msg-fee 0 --min-validators 4 --bottomup-check-period 10
```
Note down the subnet id from the command output.

### Join subnet
Ask your validators join the subnet with:
```shell
SUBNET=<SUBNET ID FROM PREVIOUS COMMAND> IPC_PATH=<YOUR IPC CLI FOLDER>/ipc-cli bash ./join_subnet.sh
```
make sure you have `jq` installed.

### Generate genesis
Generate the genesis with:
```shell
$FENDERMINT_CLI genesis --genesis-file ./genesis.json ipc from-parent -s /r314159/${SUBNET} --parent-endpoint "https://api.calibration.node.glif.io/rpc/v1" --parent-gateway ${GATEWAY} --parent-registry ${REGISTRY}
```

### Generate keys
```shell
FENDERMINT_CLI=<PATH TO YOUR FENDERMINT CLI>
```
11 changes: 11 additions & 0 deletions infra/localnet/abci0/validator.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"address": "81F978E13973206FB4A187AAB8A5382A8ABB0CA8",
"priv_key": {
"type": "tendermint/PrivKeySecp256k1",
"value": "9O9FpE6Vxz1/4hiph5nwI3Efjq+DbGsRNBFR4VIyvFc="
},
"pub_key": {
"type": "tendermint/PubKeySecp256k1",
"value": "AnqEW8YfDUpE43r2T7fhmOqmn8Fg0g7kdysPe1+E82XR"
}
}
3 changes: 2 additions & 1 deletion infra/localnet/abci0/wallet.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"address": "3d02c104c7372c2ac5602e7cb74214534393ed75",
"pubkey": "047a845bc61f0d4a44e37af64fb7e198eaa69fc160d20ee4772b0f7b5f84f365d1b2315f429b2e3330db91f5b9d5d031f653d2e8612af6a0d23b703ca4670566ea"
"pubkey": "047a845bc61f0d4a44e37af64fb7e198eaa69fc160d20ee4772b0f7b5f84f365d1b2315f429b2e3330db91f5b9d5d031f653d2e8612af6a0d23b703ca4670566ea",
"t4": "t410fhubmcbghg4wcvrlafz6loqquknbzh3lv4ceo4oa"
}
11 changes: 11 additions & 0 deletions infra/localnet/abci1/validator.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"address": "AEB8FA34690678C9C6AC021473743FD240AFDA1E",
"priv_key": {
"type": "tendermint/PrivKeySecp256k1",
"value": "o3YfH/X6J1hm9W6WItZrnI8AN6FTQjmD5aTNGHm/9iY="
},
"pub_key": {
"type": "tendermint/PubKeySecp256k1",
"value": "AztaVzCIoD8zrxzTXBM7KNbOQT6RCEu18fXcOMASCQJ/"
}
}
3 changes: 2 additions & 1 deletion infra/localnet/abci1/wallet.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"address": "768ab98c39f200facd2e5e305e191ffb6e6523c6",
"pubkey": "043b5a573088a03f33af1cd35c133b28d6ce413e91084bb5f1f5dc38c01209027f8ba342d9ba2677f1eed005d769e0ed43ec9e5dabddeb769df3299d86b3718beb"
"pubkey": "043b5a573088a03f33af1cd35c133b28d6ce413e91084bb5f1f5dc38c01209027f8ba342d9ba2677f1eed005d769e0ed43ec9e5dabddeb769df3299d86b3718beb",
"t4": "t410fo2fltdbz6iapvtjolyyf4gi77nxgki6glk2xyti"
}
11 changes: 11 additions & 0 deletions infra/localnet/abci2/validator.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"address": "603758F52C195FDB54FB5E2C8A64A747EAF0E9A5",
"priv_key": {
"type": "tendermint/PrivKeySecp256k1",
"value": "Zzl/f+cE07K2LKVUv1qPiAxc9tflnxup0qrj0WQWLqI="
},
"pub_key": {
"type": "tendermint/PubKeySecp256k1",
"value": "A4rF21nBH7H9RTZRtmpDbGCLwwLwM8UcOoiuQGr1iWKM"
}
}
3 changes: 2 additions & 1 deletion infra/localnet/abci2/wallet.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"address": "20c343ab93f4f6842aa19f5cccfbc02c8aa697ed",
"pubkey": "048ac5db59c11fb1fd453651b66a436c608bc302f033c51c3a88ae406af589628c69e48e2b0f76247111de69333d8ed264367f3370948bc6794f4b3ab9390de22d"
"pubkey": "048ac5db59c11fb1fd453651b66a436c608bc302f033c51c3a88ae406af589628c69e48e2b0f76247111de69333d8ed264367f3370948bc6794f4b3ab9390de22d",
"t4": "t410fedbuhk4t6t3iikvbt5omz66afsfknf7nv3647tq"
}
11 changes: 11 additions & 0 deletions infra/localnet/abci3/validator.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"address": "5BD6F62DB9A25FBF0E4F84C36127279234207A00",
"priv_key": {
"type": "tendermint/PrivKeySecp256k1",
"value": "WOoNLSdlm7resE7tH9EqrFjV71rDsjcbKupNYrx33LE="
},
"pub_key": {
"type": "tendermint/PubKeySecp256k1",
"value": "A9YAdP3V1WBw2IMezQjG9Gy5HY1BwrjChMYQsi4jYTnK"
}
}
3 changes: 2 additions & 1 deletion infra/localnet/abci3/wallet.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"address": "01222dc6bfaaa372ce992e6f49d808e4bb9bd02b",
"pubkey": "04d60074fdd5d56070d8831ecd08c6f46cb91d8d41c2b8c284c610b22e236139caaf7fc91585806c61c209a167df2084455343227836c18fe59ab958c7623f48ed"
"pubkey": "04d60074fdd5d56070d8831ecd08c6f46cb91d8d41c2b8c284c610b22e236139caaf7fc91585806c61c209a167df2084455343227836c18fe59ab958c7623f48ed",
"t4": "t410faerc3rv7vkrxftuzfzxutwai4s5zxublbolynay"
}
21 changes: 21 additions & 0 deletions infra/localnet/convert_keys.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

${FENDERMINT_CLI}/fendermint key from-eth -s ./abci0/private_key -n abci0 -o ./abci0
${FENDERMINT_CLI}/fendermint key from-eth -s ./abci1/private_key -n abci1 -o ./abci1
${FENDERMINT_CLI}/fendermint key from-eth -s ./abci2/private_key -n abci2 -o ./abci2
${FENDERMINT_CLI}/fendermint key from-eth -s ./abci3/private_key -n abci3 -o ./abci3

${FENDERMINT_CLI}/fendermint key into-tendermint --secret-key ./abci0/abci0.sk --out ./abci0/validator.json
${FENDERMINT_CLI}/fendermint key into-tendermint --secret-key ./abci1/abci1.sk --out ./abci1/validator.json
${FENDERMINT_CLI}/fendermint key into-tendermint --secret-key ./abci2/abci2.sk --out ./abci2/validator.json
${FENDERMINT_CLI}/fendermint key into-tendermint --secret-key ./abci3/abci3.sk --out ./abci3/validator.json

chmod 600 ./abci0/validator.json
chmod 600 ./abci1/validator.json
chmod 600 ./abci2/validator.json
chmod 600 ./abci3/validator.json

rm ./abci0/abci0.*
rm ./abci1/abci1.*
rm ./abci2/abci2.*
rm ./abci3/abci3.*
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ services:
- ID=0
- LOG=${LOG:-cometbft.log}
volumes:
- ./build:/cometbft:Z
- ./genesis.json:/cometbft/config/genesis.json
- ./abci0/validator.json:/cometbft/config/priv_validator_key.json
command: node --proxy_app=tcp://abci0:26658
networks:
localnet:
Expand All @@ -25,7 +26,8 @@ services:
- ID=1
- LOG=${LOG:-cometbft.log}
volumes:
- ./build:/cometbft:Z
- ./genesis.json:/cometbft/config/genesis.json
- ./abci1/validator.json:/cometbft/config/priv_validator_key.json
command: node --proxy_app=tcp://abci1:26658
networks:
localnet:
Expand All @@ -40,7 +42,8 @@ services:
ports:
- "26661-26662:26656-26657"
volumes:
- ./build:/cometbft:Z
- ./genesis.json:/cometbft/config/genesis.json
- ./abci2/validator.json:/cometbft/config/priv_validator_key.json
command: node --proxy_app=tcp://abci2:26658
networks:
localnet:
Expand All @@ -55,7 +58,8 @@ services:
ports:
- "26663-26664:26656-26657"
volumes:
- ./build:/cometbft:Z
- ./genesis.json:/cometbft/config/genesis.json
- ./abci3/validator.json:/cometbft/config/priv_validator_key.json
command: node --proxy_app=tcp://abci3:26658
networks:
localnet:
Expand All @@ -69,12 +73,12 @@ services:
environment:
- FM_DATA_DIR=/root/fendermint/data
- FM_LOG_DIR=/root/fendermint/data/logs
- FM_CHAIN_NAME="/r314159/t410fv6i4pa4fxlqvhcivanzkjckrsnvl6awbvk7gmfa"
- FM_IPC__SUBNET_ID="/r314159/t410fv6i4pa4fxlqvhcivanzkjckrsnvl6awbvk7gmfa"
- FM_CHAIN_NAME="/r314159/t410f6c5hpqeqau4idqe7mund4tilojxdihutnmk7enq"
- FM_IPC__SUBNET_ID="/r314159/t410f6c5hpqeqau4idqe7mund4tilojxdihutnmk7enq"
- FM_IPC__TOPDOWN__CHAIN_HEAD_DELAY=10
- FM_IPC__TOPDOWN__PARENT_HTTP_ENDPOINT="https://api.calibration.node.glif.io/rpc/v1"
- FM_IPC__TOPDOWN__PARENT_REGISTRY="0x7A6b4ac3a47Ed9aDcF6e0d89f2B473dD3f5ddf5a"
- FM_IPC__TOPDOWN__PARENT_GATEWAY="0xDD64A1303d97691837B6f5Bc2D72fd5eF3cCE628"
- FM_IPC__TOPDOWN__PARENT_REGISTRY="0x5FE1a06cA4534cB878260522a572e2254214261D"
- FM_IPC__TOPDOWN__PARENT_GATEWAY="0x2e994B75095a39EB7C6dDA0516731B02AbcDbdb4"
- FM_IPC__TOPDOWN__EXPONENTIAL_BACK_OFF=5
- FM_IPC__TOPDOWN__EXPONENTIAL_RETRY_LIMIT=5
- FM_IPC__TOPDOWN__POLLING_INTERVAL=10
Expand All @@ -89,7 +93,7 @@ services:
- LOG_LEVEL=info
- RUST_BACKTRACE=1
volumes:
- ./localnet/abci0:/root/fendermint/data
- ./localnet/abci0/private_key:/root/fendermint/data/private_key
networks:
localnet:
ipv4_address: 192.167.10.6
Expand All @@ -102,12 +106,12 @@ services:
environment:
- FM_DATA_DIR=/root/fendermint/data
- FM_LOG_DIR=/root/fendermint/data/logs
- FM_CHAIN_NAME="/r314159/t410fv6i4pa4fxlqvhcivanzkjckrsnvl6awbvk7gmfa"
- FM_IPC__SUBNET_ID="/r314159/t410fv6i4pa4fxlqvhcivanzkjckrsnvl6awbvk7gmfa"
- FM_CHAIN_NAME="/r314159/t410f6c5hpqeqau4idqe7mund4tilojxdihutnmk7enq"
- FM_IPC__SUBNET_ID="/r314159/t410f6c5hpqeqau4idqe7mund4tilojxdihutnmk7enq"
- FM_IPC__TOPDOWN__CHAIN_HEAD_DELAY=10
- FM_IPC__TOPDOWN__PARENT_HTTP_ENDPOINT="https://api.calibration.node.glif.io/rpc/v1"
- FM_IPC__TOPDOWN__PARENT_REGISTRY="0x7A6b4ac3a47Ed9aDcF6e0d89f2B473dD3f5ddf5a"
- FM_IPC__TOPDOWN__PARENT_GATEWAY="0xDD64A1303d97691837B6f5Bc2D72fd5eF3cCE628"
- FM_IPC__TOPDOWN__PARENT_REGISTRY="0x5FE1a06cA4534cB878260522a572e2254214261D"
- FM_IPC__TOPDOWN__PARENT_GATEWAY="0x2e994B75095a39EB7C6dDA0516731B02AbcDbdb4"
- FM_IPC__TOPDOWN__EXPONENTIAL_BACK_OFF=5
- FM_IPC__TOPDOWN__EXPONENTIAL_RETRY_LIMIT=5
- FM_IPC__TOPDOWN__POLLING_INTERVAL=10
Expand All @@ -122,7 +126,7 @@ services:
- LOG_LEVEL=info
- RUST_BACKTRACE=1
volumes:
- ./localnet/abci1:/root/fendermint/data
- ./localnet/abci1/private_key:/root/fendermint/data/private_key
networks:
localnet:
ipv4_address: 192.167.10.7
Expand All @@ -135,12 +139,12 @@ services:
environment:
- FM_DATA_DIR=/root/fendermint/data
- FM_LOG_DIR=/root/fendermint/data/logs
- FM_CHAIN_NAME="/r314159/t410fv6i4pa4fxlqvhcivanzkjckrsnvl6awbvk7gmfa"
- FM_IPC__SUBNET_ID="/r314159/t410fv6i4pa4fxlqvhcivanzkjckrsnvl6awbvk7gmfa"
- FM_CHAIN_NAME="/r314159/t410f6c5hpqeqau4idqe7mund4tilojxdihutnmk7enq"
- FM_IPC__SUBNET_ID="/r314159/t410f6c5hpqeqau4idqe7mund4tilojxdihutnmk7enq"
- FM_IPC__TOPDOWN__CHAIN_HEAD_DELAY=10
- FM_IPC__TOPDOWN__PARENT_HTTP_ENDPOINT="https://api.calibration.node.glif.io/rpc/v1"
- FM_IPC__TOPDOWN__PARENT_REGISTRY="0x7A6b4ac3a47Ed9aDcF6e0d89f2B473dD3f5ddf5a"
- FM_IPC__TOPDOWN__PARENT_GATEWAY="0xDD64A1303d97691837B6f5Bc2D72fd5eF3cCE628"
- FM_IPC__TOPDOWN__PARENT_REGISTRY="0x5FE1a06cA4534cB878260522a572e2254214261D"
- FM_IPC__TOPDOWN__PARENT_GATEWAY="0x2e994B75095a39EB7C6dDA0516731B02AbcDbdb4"
- FM_IPC__TOPDOWN__EXPONENTIAL_BACK_OFF=5
- FM_IPC__TOPDOWN__EXPONENTIAL_RETRY_LIMIT=5
- FM_IPC__TOPDOWN__POLLING_INTERVAL=10
Expand All @@ -155,7 +159,7 @@ services:
- LOG_LEVEL=info
- RUST_BACKTRACE=1
volumes:
- ./localnet/abci2:/root/fendermint/data
- ./localnet/abci2/private_key:/root/fendermint/data/private_key
networks:
localnet:
ipv4_address: 192.167.10.8
Expand All @@ -168,12 +172,12 @@ services:
environment:
- FM_DATA_DIR="/root/fendermint/data"
- FM_LOG_DIR="/root/fendermint/data/logs"
- FM_CHAIN_NAME="/r314159/t410fv6i4pa4fxlqvhcivanzkjckrsnvl6awbvk7gmfa"
- FM_IPC__SUBNET_ID="/r314159/t410fv6i4pa4fxlqvhcivanzkjckrsnvl6awbvk7gmfa"
- FM_CHAIN_NAME="/r314159/t410f6c5hpqeqau4idqe7mund4tilojxdihutnmk7enq"
- FM_IPC__SUBNET_ID="/r314159/t410f6c5hpqeqau4idqe7mund4tilojxdihutnmk7enq"
- FM_IPC__TOPDOWN__CHAIN_HEAD_DELAY=10
- FM_IPC__TOPDOWN__PARENT_HTTP_ENDPOINT="https://api.calibration.node.glif.io/rpc/v1"
- FM_IPC__TOPDOWN__PARENT_REGISTRY="0x7A6b4ac3a47Ed9aDcF6e0d89f2B473dD3f5ddf5a"
- FM_IPC__TOPDOWN__PARENT_GATEWAY="0xDD64A1303d97691837B6f5Bc2D72fd5eF3cCE628"
- FM_IPC__TOPDOWN__PARENT_REGISTRY="0x5FE1a06cA4534cB878260522a572e2254214261D"
- FM_IPC__TOPDOWN__PARENT_GATEWAY="0x2e994B75095a39EB7C6dDA0516731B02AbcDbdb4"
- FM_IPC__TOPDOWN__EXPONENTIAL_BACK_OFF=5
- FM_IPC__TOPDOWN__EXPONENTIAL_RETRY_LIMIT=5
- FM_IPC__TOPDOWN__POLLING_INTERVAL=10
Expand All @@ -188,7 +192,7 @@ services:
- LOG_LEVEL=info
- RUST_BACKTRACE=1
volumes:
- ./localnet/abci3:/root/fendermint/data
- ./localnet/abci3/private_key:/root/fendermint/data/private_key
networks:
localnet:
ipv4_address: 192.167.10.9
Expand Down
60 changes: 60 additions & 0 deletions infra/localnet/genesis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"genesis_time": "1970-01-14T06:53:27Z",
"chain_id": "1236677877404273",
"initial_height": "1",
"consensus_params": {
"block": {
"max_bytes": "22020096",
"max_gas": "-1",
"time_iota_ms": "1000"
},
"evidence": {
"max_age_num_blocks": "100000",
"max_age_duration": "172800000000000",
"max_bytes": "1048576"
},
"validator": {
"pub_key_types": [
"secp256k1"
]
}
},
"validators": [],
"app_hash": "",
"app_state": {
"accounts": [],
"base_fee": "1000",
"chain_name": "/r314159/t410f6c5hpqeqau4idqe7mund4tilojxdihutnmk7enq",
"ipc": {
"gateway": {
"active_validators_limit": 100,
"bottom_up_check_period": 10,
"majority_percentage": 60,
"min_collateral": "40000000000000000",
"msg_fee": "0",
"subnet_id": "/r314159/t410f6c5hpqeqau4idqe7mund4tilojxdihutnmk7enq"
}
},
"network_version": 18,
"power_scale": 3,
"timestamp": 1148007,
"validators": [
{
"power": "10000000000000000",
"public_key": "BHqEW8YfDUpE43r2T7fhmOqmn8Fg0g7kdysPe1+E82XRsjFfQpsuMzDbkfW51dAx9lPS6GEq9qDSO3A8pGcFZuo="
},
{
"power": "10000000000000000",
"public_key": "BDtaVzCIoD8zrxzTXBM7KNbOQT6RCEu18fXcOMASCQJ/i6NC2bomd/Hu0AXXaeDtQ+yeXavd63ad8ymdhrNxi+s="
},
{
"power": "10000000000000000",
"public_key": "BIrF21nBH7H9RTZRtmpDbGCLwwLwM8UcOoiuQGr1iWKMaeSOKw92JHER3mkzPY7SZDZ/M3CUi8Z5T0s6uTkN4i0="
},
{
"power": "10000000000000000",
"public_key": "BNYAdP3V1WBw2IMezQjG9Gy5HY1BwrjChMYQsi4jYTnKr3/JFYWAbGHCCaFn3yCERVNDIng2wY/lmrlYx2I/SO0="
}
]
}
}
25 changes: 25 additions & 0 deletions infra/localnet/join_subnet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

$IPC_PATH subnet join \
--from "0x$(cat ./abci0/wallet.json | jq -r '.address')" \
--subnet /r314159/${SUBNET} \
--collateral 0.01 \
--public-key "$(cat ./abci0/wallet.json | jq -r '.pubkey')"

$IPC_PATH subnet join \
--from "0x$(cat ./abci1/wallet.json | jq -r '.address')" \
--subnet /r314159/${SUBNET} \
--collateral 0.01 \
--public-key "$(cat ./abci1/wallet.json | jq -r '.pubkey')"

$IPC_PATH subnet join \
--from "0x$(cat ./abci2/wallet.json | jq -r '.address')" \
--subnet /r314159/${SUBNET} \
--collateral 0.01 \
--public-key "$(cat ./abci2/wallet.json | jq -r '.pubkey')"

$IPC_PATH subnet join \
--from "0x$(cat ./abci3/wallet.json | jq -r '.address')" \
--subnet /r314159/${SUBNET} \
--collateral 0.01 \
--public-key "$(cat ./abci3/wallet.json | jq -r '.pubkey')"

0 comments on commit 28d02f5

Please sign in to comment.