Skip to content

🌕 Bitcoin RPC API with basic console commands (Node/Express)

Notifications You must be signed in to change notification settings

ventureum/bitcoin-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bitcoin API using Bitcoin Core, Node.js, and Express

Express API for querying data from your Bitcoin node to build web applications.

Sends HTTP requests to Bitcoin Core node using various RPC commands.

A full tutorial for this API can be found here.

Setup

To use the API first make sure to install Node.js (here) and Bitcoin Core here (here).

Clone this repo and add a .env file at the root level of your project. Replace the bitcoinuser and bitcoinpassword values with those in your Bitcoin configuration file (in Bitcoin Core under Settings > Options > Open Configuration File ).

.env:


RPC_USER=bitcoinuser
RPC_PASSWORD=bitcoinpassword

If they haven't yet been set, add the following entries to your bitcoin.conf and change both files (restarting bitcoin core) :

bitcoin.conf:

rpcuser=bitcoinuser
rpcpassword=bitcoinpassword

Next run

npm install

then

npm run server

to start the server.

View a test endpoint in the browser at 'localhost:4444/api/getblockchaininfo'

Methods used

  • getblockcount
  • getbestblockhash
  • getconnectioncount
  • getdifficulty
  • getblockchaininfo
  • getmininginfo
  • getpeerinfo
  • getrawmempool
  • getblockhash
  • getblock
  • getrawtransaction
  • decoderawtransaction

About

🌕 Bitcoin RPC API with basic console commands (Node/Express)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%