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,170 points
162 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,550 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 20, 2018 in Blockchain by Perry
• 17,020 points
41 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,020 points
94 views
0 votes
1 answer

How to send Bitcoins with node.js?

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

answered Jul 20, 2018 in Blockchain by Christine
• 15,790 points
467 views
0 votes
1 answer

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

yes all are over TCP/IP connections secured by TLS encryption in hashgraph architecture-hashgraph, ...READ MORE

answered Aug 6, 2018 in Blockchain by ariaholic
• 7,340 points
92 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
172 views
0 votes
1 answer
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,550 points
223 views