Bitcoin Forum
April 26, 2024, 09:23:23 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: What is the format for createrawtransaction() parameters using jsonRPCClient.php  (Read 6856 times)
querior (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 2


View Profile
December 29, 2012, 03:36:19 AM
Merited by ABCbits (2)
 #1

Hi,

I've been playing with the rpc interface, and using the php library successfully up until now. I'm trying to create a raw transaction.

The satoshi client debug console 'help' describes the command:
Code:
createrawtransaction [{"txid":txid,"vout":n},...] {address:amount,...}

But I'm not clear on how that should translate here. So, for example, the following command (without the carriage returns) works fine in my satoshi client debug console:

Code:
createrawtransaction [{\"txid\":\"aed23bb3ec7e93d69450d7e5ea49d52fcfbef9d380108f2be8fe14ef705fcea5\",
\"vout\":2},
{\"txid\":\"b28c740c66726ab2f0397be29f2d25f091b8ab353b98b9ebf9e6ccfd080cdf49\",
\"vout\":3}]
{\"1GTDT3hYk4x4wzaa9k38pRsHy9SPJ7qPzT\":0.006,
\"1ApD64wpNUM6GBeSmKYhsyaNwFot3FMC5y\":0.004}

It generates a raw transaction without problem.

My question is how to pass these parameters via the jsonRPCClient interface.

Code:
$bitcoin = new jsonRPCClient('http://user:pwd@127.0.0.1:8332/');

echo $bitcoin->createrawtransaction( ??? );


Thanks in advance.
1714166603
Hero Member
*
Offline Offline

Posts: 1714166603

View Profile Personal Message (Offline)

Ignore
1714166603
Reply with quote  #2

1714166603
Report to moderator
1714166603
Hero Member
*
Offline Offline

Posts: 1714166603

View Profile Personal Message (Offline)

Ignore
1714166603
Reply with quote  #2

1714166603
Report to moderator
1714166603
Hero Member
*
Offline Offline

Posts: 1714166603

View Profile Personal Message (Offline)

Ignore
1714166603
Reply with quote  #2

1714166603
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1024



View Profile
December 30, 2012, 06:12:39 AM
Merited by ABCbits (2)
 #2

They are arrays.  The first one is an array of arrays, the second is not nested.

Code: (php)
$bitcoin->createrawtransaction(
    array(
        array(
            "txid"=>"aed23bb3ec7e93d69450d7e5ea49d52fcfbef9d380108f2be8fe14ef705fcea5",
            "vout"=>2
        ),
        array(
            "txid"=>"b28c740c66726ab2f0397be29f2d25f091b8ab353b98b9ebf9e6ccfd080cdf49",
            "vout"=>3
        ),
    ),
    array(
        "1GTDT3hYk4x4wzaa9k38pRsHy9SPJ7qPzT"=>0.006,
        "1ApD64wpNUM6GBeSmKYhsyaNwFot3FMC5y"=>0.004,
    )
);

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
querior (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 2


View Profile
December 30, 2012, 10:35:15 PM
 #3

You, sir, are a gentleman and a scholar.

Thank you very much.
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!