The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::Async::Blockchain::Client::RPC::BTC - Async BTC RPC Client.

SYNOPSIS

    my $loop = IO::Async::Loop->new();

    $loop->add(
        my $http_client = Net::Async::Blockchain::Client::RPC::BTC->new(endpoint => 'http://127.0.0.1:8332', timeout => 100, rpc_user => 'test', rpc_password => 'test')
    );

    my $response = $http_client->get_transaction('txid...')->get;

DESCRIPTION

BTC based RPC calls

get_transaction

https://bitcoincore.org/en/doc/24.0.0/rpc/wallet/gettransaction/

  • txid The transaction id

  • include_watchonly default=true for watch-only wallets, otherwise false

  • verbose Whether to include a `decoded` field containing the decoded transaction

Future - detailed information about in-wallet transaction txid

get_raw_transaction

https://bitcoincore.org/en/doc/24.0.0/rpc/rawtransactions/getrawtransaction/

  • txid The transaction id

  • verbose If false, return a string, otherwise return a json object

  • blockhash The block in which to look for the transaction

Future - raw transaction data

get_block

https://bitcoincore.org/en/doc/24.0.0/rpc/wallet/getblock/

  • blockhash the block hash

  • verbosity 0 for hex-encoded data, 1 for a JSON object, 2 for JSON object with transaction data, and 3 for JSON object with transaction data including prevout information for inputs

Future - string based in the verbosity value

validate_address

https://bitcoincore.org/en/doc/24.0.0/rpc/util/validateaddress/

  • address - the bitcoin address to validate

Future - json {isvalid : true|false, ...}

get_last_block

https://bitcoincore.org/en/doc/24.0.0/rpc/blockchain/getblockcount/

Future - The current block count

get_block_hash

https://bitcoincore.org/en/doc/24.0.0/rpc/blockchain/getblockhash/

  • height the height index

Future - string block hash

list_by_addresses

https://bitcoincore.org/en/doc/24.0.0/rpc/wallet/listreceivedbyaddress/

  • address address to return the received transactions

Future - json containing the received transaction details

get_balances

https://bitcoincore.org/en/doc/24.0.0/rpc/wallet/getbalances/

Future - json object with all balances in BTC

get_balance

https://bitcoincore.org/en/doc/24.0.0/rpc/wallet/getbalance/

Future - numeric total amount in the wallet with n number of confirmations

INHERITED METHODS

Net::Async::Blockchain::Client::RPC

configure, endpoint, http_client, max_connections, rpc_password, rpc_user, timeout

IO::Async::Notifier

add_child, adopt_future, adopted_futures, can_event, children, configure_unknown, debug_printf, get_loop, invoke_error, invoke_event, loop, make_event_cb, maybe_invoke_event, maybe_make_event_cb, new, notifier_name, parent, remove_child, remove_from_parent