I have this code:

from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
import logging
rpc_user='-------' #User name is hidden
rpc_password='-------' #Password hidden
rpc_connection = AuthServiceProxy("http://%s:%[email protected]:8332"%(rpc_user, rpc_password))

The result:

DEBUG:BitcoinRPC:-1-> getblockcount []
DEBUG:BitcoinRPC:<-1- 94768

Of course this is last block in my device, but I want the real last block.

Is there a "external server or a Web site" i can call instead of Local server ''? (for sending the bitcoin RBC method)

3 Answers 3


Instead of getblockcount, you can call getblockchaininfo and read the headers field.

However, while this may give you a lot more blocks than the local block count, you will still only receive a count up to the point where your node has synced headers (which can be limited by time, network, how well synced your peers are)

There is no way to always get the latest block height reliably from an unsynced node.

  • One could additionally check the timestamp in order to at least know whether this is a recent block.
    – Murch
    Jul 1, 2018 at 22:07

You would have to try to connect live nodes to get that information.


Lists active nodes of BTC network.

You should find some node which allows RPC connection on the port.


Of course this is last block in my device, but I want the real last block.

There is no such thing. If there was a "real last block" that was clearly and unambiguously determinable, we would not need a blockchain.

The best you can do is run a node, and ask the node what's the best block it knows about. Or you can trust someone to run such a node and ask them.

Perhaps another way of seeing it: there is no distinction between a synced or unsynced node. Your node is always trying to synchronize with whatever other nodes in the network tell it. It can't know what the actual latest/best block on the network is, as at the very least the speed of light around the globe is limited.

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.