Code Monkey home page Code Monkey logo

bitcoin-api's Introduction

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

bitcoin-api's People

Contributors

peterdurham avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.