Skip to content

codeincrypt/bitcoin-rpc-nodejs-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Configuring Login Information

In order to use the Bitcoin RPC API, a username and password are required in the Bitcoin Core configuration file. This will allow us to connect with the node remotely using HTTP. You can add these values to the bitcoin.conf file by selecting

inside of Bitcoin Core, which will open a text file. Add the following lines to this file:

  rpcuser=bitcoinuser
  rpcpassword=bitcoinpassword

Using packages

Next we can install the additional javascript packages we’ll be using. Packages (or dependencies) are 3rd party javascript code we will utilize in our application. Install the needed dependencies with the following two commands

Dependencies:

npm install dotenv express request
  • dotenv - reads our bitcoin login info from the .env file
  • express - our routing framework, lets us specify method endpoints
  • request - allows us to send HTTP requests to the bitcoin client

Project Setup

Once you have bitcoin installed and synced, create a folder for your application and navigate to it

  git clone https://github.com/codeincrypt/bitcoin-rpc-nodejs-api
  cd bitcoin-rpc-nodejs-api

Start the application by entering the command:

npm run server

If the server has started correctly, in your console you should see

Server running on port 8000

Now open your browser and navigate to:

http://localhost:8000/api/getbalance

About

Bitcoin RPC API migration with Node Js Rest API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published