Using Bitcoin s sendmany function with perl

0 votes

I am trying to use bitcoin's 'sendmany' function (https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list) to send mass payment with a perl script. I am running bitcoind on a vps and other functions are working fine but sendmany isn't. This is the code that I have :

use Finance::Bitcoin::API;
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
use Data::Dumper;
my %recipients = ("ADDRESS1" => sprintf("%.8f",0.00005460)+0, "ADDRESS2" => sprintf("%.8f",0.00005460)+0);
my $uri     = "https://$rpcuser:$rpcpass\@$rpcip:8332/";
my $api     = Finance::Bitcoin::API->new( endpoint => $uri );
my $action  = $api->call('sendmany','',%recipients);
if ($api->error)
{
    print Dumper($api->error->{message})."\n";
}
else
{
    print Dumper($action)."\n";
}

I am able to send single payments using the 'sendtoaddress' function and I am able to use the sendmany function directly in the vps that is running bitcoind by executing it from the shell, but it fails when I try it using the perl script above. There is no error message, I just get the instructions for using sendmany from shell and using curl. Can someone tell me what I am doing wrong?

Sep 11, 2018 in Blockchain by slayer
• 29,350 points
1,125 views

1 answer to this question.

0 votes

Replace the line 

my $action = $api->call('sendmany','',%recipients); 

with 

my $action = $api->call('sendmany','',\%recipients);

Basically just add a forward slash before %recipients. This should work.

answered Sep 11, 2018 by digger
• 26,740 points

Related Questions In Blockchain

0 votes
1 answer

Is it that new bitcoins gets created with the every block mined??

Bitcoin mining means validation of a block ...READ MORE

answered Apr 21, 2018 in Blockchain by Perry
• 17,100 points
557 views
0 votes
1 answer

Can I swap an ERC-20 token with a Neo NEP5 token using a smart contract?

Every Blockchain has a separate administration. So, it ...READ MORE

answered Jun 4, 2018 in Blockchain by Perry
• 17,100 points
695 views
0 votes
1 answer

How to send Bitcoins with node.js?

This website https://blockr.io/tx/push will successfully do the ...READ MORE

answered Jul 20, 2018 in Blockchain by Christine
• 15,790 points
3,128 views
+1 vote
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,450 points
1,129 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,663 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,215 views
0 votes
1 answer

How to interact with blockchain using Java web app?

You can interact with the blockchain using ...READ MORE

answered Jul 16, 2018 in Blockchain by digger
• 26,740 points
907 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP