Bitcoin Forum
October 03, 2024, 07:18:41 PM *
News: Latest Bitcoin Core release: 27.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: New Perl RPC Client module (Bitcoin::RPC::Client)  (Read 657 times)
whinds (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 6


View Profile
January 30, 2017, 09:59:24 PM
Merited by ABCbits (6)
 #1

This module is a Perl implementation of the bitcoin-cli program that ships with Bitcoin Core project.
https://metacpan.org/pod/Bitcoin::RPC::Client
Code:
#!/usr/bin/perl

use Bitcoin::RPC::Client;
 
$btc = Bitcoin::RPC::Client->new(
   user     => "myuser",
   password => "mypasswd",
   host     => "127.0.0.1"
);

$balance  = $btc->getbalance("yourAccountName");
print $balance;

Currently the suggested/popular Perl module is JSON::RPC::Client:
https://en.bitcoin.it/wiki/API_reference_%28JSON-RPC%29
It does work, however JSON::RPC::Client is a bit clunky and doesn't catch errors from bitcoind properly. Here's a couple of threads with people having issues:
https://bitcointalk.org/index.php?topic=208080.0
https://bitcointalk.org/index.php?topic=47369.0

Bitcoin::RPC::Client is really just a wrapper for JSON::RPC::Client, but much cleaner and actually handles errors.
rico666
Legendary
*
Offline Offline

Activity: 1120
Merit: 1037


฿ → ∞


View Profile WWW
February 01, 2017, 11:25:01 AM
 #2

Nice.  Smiley

In

https://metacpan.org/source/WHINDS/Bitcoin-RPC-Client-0.05/lib/Bitcoin/RPC/Client/API.pm

I'd suggest to work with

Code:
our @methods;

push @methods, qw( ... ); # Group X
push @methods, qw( ... ); # Group Y
...

instead of the qq mania (which itself is not correct, as you do not want any interpolating there). But then again - maybe it's autogenerated?



Rico

all non self-referential signatures except mine are lame ... oh wait ...   ·  LBC Thread (News)  ·  Past BURST Activities
whinds (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 6


View Profile
February 06, 2017, 02:10:08 PM
 #3


instead of the qq mania (which itself is not correct, as you do not want any interpolating there). But then again - maybe it's autogenerated?


It was auto generated, but I've been thinking about dropping that stuff completely. It was there to make up for the lack of parsing error messages from bitcoind early on. It's really not needed anymore.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!