3

I know how to query the blockchain stored on my machine programmatically using bitcoind commands. Is it possible to do the same on a public node?

For example, is it possible to send “getblockcount” over the internet to bitcoinstats.com, hard-coded in the bitcoin source, or to inductivesoul.us, found in the bitcoin.it wiki? What are the steps to do so?

Edit

The quick answer is:

  • No, you cannot use bitcoind commands.
  • You have to communicate with a remote node using TCP.
  • You have to use a different set of commands found in the Protocol Specification.
4

Excellent question, and welcome to the community!

Short Answer

Maybe.

Long answer

Yes, you can send queries to other nodes on the Bitcoin network. Note that these aren't RPC calls, but Bitcoin's underlying communication protocol. That means that all of the calls will be a little different, and some of them won't exist.

Examples:

  • There's no equivalent to getblockcount in the underlying protocol. Instead, you can connect to a node and listen for its version message, and look at the start_height field.

  • Instead of getrawmempool, you use mempool.

  • Instead of getpeerinfo, you use getaddr.

  • There's no equivalent to stop, because that would be stupid.

Also, if you're trying to query other nodes on the network, one of these libraries will be very helpful:

(If you're not using one of these languages, leave a comment.)

  • Is there an API library for PHP? – rishta Jun 28 '17 at 8:25
  • @rishta Don't think so. Didn't find any while googling. – Nick ODell Jun 28 '17 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.