I'm running a full node on my PC and wondering if there is a way to query the blockchain locally via NodeJS instead of going through blockchain.info? It is very inefficient/slow to run queries through HTTP when I have all the data local.
1 Answer
If you want to query your full node, you should use the JSON-RPC API. Note that by default, you'll only be able to get blocks, and transactions from your own full node wallet. If you want to be able to query any transactions, you have to add txindex=1
to your configuration file. And compared to using blockchain.info, you won't be able to query balances of addresses.
-
That is helpful, thank you. So I assume blockchain.info is aggregating info about the blockchain. I hate being dependent on a third-party centralized source, I will take a close look at the JSON RPC API. Thanks again.– CorbinMar 3, 2018 at 14:47