diff --git a/README.md b/README.md index 5a8a635..35f00c2 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ You can read the docs in [Gitbook](https://onbloc.gitbook.io/gnoland-developer-p * [Environment Setup](docs/environment-setup/) * [Initial Setup](docs/environment-setup/initial-setup.md) * [Build the Local Testnet](docs/environment-setup/build-the-local-testnet.md) + * [Read the Genesis again](docs/environment-setup/restart-on-block-1-to-read-the-genesis-again.md) * [CLI](docs/cli/) * [Common Parameters](docs/cli/common-parameters.md) * [gnokey](docs/cli/gnokey.md) diff --git a/docs/environment-setup/README.md b/docs/environment-setup/README.md index 697cf7b..b7495d1 100644 --- a/docs/environment-setup/README.md +++ b/docs/environment-setup/README.md @@ -4,3 +4,4 @@ This section guides on how to set up development environments. * [Initial Setup](initial-setup.md) * [Build the Local Testnet](build-the-local-testnet.md) +* [Read the genesis again](restart-on-block-1-to-read-the-genesis-again.md) diff --git a/docs/environment-setup/restart-on-block-1-to-read-the-genesis-again.md b/docs/environment-setup/restart-on-block-1-to-read-the-genesis-again.md new file mode 100644 index 0000000..f621e60 --- /dev/null +++ b/docs/environment-setup/restart-on-block-1-to-read-the-genesis-again.md @@ -0,0 +1,36 @@ +In order to obtain GNOT tokens for your tests, it's often said you can **edit the genesis** file. + +However if you launched `build/gnoland` locally already, you won't get any token. +That's because it starts again at whatever block it was, and at this point the genesis file isn't read anymore. + +`$ gnokey query auth/accounts/g1fjh9y7ausp27dqsdq0qrcsnmgvwm6829v2au7d` + +Response: +``` +height: 0 +data: null +``` + +In order to begin at the genesis again, just remove the testdir folder and start gnoland again: + +1. edit `gnoland/genesis/genesis_balances.txt` adding your address +2. `mv testdir testdir.old` +3. `build/gnoland` + +Now the blockchain restarts on block 1. + +`$ gnokey query auth/accounts/g1fjh9y7ausp27dqsdq0qrcsnmgvwm6829v2au7d` + +should work: +``` +height: 0 +data: { + "BaseAccount": { + "address": "g1fjh9y7ausp27dqsdq0qrcsnmgvwm6829v2au7d", + "coins": "10000000000ugnot", + "public_key": null, + "account_number": "5", + "sequence": "0" + } +} +```