How to calculate the size of the blockchain? I want to find the size of the blockchain data. I've been using this Linux command:

du --exclude=index /home/me/.bitcoin/blocks/

Is this the most accurate way to do it? And does dividing the result by 1024/1024 give the size of the blockchain in GBs?


  Note: The --exclude=index part excludes the blocks/index/ subfolder, which I've heard is extra metadata used for levelDB to make it faster to search through the blockchain. I just want to know the size of the blockchain data only, so does it make sense to omit this?
du rounds up file sizes to the next multiple of your filesystem's block size.  It also includes the sizes of directories.  So this will give you a (slight) overestimate.

You really just want to add up the total sizes of all the blk*.dat files.  You can get that with

du -c --apparent-size /home/me/.bitcoin/blocks/blk*.dat


You can divide this number by 1000000000 to get GB, or by 1024*1024*1024 to get GiB (note the distinction).

Note that this will still include "orphan" blocks that you downloaded and stored, but that are not part of the main block chain.  There isn't any easy way to exclude those, as far as I know.