I understand that the data in a blockchain is stored in a database. E.g., this post states that Ethereum uses LevelDb or RocksDb. I expect that normally the only access to this database is through smart contracts, but is there anything preventing someone from modifying the underlying database out of band e.g., using the APIs that come with the database? What would happen in that case? Wouldn't the changes propagate to other copies of the database? And wouldn't that amount to a hack? How is the blockchain secured from such hacks?

2 Answers 2


What would happen in that case?

Your copy would be invalid. You might be able to fool yourself with some odd responses from your node, but the network is indifferent to malfunctioning nodes. Nothing you do would alter the history agreed on by the rest of the network.

Wouldn't the changes propagate to other copies of the database?

No. Properly functional nodes would ignore invalid blocks emitting from your node.

And wouldn't that amount to a hack?

Blockchain is a data structure with a kind of in-built integrity that would be broken by your out-of-band edit. You wouldn't be able to make it work.

How is the blockchain secured from such hacks?

The entire network agrees on the history of everything that happened and strict rules about what can happen. Your out-of-band edit would be recognized as unacceptable. It might help to consider that far from a typical cluster, blockchain nodes do not necessarily trust each other and up to 49% can be deliberately hostile to the network - the network will not budge.

Perhaps others will chime in with more technical resources to explain how that works.

Hope it helps.


You can modify your database, so that for example, you have more coins than everyone else.

However, everyone with the blockchain knows that isn't true, so will ignore whatever transactions you have of spending coins that you do not have.

Having the blockchain means running consensus software: software that everyone has agreed to run. This software checks what is valid and what is not, and will prevent your hacked changes from affecting the blockchain.

  • Doesn't state machine replication mean that any changes I make will be replicated to other replicas? Much the same way as modifying a doc on google drive updates changes to all other copies? Do the other replicas have some sort of code that verifies that the changes are as a result of running the smart contract? If so, how? what are the details?
    – morpheus
    Commented Aug 28, 2019 at 4:35
  • Any changes you make out of band will not be replicated. The state changes that are replicated are the ones that nodes reach a consensus of. And nodes consent only changes through transactions in valid blocks that are appended. Read github.com/ethereum/wiki/wiki/White-Paper#blockchain-and-mining
    – Sanjay S B
    Commented Aug 28, 2019 at 4:57
  • 1
    @morpheus There are specific rules on what are valid updates to the blockchain. The Yellow Paper has the details of the consensus: ethereum.github.io/yellowpaper/paper.pdf
    – eth
    Commented Aug 28, 2019 at 6:01

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.