Open maltfield opened 2 years ago
The website already has an FAQ item "How big is the Monero blockchain?"
While I do appreciate this information, note that this does not satisfy this request.
This request is to add to the FAQ's Answer: a whole document expounding:
inb4 pruning: I don't mind if you additionally include info about pruning into the documentation, of course! But the size of the unpruned blockchain should also be documented.
Hello @maltfield, thanks for opening the issue. Just leaving here that we have different faq entries about the size of the blockchain. See https://www.getmonero.org/get-started/faq/#anchor-block-size
Agree would be useful to expand.
I'm trying to figure out how this can be achieved. Per the suggestion on stack exchange, I know that:
curl
For example
user@disp7529:~$ curl -sd '{"jsonrpc":"2.0","id":"0","method":"get_info"}' https://node.monerod.org/json_rpc | grep 'database_size'
"database_size": 53687091200,
user@disp7529:~$
The above database size is 53687091200 bytes = 50 GB.
I know now (only because I just downloaded the whole blockchain) that this is clearly not an unpruned blockchain size.
This begs the question: Is it currently possible to query a node and ask "Is your database pruned?"
If it's not currently possible to determine via the json_rpc endpoint if the given node's DB is pruned, can we please add that feature so that users have a way to iterate though a bunch of nodes until they find one with an unpruned DB to determine the size of the unpruned blockchain size?
@maltfield Saw something like that query bu t it had a syntax error in it. Managed to solved it like this in a script:
x=$(curl -sd '{"jsonrpc":"2.0","id":"0","method":"get_info"}' https://node.monerod.org/json_rpc | grep 'database_size' | sed -e 's/.[^0-9]([0-9]+)[^0-9]$/\1/'); y=$((x/1024/1024/1024)); echo -e "\tCurrent uncompressed Monero block chain is: "$y"GB"
I'll try for myself to improve on it so when I call the script database_size.sh http;//whatever.com:18081/18089 so you are able to just any node to find out the size of the database without having it to change it in the script.
awesome! unfortunately I get a syntax error on that too
user@disp3192:~$ x=$(curl -sd '{"jsonrpc":"2.0","id":"0","method":"get_info"}' https://node.monerod.org/json_rpc | grep 'database_size' | sed -e 's/.[^0-9]([0-9]+)[^0-9]$/\1/');
sed: -e expression #1, char 28: invalid reference \1 on `s' command's RHS
user@disp3192:~$
Looks like it's just sed
because this works fine
user@disp3192:~$ x=$(curl -sd '{"jsonrpc":"2.0","id":"0","method":"get_info"}' https://node.monerod.org/json_rpc | grep 'database_size');
user@disp3192:~$ echo $x
"database_size": 53687091200,
user@disp3192:~$
Actually it my mistake it should have been:
x=$(curl -sd '{"jsonrpc":"2.0","id":"0","method":"get_info"}' http://xmr.coinspace.net:18081/json_rpc | grep database_size | sed -e 's/.[^0-9]([0-9]+)[^0-9]$/\1/'); y=$((x/1024/1024/1024)); echo -e "\tCurrent uncompressed Monero block chain is: "$y"GB"
I used HTTPS instead of HTTP and made an error in sed. Just double chechked and it worked running against various nodes on monero.fail apparantly something weird is going on with copy pasting on github
Still sed errors :(
user@disp14:~$ x=$(curl -sd '{"jsonrpc":"2.0","id":"0","method":"get_info"}' http://xmr.coinspace.net:18081/json_rpc | grep database_size | sed -e 's/.[^0-9]([0-9]+)[^0-9]$/\1/');
sed: -e expression #1, char 28: invalid reference \1 on `s' command's RHS
user@disp14:~$ echo $x
user@disp14:~$
Here's an alternative without sed :)
x=$(curl -sd '{"jsonrpc":"2.0","id":"0","method":"get_info"}' http://xmr.coinspace.net:18081/json_rpc | grep database_size | cut -d: -f2 | grep -o "[0-9]*");
y=$((x/1024/1024/1024));
echo -e "\tCurrent uncompressed Monero block chain is: "$y"GB"
Example run:
user@disp14:~$ x=$(curl -sd '{"jsonrpc":"2.0","id":"0","method":"get_info"}' http://xmr.coinspace.net:18081/json_rpc | grep database_size | cut -d: -f2 | grep -o "[0-9]*");
user@disp14:~$ y=$((x/1024/1024/1024));
user@disp14:~$ echo -e "\tCurrent uncompressed Monero block chain is: "$y"GB"
Current uncompressed Monero block chain is: 280GB
user@disp14:~$
But how do we know that's the actual uncompressed, unpruned monero block chain size and not the pruned size?
@maltfield what's the muzzle on your face for?
I feel like the answers above are a bit overkill. Instead by using jq it's as simple as using this oneliner
echo $((`curl -sd '{"jsonrpc":"2.0","id":"0","method":"get_info"}' http://node.moneroworld.com:18089/json_rpc | jq .result.database_size` / 1024 / 1024 / 1024)) GB
This is much more redable, portable and doesn't pollute the scope with temp variables.
works for me, just requires jq
to be installed.
user@disp9870:~$ cat /etc/issue
Debian GNU/Linux 11 \n \l
user@disp9870:~$
user@disp9870:~$ echo $((`curl -sd '{"jsonrpc":"2.0","id":"0","method":"get_info"}' http://node.moneroworld.com:18089/json_rpc | jq .result.database_size` / 1024 / 1024 / 1024)) GB
bash: jq: command not found
(23) Failed writing body
bash: / 1024 / 1024 / 1024: syntax error: operand expected (error token is "/ 1024 / 1024 / 1024")
user@disp9870:~$
user@disp9870:~$ sudo apt-get install jq
...
user@disp9870:~$
user@disp9870:~$ echo $((`curl -sd '{"jsonrpc":"2.0","id":"0","method":"get_info"}' http://node.moneroworld.com:18089/json_rpc | jq .result.database_size` / 1024 / 1024 / 1024)) GB
155 GB
user@disp9870:~$
Above output in Debian 11.
...but afaict this doesn't solve the question of "how much space do I need if I'm syncing the monero blockchain for the first time" because the output is the compressed blockchain. First sync (before pruning) would be much larger, iirc.
I am not expert so take this with a grain of salt, but due to the nature of the blokchain I do not think it is possible to have a proper "how much space do I need if I'm syncing the monero blockchain for the first time" size. There might be ways to extimate it but querying the database size is probably the closest thing to that we have right now.
Please add some documentation to the website that can help answer the question:
Why
First some facts:
Before a user even begins to sync the blockchain, they should be able to quickly determine if they have enough disk space to store it. And the same page should guide the reader in how to make an educated guess at how long this drive will suffice to hold the blockchain as it grows, and when they can roughly expect to upgrade their disk size. This information should be so easily accessible that even non-technical users can quickly ascertain if their disk is big enough for their needs.
I'm a very technical user, and I found this information to be stiflingly hard to determine. I posted about it on stackexchange, and got some decent information that suggested the blockchain is 90G -- so it should fit on my 128G disk.
It took me 4 weeks to finish syncing the blockchain, and I now know that -- err -- I cannot fit the blockchain onto my 128G disk :facepalm:
IMHO:
Solution
The official monero website should document very clearly for the layman:
IMHO, more important than the website saying "the blockchain is currently XYZ GB large", it should guide the reader how to figure out the current size of the blockchain (obviously without requiring them to download the blockchain first).