How to connect bitcore-lib to a running full node-bitcoin

828 Views Asked by At

I want to run full node on my box, and write a program using bitcore-lib using which I can get balance from a given address and also transfer money, using the running full node on my box. I would really appreciate any pointers to achieve it.

1

There are 1 best solutions below

1
On BEST ANSWER

How to connect bitcore-lib to a running full node-bitcoin

Use npm to install bitcore-lib. It should also come with it's own version of bitcoind (unsure if they've switched over to bcoin). If not/you're unsure, you can download and set up your own bitcoind node by cloning the bitcoin repository and follow the docs on setting it up on your machine (OSX, Linux, Windows, etc)

Then, to configure bitcore-lib to connect to your node, you can configure your bitcore-node.json file to look something like this.

{
  "network": "livenet",
  "port": 3001,
  "services": [
    "bitcoind",
    "insight-api",
    "insight-ui",
    "web"
  ],
  "servicesConfig": {
    "bitcoind": {
      "connect": [
        {
                "rpcuser": "bitcoin",
                "rpcpassword": "local321",
                "zmqpubrawtx": "tcp://127.0.0.1:28332"
        }
       ]
    }
  }
}

I want to run full node on my box, and write a program using bitcore-lib using which I can get balance from a given address and also transfer money, using the running full node on my box.

If you're interesting in building applications on top of bitcoin, and you're fine using javascript you should take a look at bcoin(bcoin.io). It's a full node implementation written in node.js and has great tutorials on how to use it's fleshed out api. If you have issues, they also have an open slack team where you can ask the developers for help. bitcore-lib, while a front runner in the past is not as well supported and suffers from a host of issues.