Skip to content

Commit

Permalink
doc updates, clean code for account creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpassmore committed May 10, 2024
1 parent 05d5b9c commit 3294441
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 50 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ See [Step By Step](doc/step-by-step.md)
Changes for larger [multi-host production systems](doc/large-scale-setup.md)

## Versions of this Repo
Listing of [Versions](doc/change-list.md) between releases of this bootstrap repo across Antelope software. See [Latest Change Log](changes/March182024.md) for PRs between releases.
Listing of [Versions](doc/change-list.md) between releases of this bootstrap repo across Antelope software. See [Latest Change Log](changes/March182024.md) for PRs between releases.


## Frequently Asked Questions
Q: Why is nodeos version `5.1.0-dev`?
A: The current Savanna is in development as a branch of the `5.0` release. Proper release versions will be set as we get closer to releasing the software.
Q: Why is nodeos version `v1.0.0-dev`?
A: The version was reset to `v1` with the new launch of Spring.

Q: How do I free up more disk space?
A: Docker can chew up a lot of space try the following commands
Expand Down
16 changes: 3 additions & 13 deletions bin/block_producer_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,9 @@ done
USER_PRIVATE_KEY=$(grep Private "$WALLET_DIR/user.keys" | head -1 | cut -d: -f2 | sed 's/ //g')
cleos wallet import --name finality-test-network-wallet --private-key $USER_PRIVATE_KEY

for user_name in usera userb userc userd usere userf userg userh useri userj
do
# vote
cleos --url $ENDPOINT_ONE system voteproducer prods ${user_name} bpa bpb bpc
done

for user_name in userk userl userm usern usero userp userq userr users usert useru
do
# vote
cleos --url $ENDPOINT_ONE system voteproducer prods ${user_name} bpa bpb bpc
done

for user_name in userv userw userx usery userz
for user_name in usera userb userc userd usere userf userg userh useri userj \
userk userl userm usern usero userp userq userr users usert useru \
userv userw userx usery userz
do
# vote
cleos --url $ENDPOINT_ONE system voteproducer prods ${user_name} bpa bpb bpc
Expand Down
6 changes: 4 additions & 2 deletions bin/create_accounts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENDPOINT_ONE=$1
WALLET_DIR=$2

# create 21 producers error out if vars not set
for producer_name in bpa bpb bpc bpd bpe bpf bpg bph bpi bpj bpk bpl bpm bpn bpo bpp bpq bpr bps bpt bpu
for producer_name in bpa bpb bpc
do
[ ! -s "$WALLET_DIR/${producer_name}.keys" ] && cleos create key --to-console > "$WALLET_DIR/${producer_name}.keys"
# head because we want the first match; they may be multiple keys
Expand All @@ -27,7 +27,9 @@ USER_PRIVATE_KEY=$(grep Private "$WALLET_DIR/user.keys" | head -1 | cut -d: -f2
USER_PUBLIC_KEY=$(grep Public "$WALLET_DIR/user.keys" | head -1 | cut -d: -f2 | sed 's/ //g')
cleos wallet import --name finality-test-network-wallet --private-key $USER_PRIVATE_KEY

for user_name in usera userb userc userd usere userf userg userh useri userj userk userl userm usern usero userp userq userr users usert useru userv userw userx usery userz
for user_name in usera userb userc userd usere userf userg userh useri userj \
userk userl userm usern usero userp userq userr users usert useru \
userv userw userx usery userz
do
# create user account
cleos --url $ENDPOINT_ONE system newaccount eosio ${user_name:?} ${USER_PUBLIC_KEY:?} --stake-net "50 EOS" --stake-cpu "50 EOS" --buy-ram "100 EOS"
Expand Down
2 changes: 1 addition & 1 deletion bin/docker-build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ if [ $used_size -gt $max_space_used ]; then
TARGET="clean-out-stage"
fi

# March 18th 2024 Build
# May 9th 2024 Build Spring v1.0.0-beta
docker build -f AntelopeDocker --tag savanna-antelope:1.0.0-beta --ulimit nofile=1024:1024 --target ${TARGET} .
88 changes: 57 additions & 31 deletions doc/step-by-step.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,21 @@ You will also need to install the following python packages
https://github.com/eosnetworkfoundation/bootstrap-private-network/blob/main/AntelopeDocker#L21

## Build Antelope Software
You will need to build the following Antelope software from source, using the specified git tags or commit hashes. The software should be built in the following order to satisfy dependancies `Leap`, followed by `CDT`, followed by `Reference Contracts`.
You will need to build the following Antelope software from source, using the specified git branches. The software should be built in the following order to satisfy dependancies `Spring`, followed by `CDT`, followed by `Reference Contracts`.

These Git Commit Hashes or Tags are current to the following date.
https://github.com/eosnetworkfoundation/bootstrap-private-network/blob/fc95bfc37599b8b848d1d06ed47d5d6892b00868/bin/docker-build-image.sh#L17

### Leap
Latest Git Commit or Tag
https://github.com/eosnetworkfoundation/bootstrap-private-network/blob/fc95bfc37599b8b848d1d06ed47d5d6892b00868/AntelopeDocker#L46

[Full Instructions for Building Leap](https://github.com/antelopeio/leap?tab=readme-ov-file#build-and-install-from-source) or you can review the [Reference Script to Build Leap and CDT](/bin/build_antelope_software.sh).

### CDT
Latest Git Commit or Tag
https://github.com/eosnetworkfoundation/bootstrap-private-network/blob/fc95bfc37599b8b848d1d06ed47d5d6892b00868/AntelopeDocker#L47

[Full Instructions for Building CDT](https://github.com/antelopeio/cdt?tab=readme-ov-file#building-from-source) or you can review the [Reference Script to Build Leap and CDT](/bin/build_antelope_software.sh).

### Reference Contract
Latest Git Commit or Tag
https://github.com/eosnetworkfoundation/bootstrap-private-network/blob/fc95bfc37599b8b848d1d06ed47d5d6892b00868/AntelopeDocker#L53
### Branches
- Spring: branch `release/1.0-beta1` repo `AntelopeIO/spring`
- CDT: branch `release/4.1` repo `AntelopeIO/cdt`
- Reference Contracts: branch `main` repo `AntelopeIO/reference-contracts`

[Full Instructions for Building Spring](https://github.com/AntelopeIO/spring?tab=readme-ov-file#build-and-install-from-source), [Full Instructions for Building CDT](https://github.com/antelopeio/cdt?tab=readme-ov-file#building-from-source) or you can review the [Reference Script to Build Spring and CDT](/bin/build_antelope_software.sh).
[Full Instructions for Building Reference Contracts](https://github.com/antelopeio/reference-contracts?tab=readme-ov-file#building) or you can review [Reference Script to Build Contracts](/bin/build_eos_contracts.sh).

## Install Antelope Software
Now that the binaries are build you need to add CDT and Leap to your path or install them into well know locations. The [Reference Install Script](/bin/install_antelope_software.sh) must be run as root and demonstrates one way to install the software.
Now that the binaries are build you need to add CDT and Spring to your path or install them into well know locations. The [Reference Install Script](/bin/install_antelope_software.sh) must be run as root and demonstrates one way to install the software.

Note, the `Reference Contracts` are install later during the initialization of the EOS blockchain.

Expand Down Expand Up @@ -67,37 +57,57 @@ Taking everything we have prepared we will now start a `nodoes` instance. We wil
It is very important to include the option `--enable-stale-production`, we will need that to bootstrap our network.
https://github.com/eosnetworkfoundation/bootstrap-private-network/blob/fc95bfc37599b8b848d1d06ed47d5d6892b00868/bin/finality_test_network.sh#L94-L101

One the node is running we need to run two scripts to add accounts, permissions, and contracts.
## Creating Contracts and Accounts
One the node is running we need to run two scripts to add accounts and contracts. We break down this process into three steps.
- boot actions
- block producer schedule
- create accounts
- block producer setup

#### `Boot Actions`
[boot_actions.sh](/bin/boot_actions.sh) is the reference script. You pass in the following values, reference contracts is your locale git repository where you build the reference contracts software.

- 127.0.0.1:8888
- $DIR/reference-contracts/build/contracts
- PublicKey

This script creates the needed accounts.
This script creates the system accounts.
https://github.com/eosnetworkfoundation/bootstrap-private-network/blob/fc95bfc37599b8b848d1d06ed47d5d6892b00868/bin/boot_actions.sh#L15-L24

Below we activate the protocols needed to support Savanna and create the `token`, `boot`, and `bios` contracts.
We create 380,000,000 EOS tokens.
https://github.com/eosnetworkfoundation/bootstrap-private-network/blob/05d5b9c9806dbcd0a593a4108386b1e6f1a4dc24/bin/boot_actions.sh#L26-L28

Below we activate the protocols needed to support Savanna and create the `boot`, and `system` contracts.
https://github.com/eosnetworkfoundation/bootstrap-private-network/blob/fc95bfc37599b8b848d1d06ed47d5d6892b00868/bin/boot_actions.sh#L30-L77

[block_producer_schedule](/bin/block_producer_schedule.sh) is the reference script. You pass in the following values
#### `Create Accounts`

[create_accounts.sh](/bin/create_accounts.sh) takes two arguments
- 127.0.0.1:8888
- PublicKey
- $WALLET_DIR

Next we create 3 producer accounts, one for each of our nodes. After creating the keys, we create the accounts, allocate EOS, and add some resources.
https://github.com/eosnetworkfoundation/bootstrap-private-network/blob/05d5b9c9806dbcd0a593a4108386b1e6f1a4dc24/bin/create_accounts.sh#L16-L20

We create 26 users accounts. These accounts will stake resources and vote for producers. Same commands we used to create the producers. The only difference is funding amounts.
https://github.com/eosnetworkfoundation/bootstrap-private-network/blob/05d5b9c9806dbcd0a593a4108386b1e6f1a4dc24/bin/create_accounts.sh#L33-L37

This script create new block producers and creates the production schedule.
https://github.com/eosnetworkfoundation/bootstrap-private-network/blob/fc95bfc37599b8b848d1d06ed47d5d6892b00868/bin/block_producer_schedule.sh#L6-L52
#### `Block Producer Setup`
[block_producer_setup](/bin/block_producer_setup.sh) is the reference script. You pass in the following values

- 127.0.0.1:8888
- $WALLET_DIR

This script create registers new block producers and users vote for producers.
https://github.com/eosnetworkfoundation/bootstrap-private-network/blob/05d5b9c9806dbcd0a593a4108386b1e6f1a4dc24/bin/block_producer_setup.sh#L16
https://github.com/eosnetworkfoundation/bootstrap-private-network/blob/05d5b9c9806dbcd0a593a4108386b1e6f1a4dc24/bin/block_producer_setup.sh#L28

#### `Shutdown`
Now that we have initialized our first instance we need to shut it down and restart. Find the pid and send `kill -15 $pid` to terminate the instance.

## Create Network
Now we start our three nodes peer'd to each other. The Second and Third nodes will start from genesis and pull updates from the First node. The First nodes has already been initialized and it will start from its existing state. Soon each node will have the same information and the same head block number.

In the examples below the `PublicKey` and `PrivateKey` have the same values.
In the examples below we user different `PublicKey` and `PrivateKey` for each producer.

#### `Node One`
https://github.com/eosnetworkfoundation/bootstrap-private-network/blob/fc95bfc37599b8b848d1d06ed47d5d6892b00868/bin/finality_test_network.sh#L119-L128
Expand All @@ -113,8 +123,8 @@ Here you can check the Head Block Number and Last Irreversible Block and see the
For the last step we will activate the new Savanna algorithm.

#### `Generate Finalizer Keys`
We need to generate the new BLS finalizer keys and add them to our configuration file. Each producer needs to generate a finalizer key. We have three nodes and that requires calling `leap-util bls create key` three times.
`leap-util bls create key --to-console`
We need to generate the new BLS finalizer keys and add them to our configuration file. Each producer needs to generate a finalizer key. We have three nodes and that requires calling `spring-util bls create key` three times.
`spring-util bls create key --to-console`
Save the output from the command. The public and private keys will be added as `signiture-provided` lines to `config.ini`. This configuration file is shared across all three instances and each instance will have all three lines.
- BLS Public keys start with `PUB_BLS_`
- BLS Private keys start with `PVT_BLS_`
Expand All @@ -135,12 +145,28 @@ https://github.com/eosnetworkfoundation/bootstrap-private-network/blob/c1fdba2dc

https://github.com/eosnetworkfoundation/bootstrap-private-network/blob/c1fdba2dcf8ff69d983292960f8ee49711105195/bin/finality_test_network.sh#L168-L176

#### `Apply Finalizer Key`
`cleos push action eosio setfinalizer` with `setfinalizer_policy` json. In the developer example below we have three producers. The threshold value should be 2/3 or greater of the weights across all the finalizers listed. Once this command is run, the new Savanna algorithm is activated.
#### `Register Finalizer Key`
The [activate_savanna.sh](/bin/activate_savanna.sh) script registers the finalizer keys. In this example we register one for each producer.
https://github.com/eosnetworkfoundation/bootstrap-private-network/blob/05d5b9c9806dbcd0a593a4108386b1e6f1a4dc24/bin/activate_savanna.sh#L23-L27

Here is an example using the regfinkey action. Note the permission used is the block producer's.
```
cleos --url $ENDPOINT push action eosio regfinkey '{"finalizer_name":"NewBlockProducer", \
"finalizer_key":"PUB_BLS_v8-ZaaZZ5ZZaZ5ZaZZZZaa5aZaZaaZZa5aZZ5aZaZ5aaZZa5a-ZaZZ555Z55aZZZ5aZaZZaZaaZ5aZ55ZaZZaaaaaaZa5Z-5aa5aaaaZaaZ5Zaaaaa5ZaaZZaaa5ZaZZZaZa5a", \
"proof_of_possession":"SIG_BLS_aa5Z-aZZZ5aaaZZZ5ZaaaZ5a-aZaa_aaZZ5aaa55aZa-ZaZZaZZZ5ZZZaaZZZ5ZZZZ-aaZ_55ZZZ5Z5a5ZZaaa5aZZ5aZaaZ5aa5ZaaZ-ZZZZa5ZaaaZZa5aaZZZZaaZ5ZZZZZa5ZZZ5Z55a5ZZZ5aaZa5Z5ZZ5Z5-aaZZZZZ-ZZZaZZ5a5aaZZZaZa5ZZ5ZaZaaaZaZaa5aaaaaaa5aZZaaZ5aZ5ZZ5aaaZZaaaaaZZaZa55ZaZaaaaaaZaZZZZZa5aZa"}' \
-p NewBlockProducer
```

https://github.com/eosnetworkfoundation/bootstrap-private-network/blob/c1fdba2dcf8ff69d983292960f8ee49711105195/bin/activate_savanna.sh#L20-L44
#### `Activate Savanna`
The final step is to activate savanna. This is done with a action that takes no arguments. The permission required is `eosio@active`
https://github.com/eosnetworkfoundation/bootstrap-private-network/blob/05d5b9c9806dbcd0a593a4108386b1e6f1a4dc24/bin/activate_savanna.sh#L35

#### `Verify Faster Finality`
Here you can check the Head Block Number and Last Irreversible Block and see they are three apart. `cleos get info`

In addition you can check your logs for the following strings, the will provide information on the exact block where the transition will/does occur.
- `Transitioning to savanna`
- `Transition to instant finality`


Congratulations you are running a Private EOS network with the new, faster finality, Savanna algorithm.

0 comments on commit 3294441

Please sign in to comment.