I am using a nodejs application to add data to go-ethereum (geth) local environment using smart contracts and truffle. If for a reason or another anything happens and I need to stop geth and resume it later, I am not able to get the data. To reproduce:
ps -aux | grep geth
sudo kill -9 ProcessID
geth --datadir ./myDataDir --rpc --targetgaslimit 18446744073709551615 --networkid 1441 console 2>> myEth.log
miner.start()
personal.unlockAccount(personal.listAccounts[0], "Password", 0)
pm2 restart myApp
Error showing on NodeJS app when I try to use GET API of a data added before stopping geth:
0|myApp | 21-06 12:19:44.271: You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
0|myApp | Error: Invalid address passed to BankFactory.at(): 0x
This is obviously a conflict in allocating addresses, as it's not reading the correct address of the BankFactory. Contract addresses are usually generated when I do truffle deploy
and then I copy contracts to my App's directory, but in this case they are still in my Node App, so it seems contracts on the blockchain itself are removed or changed!
How to fix that?