Giter Club home page Giter Club logo

bitcore_rpc's Introduction

BitcoreRPC

PULL REQUESTS WELCOME!

Connect to the Bitcoin RPC or any of its kind (every BTC fork is supported)

Installation

use latest master

gem "bitcore_rpc", github: "krtschmr/bitcore_rpc"

Always develop in testnet! Please! (default is :testnet)

General Usage

If you want, you can create custom classes

class BitcoinRPC < BitcoreRPC; end
class BitcoinCashRPC < BitcoreRPC; end
class DashRPC < BitcoreRPC; end
class LitecoinRPC < BitcoreRPC; end

Usage is super easy!

$bitcoin_rpc = BitcoireRPC.new(user: "test", password: "myPazzwortz")
$litecoin_rpc = LitecoinRPC.new(user: "test", password: "swag", host: "myhost", debug: true)

call any method you want

$bitcoin_rpc.getnewaddress "myaddress", "bech32"

Error handling

if a method isn't know it throws an error

BitcoreRPC::ResponseError: Method not found (-32601)

# if RPC throws error, error will be printed with error code
# if RPC can't be reached, it throws ConnectionError, if wrong auth it gets Unauthenticated

useful stuff

# get_transactions ist alias method for listtransactions and accepts regular parameters

$bitcoin_rpc.get_transactions.each do |tx|
  tx_id = tx["txid"]
  address = tx["address"]
  amount = tx["amount"]
  confirmations = tx["confirmations"]  
  # do something
end

Please fork and contribute

MIT License

bitcore_rpc's People

Contributors

krtschmr avatar

Stargazers

 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.