Building a small block explorer for fun, stuck with node

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!

Luuk Kenselaar

Posted 2018-07-20T10:10:54.657

Reputation: 3

Search for RPC protocol that gives you an interface for the data on the node once it's running.JBaczuk 2018-07-20T15:03:48.530

Thats the problem, i cant get the node configured.Luuk Kenselaar 2018-07-20T17:22:16.123

Got it, let me know if that answer helps.JBaczuk 2018-07-20T17:35:35.880

Answers

1

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

JBaczuk

Posted 2018-07-20T10:10:54.657

Reputation: 6 172

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 2018-07-21T11:09:42.080

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 2018-07-21T14:44:24.450