Simple Crystal library for Bitcoin's RPC API.
All calls get proxied by a method_missing
macro, so they have exactly the same names and arguments as specified in the official documentation.
Add this to your application's shard.yml
:
dependencies:
bitcoin_rpc:
github: citizen428/bitcoin_rpc
Usage is very simple:
require "bitcoin_rpc"
# Testnet example
rpc = BitcoinRpc.new("http://localhost:18332", "username", "password")
rpc.getblockhash(0)
# or
rpc.get_block_hash(0)
#=> "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"
rpc.getblockcount
#or
rpc.get_block_count
#=> 486259
rpc.listaccounts
# or
rpc.list_accounts
#=> {"" => 0.0}
- Fix crystal requirement
- change crystal version requirement to *
- Include JSON body when raising on unseccessfull RPC request
- Fix error raising logic
- Raise error if none Success HTTP status code
- Now raising with actual error message
- Close HTTP Client, causing issues when called with higher rate
- BitcoinRpc is finally thread safe (was unaware that client.post wasn't concurrrent)
- Fork it ( https://github.com/citizen428/bitcoin_rpc/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
- citizen428 Michael Kohl - creator, maintainer