Post
Topic
Board Development & Technical Discussion
Topic OP
What stops short forks from taking up everyone's disk space?
by
interfect
on 29/06/2013, 22:42:28 UTC
I'm working on my own generic blockchain implementation, and I have a question about how Bitcoin ensures that everyone doesn't need to remember every fork that ever happened.

The longest chain always wins out, in the sense that that's the chain that the client looks at to see who has how many Bitcoins. But if I start getting blocks that fork off my current longest chain several blocks back, I need to keep those blocks around in case they end up forming a chain longer than the one I'm on. And there's no guarantee that I won't get half the blocks in this new longest chain today, and half tomorrow, so when I shut down my client, those blocks in the currently-shorter chain need to be saved to disk.

What stops those blocks from needing to be kept around indefinitely?

If the blocks do need to be kept around indefinitely in case their fork becomes the longest chain, what stops someone from solving a large number of blocks forking off some early, low-difficulty point in the chain, and taking up lots of disk space with all these forks?