0

It is known that historical database of all bitcoin transactions stored in blk*.dat files. Is it possible for bitcoin-core to change any of this files in any time? Or this database is equal for all bitcoin peers (may be except the last few files)?

I think this files consist non-changable historical data for blockchain. Is it true?

1 Answer 1

2

Yes, Bitcoin Core can and will change the blk*.dat files, which, as has been told to you many times before, can be different for all nodes. Once Bitcoin Core has validated a block, it updates its chainstate database so that it knows what its current blockchain tip is. It also updates that database with the most recent UTXO set. So once this is done, the block can be thrown away as we have now recorded that we validated it. This is what pruning does; it throws away old blocks that we have already validated. Having the correct chainstate (UTXO set and blockchain tip) is all that matters.

10
  • 1
    However, if pruning is not enabled, then AFAIK the most recent blk*.dat file is only appended to, and the older files are never changed at all. Is that correct? Aug 30, 2017 at 13:51
  • Yes. The files are append only.
    – Ava Chow
    Aug 30, 2017 at 13:52
  • @NateEldredge how to enable or disable prunning? Aug 30, 2017 at 14:42
  • @Denis: It's disabled by default; see bitcoin.stackexchange.com/questions/37496/… for how to enable it. Aug 30, 2017 at 16:06
  • Bitcoin Core can change on-disk database. Malware? If need, I can prove it. Guys, don't be so homely. Answer to me. Jun 5, 2018 at 4:16

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.