Can you check if a node is pruning?

5

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.

masterq

Posted 2017-10-02T19:40:46.747

Reputation: 177

Related: Does having a pruned node reduce its network score?

Murch 2017-10-03T04:18:31.073

Answers

3

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.

Murch

Posted 2017-10-02T19:40:46.747

Reputation: 41 609

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?Steven Roose 2017-10-03T13:49:31.303

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 2017-10-03T18:05:17.613

1@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 2017-10-03T18:18:38.527

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?Steven Roose 2017-10-10T14:46:40.030

2

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.

cpsola

Posted 2017-10-02T19:40:46.747

Reputation: 1 453

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

iamanyone

Posted 2017-10-02T19:40:46.747

Reputation: 101