6

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.

1

3 Answers 3

4

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.

5
  • 1
    Is there a way for a node to serve blocks up to a certain height? Like the last 1000 blocks, f.e.? Other than just signaling NODE_NETWORK but refusing to send blocks you don't have? Commented Oct 3, 2017 at 13:49
  • 1
    @StevenRoose: As far as I know, pruning nodes will never serve blocks currently. There was something in the works to make them serve the ones they have, but as far as I'm aware, that's not done yet.
    – Murch
    Commented Oct 3, 2017 at 18:05
  • 2
    @StevenRoose: I've doublechecked. Pieter says that they would serve the blocks they have, they just don't usually get asked for blocks because they do not set the NODE_NETWORK service flag.
    – Murch
    Commented Oct 3, 2017 at 18:18
  • That makes sense. So there is just no "obligation" to send them if you have 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
  • I'm not sure. I would guess that it would at least cause the requesting node's peer score for the node to suffer, but I don't know whether it would cause an outright drop.
    – Murch
    Commented Oct 8, 2020 at 21:53
3

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.

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.