3

I have downloaded the go-ethereum code and analyzing it. It is working properly but I am not able to locate the file read and write for the block.

I have seen the eth.getBalance() function code but I could not find the file read option anywhere. It is going through the trie and get the data.

How the blocks are read by the programs?

2

It's not just one flat file. It's a database, LevelDB to be precise.

You can examine the chaindata folder (usually $HOME/.ethereum/chaindata on Linux) to see the files involved, but chances are you won't be able to use them directly.

If you really need the blockchain as a single file, you can use geth export. However, it's just creating a file for that purpose--internally, it is not using a single file at all.

  • yes I have noticed that it is ldb file, which is local database. I would like to find out where this database in read in file – userven Dec 30 '16 at 12:37
  • I think this is the part of go-ethereum's source in question. – Matthew Schmidt Dec 31 '16 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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