Finance::Bitcoin::Wallet - a bitcoin wallet
use Finance::Bitcoin; my $uri = 'http://user:password@127.0.0.1:8332/'; my $wallet = Finance::Bitcoin::Wallet->new($uri); print "Have: " . $wallet->balance . "\n"; $wallet->pay($destination_address, $amount); print "Now have: " . $wallet->balance . "\n"; foreach my $address ($wallet->addresses) { print $address->label . "\n"; }
This module is part of the high-level API for accessing a running Bitcoin instance.
new($endpoint)
Constructor. $endpoint may be the JSON RPC endpoint URL, or may be a Finance::Bitcoin::API object.
balance
Returns the current balance of the wallet.
pay($dest, $amount)
Pays some bitcoins to an account, causing the balance of the wallet to decrease. $dest may be a Finance::Bitcoin::Address, or an address string.
addresses
Returns a list of receiving addresses - i.e. addresses that can be used by other people to send money to this wallet. Each item on the list is a Finance::Bitcoin::Address object.
This list may be non-exhaustive!
create_address($label)
Creates a new receiving address - i.e. an address that can be used by other people to send money to this wallet. $label is an optional human-friendly name for the address. Returns a Finance::Bitcoin::Address object.
api
Retrieve a reference to the Finance::Bitcoin::API object being used.
Please report any bugs to http://rt.cpan.org/.
Finance::Bitcoin, Finance::Bitcoin::Address.
http://www.bitcoin.org/.
Toby Inkster <tobyink@cpan.org>.
Copyright 2010, 2011, 2013, 2014 Toby Inkster
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
To install Finance::Bitcoin, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Finance::Bitcoin
CPAN shell
perl -MCPAN -e shell install Finance::Bitcoin
For more information on module installation, please visit the detailed CPAN module installation guide.