Giter Club home page Giter Club logo

bitcoiner's Introduction

Bitcoiner Build Status

Automate your Bitcoin transactions with this Ruby interface to the bitcoind JSON-RPC API. This is a fork of bitcoind Ruby gem.

Super Mario Coin

Installation

Install it from rubygems:

gem install bitcoiner

Or add to a Gemfile:

gem 'bitcoiner'
# gem 'bitcoiner', github: 'NARKOZ/bitcoiner'

Usage

Connecting

Before connecting, you will need to configure a username and password for bitcoind, and start bitcoind. Once that's done:

client = Bitcoiner.new 'username', 'password' # REPLACE WITH YOUR bitcoin.conf rpcuser/rpcpassword
# => #<Bitcoiner::Client "http://username:[email protected]:8332" >

Account Balances

You can get the balance of all addresses controlled by the client:

client.balance
# => 12.34

You can also get a hash of all accounts the client controls:

client.accounts
# => {"Your Address"=>#<Bitcoiner::Account "Your Address" >, "eve-online ransoms"=>#<Bitcoiner::Account "eve-online ransoms" >}

And of course each account has its own balance too:

ransom = client.accounts['eve-online ransoms']
# => #<Bitcoiner::Account "eve-online ransoms" >

ransom.balance
# => 2.19

Transactions

You can get all the transactions in an account:

ransom.transactions
# => [#<Bitcoiner::Transaction abadbabe123deadbeef 2.19 to eve-online ransoms at 2011-02-19 16:21:09 -0500>]

You can send money from an account too:

ransom.send_to 'destinationaddress', 2
# => #<Bitcoiner::Account deadbeef888abadbeef UNCONFIRMED>

Making Accounts

Creating an account with an associated address is done through the accounts interface:

tiny_wings = client.accounts.new 'tiny wings ransoms'
# => #<Bitcoiner::Account "tiny wings ransoms" >

tiny_wings.address
# => "1KV5khnHbbHF2nNQkk7Pe5nPndEj43U27r"

Logging

You may log requests (responses aren't logged) by setting a logger:

logger = Logger.new(STDOUT)
client = Bitcoiner::Client.new('username', 'password', 'http://a.c', {
  logger: logger,
})

License

Released under the MIT license. See LICENSE.txt for details.

bitcoiner's People

Contributors

narkoz avatar ramontayag avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  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.