ethereum / go-ethereum

Go implementation of the Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
47.2k stars 19.99k forks source link

After shutdown geth balance be 0 #25063

Closed ygit1 closed 2 years ago

ygit1 commented 2 years ago

System information

Geth version: latest OS & Version: ubuntu20.04

Expected behaviour

geth --nousb \ --datadir data \ --syncmode 'full' \ --port 30333 \ --networkid 2000 \ --miner.gasprice 0 \ --miner.gastarget 470000000000 \ --http \ --http.corsdomain '' \ --http.port 9000 \ --http.vhosts '' \ --http.api admin,eth,miner,net,txpool,personal,web3 \ --mine \ --allow-insecure-unlock

miner.start()

eth.getBalance(eth.accounts[0])

1000000

I stop geth chain ctrl d

and run again,

eth.getBalance(eth.accounts[0]) 0

Actual behaviour

Steps to reproduce the behaviour

Backtrace

[backtrace]

When submitting logs: please submit them as text and not screenshots.

ygit1 commented 2 years ago

Ok, I got a solution from https://github.com/ethereum/go-ethereum/issues/18383#issuecomment-451125546

It is too dangerous at any cost. If the server goes down due to some malfunction, will that make all the coins disappear?

Other crypto like bitcoin or substrate never be the same.

money1636 commented 2 years ago

How do I get contribution??

money1636 commented 2 years ago

Contributation

karalabe commented 2 years ago

Not really clear what you're doing and on what network. Blocks mined should not disappear, unless you're running a single-node network and you crash geth. In that case the data kept in memory is lost and there's nobody to seed it back to you. But that itself should not happen either if you shut Geth down.

If you want to mine on any existing network, you should make sure you are synced before attempting to start the miner, otherwise it gets weird. Also 1000000 is not a valid mining reward on any ethereum network, so unsure what code you're running that produced it.