0

Im trying to build a small btc block explorer for fun. The problem where i am stuck is that im trying to setup a node. I got a Ubuntu VPS running and i have bitcoind installed, but what now? Can someone help me with this? I have read that you need to run the node in txindex mode or something.

Thanks in advance!

  • Search for RPC protocol that gives you an interface for the data on the node once it's running. – JBaczuk Jul 20 '18 at 15:03
  • Thats the problem, i cant get the node configured. – Luuk Kenselaar Jul 20 '18 at 17:22
  • Got it, let me know if that answer helps. – JBaczuk Jul 20 '18 at 17:35
0

You want to use the RPC Protocol to get blockchain info. RPC is usually disabled by default, so you need to enable it. You can do this in the bitcoin.conf file in .bitcoin folder where you've installed the daemon. Alternatively, you can run the daemon with the -server flag, see command line arguments. Now, you will also need to set RPC authentication in the conf file as well. The -txindex flag will allow you to search for any tx by hash using getrawtransaction command, which may be useful depending on how you utilizar the RPC protocol.

Example bitcoin.conf

The line to add is:

server=1

How to use:

RPC documentation

  • Huge thanks! Is it also possible to retrieve an accounts balance using bitcoin-cli? And data about blocks such as timestamp, amount of transactions and total block value (in btc). – Luuk Kenselaar Jul 21 '18 at 11:09
  • getbalance only retrieves balance for addresses you own. I think you have to query all transactions for an address and sum them up. You probably have to do the same for total block value, have a look at the RPC docs in the link above for all possible commands. – JBaczuk Jul 21 '18 at 14:44

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.