0 votes
1 view
in Blockchain by (16.8k points)
edited by

I am deploying a private ethereum blockchain (geth) on a virtual machine on Azure. Upon deploying my Solidity contracts on the blockchain and launching my NodeJS application to it, I am able to add data normally through web apis of the nodejs Loopback App and everything is working fine and I can see the added data using the GET apis.

However, after 1-2-3 days (random) I am not able to retrieve the data I added through my GET apis, while am still able to add new data which confirms that Geth is running fine and wasn't interrupted.

I am running geth using:

geth --datadir ./myDataDir --rpc --networkid 1441 console 2>> myEth.log

myEth.log isn't showing anything wrong, nodejs logs are clean as well.

eth.syncing shows false which means the network is synced.

size of myDataDir folder is still increasing so logically data should be somewhere there but it's not showing.


 

1 Answer

0 votes
by (14.4k points)

Firstly, the blockchain you are using is not a private blockchain. Therefore, users with access to other nodes may be able to overwrite existing data.

Secondly, you are using Network ID 1441. This means you can only communicate with clients that also on the network ID 1441. This means that users with Network ID 1441 can connect to your node seamlessly. And if the other network with network ID 1441 has a longer chain, your chain is overwritten by the longer chain. To avoid this, you can use a longer Network ID (7 to 9 digits) and disable its discovery by using the command

--nodiscovery

Or, you can leverage the --dev preset to make sure that data does not get erased.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...