If someone manipulates the local blockchain data, does ethereum clients like geth return false data?
For example, after cracker manipulates local blockchain files or leveldb, does geth return manipulated data?
If someone manipulates the local blockchain data, does ethereum clients like geth return false data?
For example, after cracker manipulates local blockchain files or leveldb, does geth return manipulated data?
The simple answer is yes and no.
You have to understand how a blockchain works and how it is related to all the other nodes on the network and how they reach consensus about the state of the blockchain.
Firstly if the database is properly corrupted (ie stored bits are missing or inaccessible) you will get read errors, which means that no, you won't be able to show incorrect data, because you won't show data at all.
Secondly if you are talking about false transactions, then it is difficult to see how that could occur at all on the mainnet. (Although this is simplification for the purpose of an answer).
The network agrees all transactions and the blockhash is calculated from transaction data and the previous blockhash. This is the whole idea of a chain of blocks! Any change in the transaction data would result in a different blockhash and therefore would break the chain.
A false block could not be simply inserted because all subsequent hashes would have to be recalculated from your fake block. This is the underlying security model of the blockchain. Although it is not technically impossible to insert a block, your attacker would then have to recompute all subsequent transactions hashes and blocks faster than the network is doing it already. This is computationally impractical, and therefore generally accepted as secure enough.
Thirdly, for anything like false blocks to happen your node would
In either case you would be seeing false data, but again you would be operating on a fork and not the main chain.
As your question was quite vague, this should cover the general points to think about.
.db
files are checked for validity/consistency, and how often this occurs? Presumably only when they're read, but how often does that happen? (I had a quick look in the code but it wasn't immediately obvious.)
Commented
Jul 22, 2016 at 13:17
geth, parity, et. al. are nodes running software that have two main interfaces - one RPC, and one to the blockchain. It's entirely possible to hack a node and lie to the RPC client. It's not possible to lie to the blockchain in a useful manner. (details in the other answer).
If your RPC client is dealing with significant amounts of value external to the blockchain (e.g. an exchange), you should verify transaction hashes against multiple nodes in different security domains and using different node technologies, and make sure the network firewalls are set up so the nodes cannot talk to each other other than by the blockchain protocol.
It's probably even useful to verify hashes against one of the public blockchain tracker websites, which gives you some value in a human watching what's going on, but those websites tend to discourage automated systems querying them.
Nobody should ever trust a single software node for anything of significant value.