Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guide for launching a local testnet #296

Open
nsjames opened this issue May 25, 2023 · 1 comment
Open

Guide for launching a local testnet #296

nsjames opened this issue May 25, 2023 · 1 comment

Comments

@nsjames
Copy link
Member

nsjames commented May 25, 2023

We have removed the bios boot guide which was outdated, and left an edge-journey out of documentation.

The process of launching a local testnet is not a good one though, and it's likelier to be a downloadable script than a guide, something that just gets things up and running quickly. Possibly as an addition to an existing tool

@nsjames
Copy link
Member Author

nsjames commented Jun 5, 2023

By chance, I had to create a script to do this over the weekend.

This doesn't take into account multiple producers, but that's likely not a requirement.
This just sets up an EOS-like local network very quickly.

#!/bin/bash

PUBLIC_KEY=EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
PRIVATE_KEY=5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

DATA_DIR=${1:-"$HOME/eos/data-dir"}
CONTRACTS_DIR=${2:-"$HOME/eos/contracts"}
WALLET_DIR=${2:-"$HOME/eosio-wallet"}

create_account () {
  cleos create account eosio $1 $PUBLIC_KEY
}

pre_activate_feature () {
  curl -X POST http://127.0.0.1:8888/v1/producer/schedule_protocol_feature_activations -d '{"protocol_features_to_activate": ["'$1'"]}'
}

activate_feature () {
  cleos push action eosio activate '["'$1'"]' -p eosio@active
} 

deploy_contract () {
  cleos set account permission $1 active --add-code
  cleos set contract $1 $2
}

pkill -f nodeos
rm -rf -r $WALLET_DIR
rm -rf -r $DATA_DIR/blocks
rm -rf -r $DATA_DIR/snapshots
rm -rf -r $DATA_DIR/state
rm -rf -r $DATA_DIR/state-history
rm -rf -r $DATA_DIR/traces

gnome-terminal --tab -t "nodeos" -- bash -c "nodeos --delete-all-block --config=$DATA_DIR/config.ini --data-dir=$DATA_DIR --disable-replay-opts; exec bash"
sleep 5


# Wallet setup
cleos wallet create --file .wallet.pw
cat .wallet.pw | cleos wallet unlock --password
cleos wallet import --private-key $PRIVATE_KEY

create_account "eosio.msig"
create_account "eosio.token"
create_account "eosio.bpay"
create_account "eosio.names"
create_account "eosio.ram"
create_account "eosio.ramfee"
create_account "eosio.saving"
create_account "eosio.stake"
create_account "eosio.vpay"
create_account "eosio.rex"

pre_activate_feature "0ec7e080177b2c02b278d5088611686b49d739925a92d9bfcacd7fc6b74053bd"
sleep 2

deploy_contract "eosio" "contracts/eosio.boot"

activate_feature "c3a6138c5061cf291310887c0b5c71fcaffeab90d5deb50d3b9e687cead45071"
activate_feature "bcd2a26394b36614fd4894241d3c451ab0f6fd110958c3423073621a70826e99"
activate_feature "35c2186cc36f7bb4aeaf4487b36e57039ccf45a9136aa856a5d569ecca55ef2b"
activate_feature "6bcb40a24e49c26d0a60513b6aeb8551d264e4717f306b81a37a5afb3b47cedc"
activate_feature "d528b9f6e9693f45ed277af93474fd473ce7d831dae2180cca35d907bd10cb40"
activate_feature "5443fcf88330c586bc0e5f3dee10e7f63c76c00249c87fe4fbf7f38c082006b4"
activate_feature "f0af56d2c5a48d60a4a5b5c903edfb7db3a736a94ed589d0b797df33ff9d3e1d"
activate_feature "2652f5f96006294109b3dd0bbde63693f55324af452b799ee137a81a905eed25"
activate_feature "8ba52fe7a3956c5cd3a656a3174b931d3bb2abb45578befc59f283ecd816a405"
activate_feature "ad9e3d8f650687709fd68f4b90b41f7d825a365b02c23a636cef88ac2ac00c43"
activate_feature "68dcaa34c0517d19666e6b33add67351d8c5f69e999ca1e37931bc410a297428"
activate_feature "e0fb64b1085cc5538970158d05a009c24e276fb94e1a0bf6a528b48fbc4ff526"
activate_feature "ef43112c6543b88db2283a2e077278c315ae2c84719a8b25f25cc88565fbea99"
activate_feature "4a90c00d55454dc5b059055ca213579c6ea856967712a56017487886a4d4cc0f"
activate_feature "1a99a59d87e06e09ec5b028a9cbb7749b4a5ad8819004365d02dc4379a8b7241"
activate_feature "4e7bf348da00a945489b2a681749eb56f5de00b900014e137ddae39f48f69d67"
activate_feature "4fca8bd82bbd181e714e283f83e1b45d95ca5af40fb89ad3977b653c448f78c2"
activate_feature "299dcb6af692324b899b39f16d5a530a33062804e41f09dc97e9f156b4476707"


deploy_contract "eosio.msig" "contracts/eosio.msig"
deploy_contract "eosio.token" "contracts/eosio.token"
deploy_contract "eosio" "contracts/eosio.system"


cleos push action eosio.token create '["eosio", "10000000000.0000 EOS"]' -p eosio.token@active
cleos push action eosio.token issue '["eosio", "1000000000.0000 EOS", "memo"]' -p eosio@active
cleos push action eosio init '["0","4,EOS"]' -p eosio@active

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready
Development

No branches or pull requests

1 participant