So, we all know that blocks get stored in smaller files, like blk00000.dat, with several blocks packed inside. But here's the thing: is there a theoretical max for how much can be stored before things start breaking down? I mean, there's always a chance of things like key collisions (with 2^256 possibilities, it's super unlikely, but theoretically it could happen). So, can this program handle an infinite number of blk files, or is there a cap somewhere? Assuming hard drives keep pace with the blockchain's growth, it seems like as the blockchain expands, storage space would also increase, letting us keep adding these files.
What I'm really curious about is the software aspect. Would it struggle with a massive number of files? Also, at the hardware level, we're already managing a ton of files. It’s interesting to think about limits on how many files a folder can handle. On Windows 10, it’s about 4,294,967,295 files, which is wild. Not sure about Linux, but I feel like there are ways to break the blockchain into different folders that could work together. Do all files need to be in one folder, though?
Let’s brainstorm all the possibilities and try to spot any potential issues we might encounter down the line so we can tackle them before they come up.
Theoretical limits on blockchain size
12 replies 66 views
We really dont need to worry about this. The way blockchain is designed, it can deal with a crapload of data. Sure, it can be interesting to theorize about possible limits, but lets be real we are generations off from hitting any sort of storage or software limitations. By the time we even approach such a scenario, technology will have advanced far beyond our current capabilities.
HyperRavenFull Member
Posts: 175 · Reputation: 633
#3Aug 3, 2020, 02:56 PM
That is a problem independent of Bitcoin and it would depend on the filesystem as well as the OS and that is out of our control. For most intent and purposes, we will not run in the problem of individual file size since the blocks are being split into multiple files already. If the problem is with the size of the volume, then I believe that most of the filesystems that we're using already have theocratical compatibility in the order of exabytes. The most naive solution that I can think of is just to symlink the relevant block files into different volumes.
If the individual hard drives were to get bigger, I doubt that OSes wouldn't be supporting different filesystems with larger volume capacities.
Yes. Each and every SHA-256 call will limit the hashed message into 2^64-1 bits at most.
colddiamondHero Member
Posts: 623 · Reputation: 2467
#5Aug 3, 2020, 08:15 PM
Years ago (DOS / 3.1) that number was smaller it grew with Win 98 and then again in XP and then again. So it's meaningless to worry about. By the time BTC hits that number the OSs we will be running are going to be able to handle much larger amounts of files and file sizes.
Kind of like storage. 4 TB SSDs used to be over $1000 now you can get cheap name brands for under $200 and even the 8TB are under $800
It's not even a concern unless you are going to want to run a copy of bitcoin core that will be released in 2095 on an OS from 2001.
-Dave
silentchainHero Member
Posts: 473 · Reputation: 2317
#6Aug 3, 2020, 11:39 PM
I think the theoretical limits for blockchain size do exists and it is defined by the Bekenstein bound of Sgr A* (which is black hole in the centre of our galaxy). The bigger size would be not accommodated by any imaginable device invented (at any time, in the past, present or future) by any civilization presumably existing in Milky Way.
colddiamondHero Member
Posts: 623 · Reputation: 2467
#7Aug 4, 2020, 01:13 AM
Just as an FYI
https://x.com/davepl1968/status/1772042158046146792
And
https://www.theverge.com/2024/8/16/24221635/microsoft-fat32-partition-size-limit-windows-11
So even old things might be able to store even more if MSFT makes any other changes as time goes on.
Probably will not matter for BTC since nobody should be using outdated file systems to host their node but still an interesting tidbit.
-Dave
Imagine if file system updates were seen as being bad the same way as Bitcoiners see protocol updates being bad.
We would still be limited to 4GB max file size with FAT32.
Nobody should be using outdated cryptocurrency or for that matter, anything that's outdated.
So does anyone know or has tested if symlinks on linux work? so if you were to run out of max files in a single folder, it would continue from another folder. But Bitcoin Core would need to know where to pick the files from, or that is what symlink would do? it would be as if it was the same folder even tho it's 2 separate folders? Perhaps Bitcoin Core itself should have the option to add several folders with a maximun amount in number of files or MBs. So you would set
Folder 1: C/Bitcoin/blockchain1 - max size 100GB
Folder 2: C:/Bitcoin/blockchain 2 - max size 100GB
etc
This way even older system could keep up. Important since all cpus after 2008 or so are compromised.
Well, if you cannot trust your system, then you cannot trust anything else. Going out of x86 is one option, installing libreboot is another one. Fortunately, some people successfully disabled Intel ME, even on more modern computers: https://puri.sm/posts/deep-dive-into-intel-me-disablement/
You should be probably more worried about using Windows, than about using Intel ME, because it is easier to compromise the former, than the latter. For example, because of IPv6 WiFi vulnerability, we even had a forum news bar, encouraging users to upgrade their Windows.
Bitcoin clients can technically store information related to the blockchain in any format it so chooses. From a technical perspective, a bitcoin client will store information related to the blockchain in some kind of database. The important part of the blockchain is the unspent outputs, and there is a limit to how large this can get due to the limited number of bitcoin and the smallest allowable fraction of a bitcoin (satoshi). Even if the blockchain were to become too large to fit on a single hard drive, it could potentially be stored on multiple hard drives, and the majority of the data would never need to be accessed after it is validated one time.
There is also a technical limit as to how large the blockchain can be as a function of the block number, as each block has a maximum size. The blockchain will grow at a much slower rate due to blocksize limitations than there would be potential issues with hard drive limitations.
No, because you can create and spend zero satoshis. Then, amount is sum-neutral, but signatures and scripts are still verified.
The number of blocks is unlimited. And if they are deterministic, then you can create a very large chain, which will take a very little space. And because the block number is expressed as a "big number", then it is a much larger limit, than the maximum size of the message, which can go through SHA-256.
Obviously the larger the files there are the less efficient a system will operate compared to if its only managing small files. It wont stop working altogether but its effect could be undeniable. No, theres no actual number of how many blk files are allowed to be created before it stops working so it will just keep adding and adding throughout. I dont think this is something we have to worry about though since bitcoin was exactly designed to handle large files.
If it helps answer your curiosity, theres a thing called Pruning. Pruning is basically the removal of old data from bitcoins core that have been validated already or are not necessary to validate new ones anymore.
Related topics
- Extracting R values from blockchain signatures 14
- Bitcoin Core displaying coins (UTXOs) in a new tab 13
- Are you in favor of BIP-110? Let's get a Bitcoin poll going. 0
- Erlay seems to have some issues here’s a better proposal for a bitcoin protocol without invites 3
- New Optional Hourglass Implementation is Live 3
- Ways to earn some sats by contributing to bitcoin core development 5