Continuum::BitcoinRPC has been discontinued and kept here for historical reasons
Continuum::BitcoinRPC - Asynchronous BitcoinRPC client
Continuum::BitcoinRPC is a client that interfaces the RPC commands of the Satoshi bitcoin implementation (Satoshi Node). It is built on top of the Continuum framework to provide a powerful asynchronous API. Continuum::BitcoinRPC is meant to run within an event loop environment such as Mojolicious or AnyEvent.
Usage is quite simple:
use Continuum::BitcoinRPC;
# Set your RPC username/password in ~/.bitcoin/bitcoin.conf
my $client = Continuum::BitcoinRPC->new(
url => 'http://127.0.0.1:18332',
username => 'rpc_username',
password => 'rpc_password',
);
# Blocking call
my $balance = $client->get_balance->recv;
# Non-blocking call
$client->get_balance->then( sub {
my $balance = shift;
});
# Underscores and case are ignored. These are equivalent:
$client->get_balance;
$client->getbalance;
$client->getBalance;
$client->GetBalance;
This should get you started quite easily. Note that the library doesn't check the validity of your commands (yet). So if you're calling
$client->hoobahoop
You're essentially trying to call the hoobahoop method through the JSON RPC interface on bitcoind, which will fail.
You get access to the Continuum API for free using this module. Every call to Continuum::BitcoinRPC returns a Portal, so you can write this:
use Continuum;
$client->GetBalance( 'fred' )
->merge( $client->GetAccountAddress( 'fred' ) )
->then( sub {
my ( $balance, $account ) = @_;
...
});
GetBalance and GetAccountAddress are computed in parallel. Once both
of them are completed, the callback in then
is called with the
values.
Please head to the Continuum project page for more details.
Please report any bugs in the projects bug tracker:
http://github.com/plaprade/Continuum-BitcoinRPC/issues
You can also submit a patch.
We're glad you want to contribute! It's simple:
- Fork Continuum::BitcoinRPC
- Create a branch
git checkout -b my_branch
- Commit your changes
git commit -am 'comments'
- Push the branch
git push origin my_branch
- Open a pull request
These are the modules on which this one depends:
- My fork of AnyEvent::JSONRPC
- Continuum
- Moose
- namespace::autoclean
- EV (for testing)
- Test::Bitcoin::Daemon (for testing)
In order to run tests, bitcoind must be available in the application search path.