Bitcoin Forum
October 21, 2019, 09:48:22 PM *
News: 10th anniversary art contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Get hash of oldest stored block (Core pruned mode)?  (Read 65 times)
jnano
Member
**
Offline Offline

Activity: 287
Merit: 53


View Profile
June 10, 2018, 04:10:20 PM
 #1

With Core in pruned mode, is there a command to get the hash of the oldest stored block?




Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1571694502
Hero Member
*
Offline Offline

Posts: 1571694502

View Profile Personal Message (Offline)

Ignore
1571694502
Reply with quote  #2

1571694502
Report to moderator
1571694502
Hero Member
*
Offline Offline

Posts: 1571694502

View Profile Personal Message (Offline)

Ignore
1571694502
Reply with quote  #2

1571694502
Report to moderator
cellard
Legendary
*
Offline Offline

Activity: 1372
Merit: 1211


View Profile
June 10, 2018, 05:48:17 PM
 #2

With Core in pruned mode, is there a command to get the hash of the oldest stored block?






I don't think so. It would be an interesting command to have. If there isn't, and until then, you can manually check it by subtracting N from current last block height, N being the number that you entered in the "prune=N" setting in your bitcoin.conf

So do:

getblockcount

This will give you the latest block you have. For instance for me right now is 526788, so let's say your prune N value is 550

526788-550=526238

getblockhash 526238

And there you go. If you try to get the hash of a block that is behind N you should get an error, something like "block not available (pruned data)".

A cvar that automates these steps could be added I guess.
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 1918
Merit: 2862


bc1qshxkrpe4arppq89fpzm6c0tpdvx5cfkve2c8kl


View Profile WWW
June 10, 2018, 07:58:30 PM
Merited by Foxpup (2)
 #3

getblockchaininfo will tell you the height of the oldest stored complete block. You can then look up its hash using getblockhash.

jnano
Member
**
Offline Offline

Activity: 287
Merit: 53


View Profile
June 10, 2018, 08:29:53 PM
Last edit: June 10, 2018, 08:49:34 PM by jnano
 #4

Thanks.

getblockchaininfo's pruneheight property is indeed it.

cellard, that subtraction assumes each block is exactly 1MB, and that pruning keeps exactly the prune target in raw block data.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!