Author

Topic: Obtain current blockchain height without downloading it? (Read 852 times)

sr. member
Activity: 362
Merit: 262
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.
member
Activity: 112
Merit: 10
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
sr. member
Activity: 362
Merit: 262
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.
member
Activity: 112
Merit: 10
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?
Jump to: