Bitcoin Forum
May 11, 2024, 01:04:49 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Obtain current blockchain height without downloading it?  (Read 837 times)
Mivexil (OP)
Member
**
Offline Offline

Activity: 112
Merit: 10


View Profile
January 13, 2014, 04:12:34 AM
 #1

As stated - can you run bitcoind (and, more importantly, other coins' daemons - so Blockchain API is out of the question) and query the peers for blockchain height and difficulty without actually downloading the whole blockchain? Or would you need to create a custom daemon for that?
1715389489
Hero Member
*
Offline Offline

Posts: 1715389489

View Profile Personal Message (Offline)

Ignore
1715389489
Reply with quote  #2

1715389489
Report to moderator
"The nature of Bitcoin is such that once version 0.1 was released, the core design was set in stone for the rest of its lifetime." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715389489
Hero Member
*
Offline Offline

Posts: 1715389489

View Profile Personal Message (Offline)

Ignore
1715389489
Reply with quote  #2

1715389489
Report to moderator
spin
Sr. Member
****
Offline Offline

Activity: 362
Merit: 261


View Profile
January 13, 2014, 07:28:04 AM
 #2

I think the node knows all of it's peers blockheights so when you start a node and it starts connecting to peers it will know the block height of all it's peers and you'd be able to query that with getpeerinfo.  It would however be busy updating itself.  You won't have to wait until it's done though.

If you liked this post buy me a beer.  Beers are quite cheap where I live!
bc1q707guwp9pc73r08jw23lvecpywtazjjk399daa
Mivexil (OP)
Member
**
Offline Offline

Activity: 112
Merit: 10


View Profile
January 13, 2014, 12:31:30 PM
 #3

I think the node knows all of it's peers blockheights so when you start a node and it starts connecting to peers it will know the block height of all it's peers and you'd be able to query that with getpeerinfo.  It would however be busy updating itself.  You won't have to wait until it's done though.

Well, the point is that I don't want to store the whole hundreds-of-megabytes blockchain. So I'd need to periodically delete the file?

And since getpeerinfo gives me the starting height (which, I assume, is the height at the time of connection), I'd need to de- and reconnect the wallet periodically too? Not a very good idea for my application Sad
spin
Sr. Member
****
Offline Offline

Activity: 362
Merit: 261


View Profile
January 14, 2014, 08:32:48 AM
Last edit: January 14, 2014, 08:49:47 AM by spin
 #4

I guess you have couple of options:
- Adjust the code to find out only blockheights of other nodes.
- Run a full node elsewhere and make the blockheight available via rpc or otherwise to the app you are writing.
- Look at bitcoinj which may do what you want to do as it does a limited abmount of syncing.  It implements "simplified payment verification" (SPV).  In your case it would be even more simple as it would never need to match any actual transactions.

If you liked this post buy me a beer.  Beers are quite cheap where I live!
bc1q707guwp9pc73r08jw23lvecpywtazjjk399daa
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!