Ok, lets create another tweak for that issue.
There are 2 ways that we can use in order to restar our blockchain to get rid of that issue.
1. Create another script to use it when we have a corrupted blockchain:
in ubuntu terminal , after properly apt-get update and upgrade.
Install nano if dont have it.
sudo apt-get install nano
Navigate to your contract folder.
Run command:
sudo nano nodeos_replay
inside black interface of nano, copy/paste this:
nodeos --replay-blockchain -e -p eosio --plugin eosio::producer_plugin --plugin eosio::chain_api_plugin --plugin eosio::http_plugin --plugin eosio::history_plugin --plugin eosio::history_api_plugin --access-control-allow-origin='*' --contracts-console --http-validate-host=false >> nodeos.log 2>&1 &
echo "Nodeos REPLAY BLOCKCHAIN started, check status on 'tail -f nodeos.log'"
echo " "
echo "IMPORTANT: Remember to close proprely with command 'pkill nodeos'"
Ctrl+S to save on nano.
Ctrl+X to leave nano editor.
Run Command to make nodeos_start file executable:
sudo chmod +x nodeos_replay
Start command by:
./nodeos_replay
This will rebuild all the blockchain from scratch, so if you have some accounts or tokens created, you probably are going to lose them, so be sure to always use the “pkill nodeos” command in order to properly close the nodeos process to avoid a corrupted blockchain issue.
2. Manually deleting the eosio blockchain data folder.
Open a Terminal window, we have to navigate to the “.local” folder
cd ~/.local/share/eosio/nodeos/
Manually delete the “data” folder
sudo rm -vrf data
rm is the command to delete any file/folder on linux, -vrf means [v = verbose to explain what is being done, r= remove directory and content recursively, f= force to ignore nonexistent files and arguments]
You will be promted with somethin like this thanks to the verbose option:
removed 'data/somethingFile'
removed 'data/otherFile'
removed directory 'data'
Now you can close this terminal window and start again the blockchain with the script “nodeos_start” that you have created before.
Be aware that both methods will probably make you loose any account or token that you have created in the past, so have to restart all the accounts and smart contracts deployment from scratch. In both cases, to avoid this issue, you have to be sure to use the “pkill nodeos” command in order to properly close the nodeos process to avoid a corrupted blockchain issue.
Remember you can check here my personal (now public) library that i have to do to save me some time to learn and run a lot of commands.
-
EOS Coding: this is a list of tutorials i made for myself to save a lot of time on the way.
-
EOS Dog Contract Improvements: you can find here my own improvements on the Dog Contract has an example for the Academy.
- Issues & Fixes i found in the path.
- Linux tweaks for nodeos.
- EOS Developers portal.
- EOS functions index.
Hope you find this useful!
If you have any doubt, please let us know so we can help you!
Carlos Z.