Giter VIP home page Giter VIP logo

bitcoind-rest-api's Introduction

Bitcoind Rest API

Request data from Bitcoind through rest api endpoints.

☠️⚠️ Work In Progress ⚠️☠️

Install

Add package to Cargo.toml file

$ cargo install bitcoind-rest-api

Setup:

Must have these environment variable set for the terminal to work. Could go in your .zshrc or .bashrc:

export BITCOIND_PASSWORD="..."
export BITCOIND_USERNAME="..."
export BITCOIND_URL="127.0.0.1:8332"

Start Server

To start server at the default host and port of 127.0.0.1:3030, run:

 $ bitcoind-rest-api

To start server at a specified port, pass the PORT argument

 $ bitcoind-rest-api 3031

Could optionally pass the environment variable to the script:

 BITCOIND_PASSWORD=... BITCOIND_USERNAME=...BITCOIND_URL=... bitcoind-rest-api

Serve over HTTPS

To serve over https, must have the following environment variables set:

IS_TLS_ENABLED=true TLS_CERT_PATH="<CERT_PATH_HERE>" TLS_KEY_PATH="<KEY_PATH_HERE>"

Endpoints

The endpoints used should map directly to rpc commands and parameters, where the command name is the url path and the arguments are query params. If a rpc argument is optional, then the query param is also optional - and same for required arguments. For example, the getchaintxstats command takes two arguments, nblocks and blockhash, so the url path to request the same information would be localhost:3030/api/v1/getchaintxstats?nblocks={...}&blockhash={...}

The following endpoints have been implemented:


getblockcount

GET /api/v1/getblockcount

getblockstats

GET /api/v1/getblockstats?hash_or_height={blockhash or height}

getchaintxstats

GET /api/v1/getchaintxstats?n_blocks={nblocks}&blockhash={blockhash}

getdifficutly

GET /api/v1/getdifficutly

getnetworkhashps

GET /api/v1/getnetworkhashps?n_blocks={nblocks}&height={height}

gettxoutsetinfo

Not: This will take a few seconds (or longer) to return

GET /api/v1/gettxoutsetinfo?hash_type={hash_type}

getblockhash

GET /api/v1/getblockhash?height={height}

getblock

GET /api/v1/getblock?blockhash={blockhash}&verbosity={verbosity}

getblockchaininfo

GET /api/v1/getblockchaininfo

Related

License

MIT © Joe Gesualdo

bitcoind-rest-api's People

Contributors

joegesualdo avatar

Watchers

 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.