[Ethereum] Is the entire ethereum blockchain stored on the machine

blockchain

Blockchain n00b here with a background in software development using traditional data storage (SQL) and app runtimes.

I realize that this question may have already been answered, but I am having trouble wrapping my head around blockchain in general so I want to ask this question very plainly for the benefit of my simple brain and perhaps the brains of others:

When I install Ethereum on my machine, does the entire blockchain (including all transactions ever made on Ethereum and their embedded data) get downloaded to my machine?

I think this is how it works, but I have downloaded about half the blockchain so far and it looks like only a couple of gigabytes. How is this possible? Seems like we would be in petabyte range.

It's incredible technology and I hope someone will help me understand it in simple terms (pretend you are answering a 5 year old ;).

FOLLOW UP QUESTION: Can the chain be queried? For example, if I sold products via smart contracts, could I have an account management tool that queries my local chain for all of my transactions?

Thanks in advance!

Best Answer

The answer depends on the client you are using and the mode that you use to sync.

In "full" mode, you do indeed download the entire blockchain, including every transaction, and verify every transaction individually as you go.

In many variants of "fast" mode, only the block headers (metadata), transaction receipts, and state for each block are downloaded. This means you can still see the state at every point in time, but don't need to store the data for every transaction. Additionally, the proof of work is verified for each block to ensure that the blocks are genuine.

In modes like Parity's "warp" sync, you download full "snapshots" of the blockchain which are even smaller than the block header + states. The client then fills in missing data in the background and as needed.

The reason that the full blockchain is so small (only a few GBs) is that putting data on the blockchain is simply very expensive. See What is the cost to store 1KB, 10KB, 100KB worth of data into the ethereum blockchain?

Related Topic