Is it possible to check if a specific node is running the full blockchain or a pruned one?
Also if you can, is it possible to check exactly how many (or roughly) how many blocks they are distributing.
Is it possible to check if a specific node is running the full blockchain or a pruned one?
Also if you can, is it possible to check exactly how many (or roughly) how many blocks they are distributing.
Bitcoin nodes advertise their services with the nServices
bitmap. The first bit is NODE_NETWORK
which indicates whether a node will be able to serve all blocks to other network participants.
Pruning nodes do not signal NODE_NETWORK
, because they do not have a complete copy of the blockchain. They will however return any requested blocks they have in storage. As the minimum pruning size is 550 MB, they will be able to serve at least the last three days worth of blocks.
NODE_NETWORK
but refusing to send blocks you don't have?
Commented
Oct 3, 2017 at 13:49
NODE_NETWORK
service flag.
NODE_NETWORK
set in order not to get banned when you don't have them. Does a node with NODE_NETWORK
get banned when he is unable to provide a block?
Commented
Oct 10, 2017 at 14:46
If you can connect to the node via RPC, you can issue a getblockchaininfo
command to the node, that will tell you whether the node is pruned ("pruned": True/False
) and the height at which the chain is pruned ("pruneheight": X
).
The command will also show the current height of the chain ("blocks": X
), so you can compute the actual number of stored blocks by substracting pruneheight from current heigh.
Just as an example, this is the output of getblockchaininfo for a pruned node on the testnet:
{
"chain": "test",
"blocks": 1261324,
"headers": 1261324,
"bestblockhash": "000000000000075568c48c5bd77bdbe2a11eaa3416ad1ec066f290158d862259",
"difficulty": 2108481.043832448,
"mediantime": 1517322442,
"verificationprogress": 0.9999987734618496,
"chainwork": "000000000000000000000000000000000000000000000035070d21569475cdd3",
"pruned": true,
...
"pruneheight": 1225344
}
So the node is storing 1261324 - 1225344 = 35980 complete blocks.
Try:
du -h $HOME/.bitcoin/blocks/
That will display the size of the blockchain your client has downloaded. If your pruned, it shouldn't go above the size you set in bitcoin.conf