Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data on Private Ethereum blockchain lost/disappears after couple of days

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.

like image 512
Ghassan Zein Avatar asked May 24 '18 09:05

Ghassan Zein


People also ask

Can we store images on Blockchain?

Its advised not to store images on the blockchain due to high gas cost involved for each transaction. Blockchain technology is designed to provide authenticity, transparency and security. if your images need them, then you should get a NFT for them.

How much does it cost to store an image on the Blockchain?

A 2021 calculation estimated that storing 500kb on the Ethereum blockchain would cost $20,000, meaning storing small images on the Ethereum blockchain is more impractical. A discussion regarding the possibility of storing images on the Ethereum blockchain can be found in a thread on StackOverFlow.


1 Answers

This is not a private blockchain!

--networkid 1441

This only says that you communicate with clients that also run a network with ID 1441. It might be unlikely, but if someone else runs a network with ID 1441, this node will connect to your node just fine. And in case, the other network with the same ID has a longer (more "heavier") chain, this overwrites your local chain.

To avoid this, try a more random network ID, maybe 7-9 digits, and disable discovery with

 --nodiscovery

Or just use the --dev preset.

like image 181
Afr Avatar answered Nov 05 '22 19:11

Afr