1

I have to to use bitcoin api using nodejs. but I cannot understand from where I have to start.Search some node module like bitcoin-core and bitcoin.

Can anyone describe the step how can I set up bitcoin in our system and use using nodejs. Also refer some link where use of bitcoin api request and response parameter are describe in nodejs.

I have to use bitcoin json-rpc api's with node.js but dont know from where i can start?

1
  • 3
    As it is written, this question doesn't make a lot of sense. You seem to need to do something with Bitcion, but haven't specified what that is. Without that information, nobody can help you.
    – Jestin
    Aug 31, 2017 at 19:06

3 Answers 3

2

I m using bitcore for stand alone rpc because it has many new indexes and new methods.

See this link https://bitcore.io/guides/bitcoin

1

First and foremost, install bitcoin-core. I recommend compiling it yourself but there are binaries available for download. You'll want to perform all the steps in this tutorial - follow all steps for the daemon. Do not do the graphical user interface steps. https://bitcoin.org/en/full-node#ubuntu-1610

Run the daemon and use bitcoin-cli to familiarize yourself with the Bitcoin RPC API. https://bitcoin.org/en/full-node#other-linux-distributions

Start the daemon, such that it creates the right folders. bitcoind -daemon Stop it after a few seconds. bitcoin-cli stop

You should see a new folder .bitcoind in your HOME directory. (Or AppData if you're on Windows). You'll need to add this file into it as 'bitcoin.conf':

rpcuser=YOURUSERNAME

rpcpassword=YOURPASSWORD

Replace YOURUSERNAME with a username of your choice, same for the password. Remember these as you'll need it for configuring your NodeJS app.

bitcoind -daemon

Get the balance: bitcoin-cli -rpcuser=YOURUSERNAME -rpcpassword=YOURPASSWORD getbalance

Pick a nice Bitcoin Core JSON-RPC Node module, like this one: https://www.npmjs.com/package/node-bitcoin-rpc ^Also has the get balance example.

They use the same commands that you enter in the bitcoin-cli.

0

Yet another way to proceed is to make your own client.

Here is mine on PHP. Even if you do not know PHP, you can see how easy is to create one from scratch:

JSONRPC:
https://github.com/nmmmnu/BlockchainWalker/blob/master/jsonrpc.php

Selected Bitcoind commands I need:
https://github.com/nmmmnu/BlockchainWalker/blob/master/bitcoindrpc.php

update:

In case you do own client, make sure you handle first transaction

"4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"

in special code, because bitcoind can not handle it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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