Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zapnap/bitbank
Easy to use Ruby interface to the Bitcoind JSON-RPC API
https://github.com/zapnap/bitbank
bitcoin bitcoind ruby
Last synced: 2 days ago
JSON representation
Easy to use Ruby interface to the Bitcoind JSON-RPC API
- Host: GitHub
- URL: https://github.com/zapnap/bitbank
- Owner: zapnap
- License: mit
- Created: 2011-06-12T14:30:04.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2013-04-01T01:18:26.000Z (over 11 years ago)
- Last Synced: 2024-10-19T21:39:06.499Z (27 days ago)
- Topics: bitcoin, bitcoind, ruby
- Language: Ruby
- Homepage:
- Size: 160 KB
- Stars: 16
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Bitbank
An easy-to-use Ruby interface for the Bitcoind JSON-RPC API. Work in progress :).
## Getting Started
First, you need to be running bitcoind. Download and install the official client from http://bitcoin.org/
Next, in order for the client to respond to JSON-RPC commands, you need to enable it in the config file. An example of this and a good explanation of the various options can be found at https://en.bitcoin.it/wiki/Running_Bitcoin
Make sure to set the server, rpcuser, and rpcpassword options.
## Connecting
Configure the username and password to match the ones in your bitcoind config. I recommend storing these in a yaml file (see the example config.yml). Once you've done that, you can initialize the client and make requests:
client = Bitbank.new('/path/to/bitbank/config.yml')
## Accounts and Account Balances
You can have a number of different Bitcoin accounts and addresses.
account = client.new_account('named-account')
account = client.account('named-account') # or account_by_address
puts "#{account.name} has bitcoin address #{account.address}"client.accounts.each do |account|
puts "#{account.name}: #{account.balance}"
endOr you can get the current balance for all your accounts:
client.balance
# => 10.05## Transactions
Each account also has a list of transactions (both sent and received).
account.transactions.each do |transaction|
puts "[#{transaction.category}] #{transaction.address} #{transaction.amount}"
endYou can move money between your accounts:
account.move('another-account', 0.5)
And of course you can send payments using the library too:
account.pay('134rUPDEWP8Qp7sShm5bpvmpPtR2mfAeAV', 1.0)
This would send 1 BTC to me. Which would be really awesome, if you'd like to support the continued development of the gem :).
## Contributing to Bitbank
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
* Fork the project
* Start a feature/bugfix branch
* Commit and push until you are happy with your contribution
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.## Copyright
Copyright (c) 2013 Nick Plante. See LICENSE.txt for
further details.