Skip to content
This repository has been archived by the owner on Sep 10, 2018. It is now read-only.

plaprade/Continuum-BitcoinRPC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Continuum::BitcoinRPC has been discontinued and kept here for historical reasons

NAME

Continuum::BitcoinRPC - Asynchronous BitcoinRPC client

DESCRIPTION

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.

Continuum

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.

Bugs

Please report any bugs in the projects bug tracker:

http://github.com/plaprade/Continuum-BitcoinRPC/issues

You can also submit a patch.

Contributing

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

Installing

These are the modules on which this one depends:

In order to run tests, bitcoind must be available in the application search path.

About

Asynchronous JSON RPC interface to the Satoshi bitcoin client

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages