2

I deployed a private version of Ethereum on my laptop.

I am using this code to deploy:

geth –-identity "blockdb" –-rpc -–rpcport "9040" --rpccorsdomain "*" –-rpcapi "db,eth,net,web3" –-datadir "c:\\blockchain" –-port "30303" –-nodiscover –-networkid 76543 console

and this genesis:

{
"config": {  
    "chainId": 76543, 
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip158Block": 0
               },
"difficulty": "0x4000",
"gasLimit": "0x8000000",  
"alloc": {}
 }
 }

The blockchain seems to deploy well, since it gives me the same chain ID, i open Mist (without changing an ysettings) and can see the wallets i create. Miner.start() also works. I see the ethers coming in from the mining. I can see the wallets i create andthe minutes since last block. but the status remains always connecting.

enter image description here

My questions are as follows:

1) When i close the console and restart it, to restart the node, i use the above command again. is that correct? Because:

2) when I restart, I can see the wallets previously created but not the ether. the ether is lost. they all restart from 0. why is that?

3) I am trying to interact 'externally' with the blockchain, by using nethereum and ethereum wallet. In both apps I can see the wallets and their balance. but i cannot create new wallets, deploy contracts or transfer ether.

4
  • 2) Are you getting the same no. of blocks you left before closing the console? 3) How are you connecting externally with running private network?
    – Aniket
    Jul 23, 2018 at 8:26
  • 2) please enlighten me on how to check that 3) ethereum wallet and nethereum app. I managed to download some tutorials and actually transferred some ether. so maybe it was my code that is the issue. HOWEVER, the ethereum wallet still does not work.
    – DottoreM
    Jul 23, 2018 at 8:33
  • did you use init genesis.json to initialize your chain?
    – Badr Bellaj
    Jul 23, 2018 at 17:00
  • this command: geth --datadir c:\\blockchain init c:\\genesis.json
    – DottoreM
    Jul 23, 2018 at 19:42

3 Answers 3

3
+50

If you gracefully close Geth it should be fine (Ctrl + D). I have a hunch you are forcefully killing it.

Starting with Geth 1.8.0, we don't push everything to disk immediately, rather retain the state in memory for some amount of time (1h of block processing with the latest code). This reduces disk usage enormously. However, it also means that if you kill Geth before it can push the data to disk, you'll need to resync that part.

Now, if you have a single node, that's problematic because there is noone to sync from. Please make sure you always terminate Geth gracefully and not kill it.

0

Try with geth --datadir ./chaindata -networkid 76543

8
  • this points to chain id 1
    – DottoreM
    Jul 23, 2018 at 12:13
  • Start geth 1st and start mining operation. Now start mist wallet. keep the chain data dir same every time. something like –-datadir ./blockchainDir. also updated the syntax Jul 23, 2018 at 12:24
  • this does not solve my issue. i am restarting the blockchain using the command i wrote in the question and it is resetting to 0.
    – DottoreM
    Jul 23, 2018 at 12:57
  • Have you tried it without Quotes? " Jul 23, 2018 at 13:27
  • i did and it did not work.
    – DottoreM
    Jul 23, 2018 at 13:49
0

Once you run the Node, Node now maintain all block information. What happen if you restart the node.

case-1 : when node is deleted, it means you are deleting blockchain info from the node. you delete directory  datadir "c:\\blockchain .   

In this case You will not get any information for sync to latest one. So it start from beginning. After syncing with running node it will regain the latest state of the chain.

case-2 : If you have same node on c:\\blockchain as you left before then the chain gain latest state of the chain where you have left before and continue from there.  

If your node is behind the state of running node in the network then it start to sync with node that is currently available and in latest state.
So this answer your first question.

when I restart, I can see the wallets previously created but not the ether. the ether is lost. they all restart from 0. why is that?

You have created the node and started to mine with miner.start() then,
you must need an account to get incentive . That incentive is accumulates in your account. If you check ether then you will get the actual ether balance in your account, either you check from geth or by wallet or web3js.

Now the case is when you restart the node, all state of the chain will be maintained in node, there is no chance to erase previous state of the account. There may be possible when your chain is not fully synced, Otherwise it works fine. I recommend you to recheck the node whether you have started the same node again?. This may solve your second question.

I am trying to interact 'externally' with the blockchain, by using nethereum and ethereum wallet. In both apps I can see the wallets and their balance. but i cannot create new wallets, deploy contracts or transfer ether.

If you want to interact with the ethereum blockchain node you have to enable rpc flag

--rpc

you have done already. Now another point is you have to specify the endpoint of the node. it will be like this- https://172.31.40.193:30303. This endpoint specify from which node you are interacting with the blockchain. This may be possible that you have not re-syncing your wallet with the node.

9
  • Sorry but I am not understanding your reply. What do you mean when node is deleted? What i do is, i close the Command Line and then restart it again, using the command : "geth –-identity "blockdb" –-rpc -–rpcport "9040" --rpccorsdomain "*" –-rpcapi "db,eth,net,web3" –-datadir "c:\\blockchain" –-port "30303" –-nodiscover –-networkid 76543 console" I am not deleting any folders. I used miner.start to mine, i can see the ether coming in. I turn off the cmd, restart again and all ether disappears.
    – DottoreM
    Jul 23, 2018 at 9:56
  • All chain related data is stored in the datadir that you have provided by geth command. This datadir is the directory where your chain information is stored like privatekey and other stuffs. When you delete the directory where your chain data is stored then from where again chain get the data of last state of the chain? So you have to specify same data directory to continue same node.
    – Gopal ojha
    Jul 23, 2018 at 10:16
  • As I have already said, I am not deleting any folders. I am closing geth. not deleting folders. starting geth again, and the ether is not there.
    – DottoreM
    Jul 23, 2018 at 10:17
  • I found same issue few month before, And that is due to rpc flag. When you enable rpc flag then your account will transfer ether to arbitrary account which even not exist in the network . Please check all receipt of the transaction in each block. If so then do not enable rpc flag. to interact with node make another node which have rpc flag is enabled. This is right fix for your issue.
    – Gopal ojha
    Jul 23, 2018 at 10:32
  • what command do you use to restart node after closing geth? I tried geth --datadir=./chaindata but it always points to chainid 1
    – DottoreM
    Jul 23, 2018 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.