Bitcoin Forum

Bitcoin => Project Development => Topic started by: SgtSpike on June 30, 2011, 07:46:19 AM



Title: [1 BTC BOUNTY] A way to use sendmany
Post by: SgtSpike on June 30, 2011, 07:46:19 AM
I just want to send BTC to a list of addresses I have.  Really, it's a simple request, and I thought it would have a simple answer, but I can find no simple answer.

bitcoin-php does not have the sendmany function in its library, and I have been unable to successfully add it.  I just don't know enough about json formatting and how to go back and forth between the two.

So, I will pay 1 BTC for a script, preferably in php, but acceptable in python or curl as well, that will allow me to quickly and easily send BTC to a list of addresses and amounts.


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: jav on June 30, 2011, 08:36:49 AM
Here is a solution in Python: I usually use the excellent Bitcoin Python Library "authproxy.py" by Jeff Garzik. Here is a version with a few improvements I added: http://pastebin.com/RZNMCGRe . Save this as authproxy.py .

Then you can use this code to use sendmany:

Code:
from authproxy import AuthServiceProxy, JSONRPCException

RPC_URL = "http://rpcuser:rpcpassword@127.0.0.1:8332"

bitcoind = AuthServiceProxy(RPC_URL)

try:
    recipients = { '14Z1mazY4HfysZyMaKudFr63EwHqQT2njz': 50.0
                 , '147dRpRoYQxpf5WGnz7dipCcavtANRRfjt': 50.0
                 }
    bitcoind.sendmany("", recipients)
except JSONRPCException as e:
    print "Error: %s" % e.error['message']

You can try out the above code on an empty wallet. You should get an "account has insufficient funds" error.

If this code is to your satisfaction, I humbly request the bounty to go to this address: 1fYHRKUXnFfj7ZhjwMMNqddjcnkGtq4wA . :-)


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: codler on June 30, 2011, 12:27:18 PM
Isn't it just do like this?

Code:
require_once 'jsonRPCClient.php';
$bitcoin = new jsonRPCClient('http://user:password@127.0.0.1:8332/');
$fromAccount = "";
// {address:amount,...}
$sendTo = array(
  '1NRo5XtmfDWfwiN2fY9A7kj9rs1rx3jJok' => 1,
  '19u9uMbEdCRTyrLszCEiJCAzNJURUTaS4T' => 1,
);

echo "<pre>\n";
echo "txid: ".$bitcoin->sendmany($fromAccount, $sendTo)."\n";
echo "</pre>";


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: SgtSpike on June 30, 2011, 03:44:54 PM
Thanks jav.  I can't give that a try right at the moment (will have to wait about 12 hours before I get home and can try it), but hopefully that will work.  If it does, I'll send you your 1 BTC.

Codler, I wish, but there is no sendmany function built in to bitcoin-php.  The project was abandoned a couple of months back because the dev didn't have time to update it, and that was before sendmany was built in as an rpc command.

Unless, you have some php files I don't have...  in which case, let me know where you got them!


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: codler on June 30, 2011, 04:02:29 PM
Thanks jav.  I can't give that a try right at the moment (will have to wait about 12 hours before I get home and can try it), but hopefully that will work.  If it does, I'll send you your 1 BTC.

Codler, I wish, but there is no sendmany function built in to bitcoin-php.  The project was abandoned a couple of months back because the dev didn't have time to update it, and that was before sendmany was built in as an rpc command.

Unless, you have some php files I don't have...  in which case, let me know where you got them!

I don't know what bitcoin-php is. Could you link bitcoin-php? Maybe I can implement it.


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: SgtSpike on June 30, 2011, 04:16:49 PM
Thanks jav.  I can't give that a try right at the moment (will have to wait about 12 hours before I get home and can try it), but hopefully that will work.  If it does, I'll send you your 1 BTC.

Codler, I wish, but there is no sendmany function built in to bitcoin-php.  The project was abandoned a couple of months back because the dev didn't have time to update it, and that was before sendmany was built in as an rpc command.

Unless, you have some php files I don't have...  in which case, let me know where you got them!

I don't know what bitcoin-php is. Could you link bitcoin-php? Maybe I can implement it.
Sure thing:  http://www.nostate.com/3962/bitcoin-php-a-php-library-for-bitcoin/


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: error on June 30, 2011, 05:14:14 PM
Thanks jav.  I can't give that a try right at the moment (will have to wait about 12 hours before I get home and can try it), but hopefully that will work.  If it does, I'll send you your 1 BTC.

Codler, I wish, but there is no sendmany function built in to bitcoin-php.  The project was abandoned a couple of months back because the dev didn't have time to update it, and that was before sendmany was built in as an rpc command.

Unless, you have some php files I don't have...  in which case, let me know where you got them!

He's just using jsonRPCclient directly, which should work.


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: SgtSpike on June 30, 2011, 05:37:27 PM
Thanks jav.  I can't give that a try right at the moment (will have to wait about 12 hours before I get home and can try it), but hopefully that will work.  If it does, I'll send you your 1 BTC.

Codler, I wish, but there is no sendmany function built in to bitcoin-php.  The project was abandoned a couple of months back because the dev didn't have time to update it, and that was before sendmany was built in as an rpc command.

Unless, you have some php files I don't have...  in which case, let me know where you got them!

He's just using jsonRPCclient directly, which should work.
Sheesh, is it really that simple?  Well I hope to try it soon.  That would be great if it worked that cleanly.

Does anyone know if there is a practical maximum to the number of addresses I can put in a sendmany request?  I've read a couple of posts about bitcoind locking up around 30 addresses or so, but I'm not sure if that was just an initial bug, or if it still exists and I shouldn't try to send to more than that at the same time.


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: codler on June 30, 2011, 05:49:06 PM
Add this method in BitcoinClient class, I haven't tested but it should be like this.

Code:
  /**
   * Returns Transaction id (txid)
   *
   * @param string $fromAccount Account to send from
   * @param array $sendTo Key=address Value=amount
   * @param integer $minconf
   * @param string $comment
   * @return string Hexadecimal transaction ID on success.
   * @throws BitcoinClientException
   * @since 0.3.21
   * @author codler<github>
   */
  public function sendmany($fromAccount, $sendTo, $minconf = 1, $comment=NULL) {
    if (!$fromAccount || empty($fromAccount))
      throw new BitcoinClientException("sendmany requires an account");
    if (!is_numeric($minconf) || $minconf < 0)
      throw new BitcoinClientException('sendmany requires a numeric minconf >= 0');
 
    if (!$comment)
      return $this->query("sendmany", $fromAccount, $sendTo, $minconf);
    return $this->query("sendmany", $fromAccount, $sendTo, $minconf, $comment);
  }


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: SgtSpike on June 30, 2011, 05:51:11 PM
Provided codler's or jav's solution works for me, the bounty has been claimed.  If they both work, I will pay them each half of the bounty, since they are both good solutions.


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: SgtSpike on July 01, 2011, 05:26:39 AM
Here is a solution in Python: I usually use the excellent Bitcoin Python Library "authproxy.py" by Jeff Garzik. Here is a version with a few improvements I added: http://pastebin.com/RZNMCGRe . Save this as authproxy.py .

Then you can use this code to use sendmany:

Code:
from authproxy import AuthServiceProxy, JSONRPCException

RPC_URL = "http://rpcuser:rpcpassword@127.0.0.1:8332"

bitcoind = AuthServiceProxy(RPC_URL)

try:
    recipients = { '14Z1mazY4HfysZyMaKudFr63EwHqQT2njz': 50.0
                 , '147dRpRoYQxpf5WGnz7dipCcavtANRRfjt': 50.0
                 }
    bitcoind.sendmany("", recipients)
except JSONRPCException as e:
    print "Error: %s" % e.error['message']

You can try out the above code on an empty wallet. You should get an "account has insufficient funds" error.

If this code is to your satisfaction, I humbly request the bounty to go to this address: 1fYHRKUXnFfj7ZhjwMMNqddjcnkGtq4wA . :-)

Ok, you'll have to forgive me, because I know very little about python except for how to open one from the command line.  :P  What do I do with the library file?


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: SgtSpike on July 01, 2011, 05:49:47 AM
Codler, your first example worked perfectly, thank you!  Well, I haven't yet confirmed the receipt of the coins, but it gave me a transaction ID in return, so I am assuming it worked.

The integration with bitcoin-php failed though - below are the errors.  I'll go ahead and send you your half of the reward since the first solution works, but I would love to have it working and integrated with the existing bitcoin-php package, since that's what my site is built around.  So, if you don't mind, take a look at the errors and let me know what you see.

If jav replies in a reasonable amount of time with a quick how-to on using his script, he'll get the other half of the bounty.  Otherwise, I'll pass that half along to you as well.

Code:
( ! ) Notice: Undefined offset: 0 in C:\wamp\www\includes\jsonrpc.php on line 1498
Call Stack
# Time Memory Function Location
1 0.0033 368824 {main}( ) ..\sendmany.php:0
2 0.0708 2095928 BitcoinClient->sendmany( ) ..\sendmany.php:19
3 0.0709 2096048 BitcoinClient->query( ) ..\bitcoin.php:750
4 0.0710 2098736 xmlrpc_client->send( ) ..\bitcoin.php:378
5 0.0710 2098768 xmlrpc_client->sendPayloadHTTP10( ) ..\xmlrpc.php:1223
6 0.0710 2098768 jsonrpcmsg->createPayload( ) ..\xmlrpc.php:1244
7 0.0712 2099040 serialize_jsonrpcval( ) ..\jsonrpc.php:953

( ! ) Warning: reset() expects parameter 1 to be array, null given in C:\wamp\www\includes\jsonrpc.php on line 1443
Call Stack
# Time Memory Function Location
1 0.0033 368824 {main}( ) ..\sendmany.php:0
2 0.0708 2095928 BitcoinClient->sendmany( ) ..\sendmany.php:19
3 0.0709 2096048 BitcoinClient->query( ) ..\bitcoin.php:750
4 0.0710 2098736 xmlrpc_client->send( ) ..\bitcoin.php:378
5 0.0710 2098768 xmlrpc_client->sendPayloadHTTP10( ) ..\xmlrpc.php:1223
6 0.0710 2098768 jsonrpcmsg->createPayload( ) ..\xmlrpc.php:1244
7 0.0712 2099040 serialize_jsonrpcval( ) ..\jsonrpc.php:953
8 0.0717 2099712 serialize_jsonrpcval( ) ..\jsonrpc.php:1498
9 0.0717 2100056 reset ( ) ..\jsonrpc.php:1443

( ! ) Warning: Variable passed to each() is not an array or object in C:\wamp\www\includes\jsonrpc.php on line 1444
Call Stack
# Time Memory Function Location
1 0.0033 368824 {main}( ) ..\sendmany.php:0
2 0.0708 2095928 BitcoinClient->sendmany( ) ..\sendmany.php:19
3 0.0709 2096048 BitcoinClient->query( ) ..\bitcoin.php:750
4 0.0710 2098736 xmlrpc_client->send( ) ..\bitcoin.php:378
5 0.0710 2098768 xmlrpc_client->sendPayloadHTTP10( ) ..\xmlrpc.php:1223
6 0.0710 2098768 jsonrpcmsg->createPayload( ) ..\xmlrpc.php:1244
7 0.0712 2099040 serialize_jsonrpcval( ) ..\jsonrpc.php:953
8 0.0717 2099712 serialize_jsonrpcval( ) ..\jsonrpc.php:1498
9 0.0719 2100056 each ( ) ..\jsonrpc.php:1444

( ! ) Notice: Undefined offset: 1 in C:\wamp\www\includes\jsonrpc.php on line 1498
Call Stack
# Time Memory Function Location
1 0.0033 368824 {main}( ) ..\sendmany.php:0
2 0.0708 2095928 BitcoinClient->sendmany( ) ..\sendmany.php:19
3 0.0709 2096048 BitcoinClient->query( ) ..\bitcoin.php:750
4 0.0710 2098736 xmlrpc_client->send( ) ..\bitcoin.php:378
5 0.0710 2098768 xmlrpc_client->sendPayloadHTTP10( ) ..\xmlrpc.php:1223
6 0.0710 2098768 jsonrpcmsg->createPayload( ) ..\xmlrpc.php:1244
7 0.0712 2099040 serialize_jsonrpcval( ) ..\jsonrpc.php:953

( ! ) Warning: reset() expects parameter 1 to be array, null given in C:\wamp\www\includes\jsonrpc.php on line 1443
Call Stack
# Time Memory Function Location
1 0.0033 368824 {main}( ) ..\sendmany.php:0
2 0.0708 2095928 BitcoinClient->sendmany( ) ..\sendmany.php:19
3 0.0709 2096048 BitcoinClient->query( ) ..\bitcoin.php:750
4 0.0710 2098736 xmlrpc_client->send( ) ..\bitcoin.php:378
5 0.0710 2098768 xmlrpc_client->sendPayloadHTTP10( ) ..\xmlrpc.php:1223
6 0.0710 2098768 jsonrpcmsg->createPayload( ) ..\xmlrpc.php:1244
7 0.0712 2099040 serialize_jsonrpcval( ) ..\jsonrpc.php:953
8 0.0721 2099888 serialize_jsonrpcval( ) ..\jsonrpc.php:1498
9 0.0722 2100144 reset ( ) ..\jsonrpc.php:1443

( ! ) Warning: Variable passed to each() is not an array or object in C:\wamp\www\includes\jsonrpc.php on line 1444
Call Stack
# Time Memory Function Location
1 0.0033 368824 {main}( ) ..\sendmany.php:0
2 0.0708 2095928 BitcoinClient->sendmany( ) ..\sendmany.php:19
3 0.0709 2096048 BitcoinClient->query( ) ..\bitcoin.php:750
4 0.0710 2098736 xmlrpc_client->send( ) ..\bitcoin.php:378
5 0.0710 2098768 xmlrpc_client->sendPayloadHTTP10( ) ..\xmlrpc.php:1223
6 0.0710 2098768 jsonrpcmsg->createPayload( ) ..\xmlrpc.php:1244
7 0.0712 2099040 serialize_jsonrpcval( ) ..\jsonrpc.php:953
8 0.0721 2099888 serialize_jsonrpcval( ) ..\jsonrpc.php:1498
9 0.0723 2100144 each ( ) ..\jsonrpc.php:1444
Caught exception: Didn't receive 200 OK from remote server. (HTTP/1.1 500 Internal Server Error)


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: codler on July 01, 2011, 08:35:13 AM
Codler, your first example worked perfectly, thank you!  Well, I haven't yet confirmed the receipt of the coins, but it gave me a transaction ID in return, so I am assuming it worked.

The integration with bitcoin-php failed though - below are the errors.  I'll go ahead and send you your half of the reward since the first solution works, but I would love to have it working and integrated with the existing bitcoin-php package, since that's what my site is built around.  So, if you don't mind, take a look at the errors and let me know what you see.

If jav replies in a reasonable amount of time with a quick how-to on using his script, he'll get the other half of the bounty.  Otherwise, I'll pass that half along to you as well.

Code:
( ! ) Notice: Undefined offset: 0 in C:\wamp\www\includes\jsonrpc.php on line 1498
Call Stack
# Time Memory Function Location
1 0.0033 368824 {main}( ) ..\sendmany.php:0
2 0.0708 2095928 BitcoinClient->sendmany( ) ..\sendmany.php:19
3 0.0709 2096048 BitcoinClient->query( ) ..\bitcoin.php:750
4 0.0710 2098736 xmlrpc_client->send( ) ..\bitcoin.php:378
5 0.0710 2098768 xmlrpc_client->sendPayloadHTTP10( ) ..\xmlrpc.php:1223
6 0.0710 2098768 jsonrpcmsg->createPayload( ) ..\xmlrpc.php:1244
7 0.0712 2099040 serialize_jsonrpcval( ) ..\jsonrpc.php:953

( ! ) Warning: reset() expects parameter 1 to be array, null given in C:\wamp\www\includes\jsonrpc.php on line 1443
Call Stack
# Time Memory Function Location
1 0.0033 368824 {main}( ) ..\sendmany.php:0
2 0.0708 2095928 BitcoinClient->sendmany( ) ..\sendmany.php:19
3 0.0709 2096048 BitcoinClient->query( ) ..\bitcoin.php:750
4 0.0710 2098736 xmlrpc_client->send( ) ..\bitcoin.php:378
5 0.0710 2098768 xmlrpc_client->sendPayloadHTTP10( ) ..\xmlrpc.php:1223
6 0.0710 2098768 jsonrpcmsg->createPayload( ) ..\xmlrpc.php:1244
7 0.0712 2099040 serialize_jsonrpcval( ) ..\jsonrpc.php:953
8 0.0717 2099712 serialize_jsonrpcval( ) ..\jsonrpc.php:1498
9 0.0717 2100056 reset ( ) ..\jsonrpc.php:1443

( ! ) Warning: Variable passed to each() is not an array or object in C:\wamp\www\includes\jsonrpc.php on line 1444
Call Stack
# Time Memory Function Location
1 0.0033 368824 {main}( ) ..\sendmany.php:0
2 0.0708 2095928 BitcoinClient->sendmany( ) ..\sendmany.php:19
3 0.0709 2096048 BitcoinClient->query( ) ..\bitcoin.php:750
4 0.0710 2098736 xmlrpc_client->send( ) ..\bitcoin.php:378
5 0.0710 2098768 xmlrpc_client->sendPayloadHTTP10( ) ..\xmlrpc.php:1223
6 0.0710 2098768 jsonrpcmsg->createPayload( ) ..\xmlrpc.php:1244
7 0.0712 2099040 serialize_jsonrpcval( ) ..\jsonrpc.php:953
8 0.0717 2099712 serialize_jsonrpcval( ) ..\jsonrpc.php:1498
9 0.0719 2100056 each ( ) ..\jsonrpc.php:1444

( ! ) Notice: Undefined offset: 1 in C:\wamp\www\includes\jsonrpc.php on line 1498
Call Stack
# Time Memory Function Location
1 0.0033 368824 {main}( ) ..\sendmany.php:0
2 0.0708 2095928 BitcoinClient->sendmany( ) ..\sendmany.php:19
3 0.0709 2096048 BitcoinClient->query( ) ..\bitcoin.php:750
4 0.0710 2098736 xmlrpc_client->send( ) ..\bitcoin.php:378
5 0.0710 2098768 xmlrpc_client->sendPayloadHTTP10( ) ..\xmlrpc.php:1223
6 0.0710 2098768 jsonrpcmsg->createPayload( ) ..\xmlrpc.php:1244
7 0.0712 2099040 serialize_jsonrpcval( ) ..\jsonrpc.php:953

( ! ) Warning: reset() expects parameter 1 to be array, null given in C:\wamp\www\includes\jsonrpc.php on line 1443
Call Stack
# Time Memory Function Location
1 0.0033 368824 {main}( ) ..\sendmany.php:0
2 0.0708 2095928 BitcoinClient->sendmany( ) ..\sendmany.php:19
3 0.0709 2096048 BitcoinClient->query( ) ..\bitcoin.php:750
4 0.0710 2098736 xmlrpc_client->send( ) ..\bitcoin.php:378
5 0.0710 2098768 xmlrpc_client->sendPayloadHTTP10( ) ..\xmlrpc.php:1223
6 0.0710 2098768 jsonrpcmsg->createPayload( ) ..\xmlrpc.php:1244
7 0.0712 2099040 serialize_jsonrpcval( ) ..\jsonrpc.php:953
8 0.0721 2099888 serialize_jsonrpcval( ) ..\jsonrpc.php:1498
9 0.0722 2100144 reset ( ) ..\jsonrpc.php:1443

( ! ) Warning: Variable passed to each() is not an array or object in C:\wamp\www\includes\jsonrpc.php on line 1444
Call Stack
# Time Memory Function Location
1 0.0033 368824 {main}( ) ..\sendmany.php:0
2 0.0708 2095928 BitcoinClient->sendmany( ) ..\sendmany.php:19
3 0.0709 2096048 BitcoinClient->query( ) ..\bitcoin.php:750
4 0.0710 2098736 xmlrpc_client->send( ) ..\bitcoin.php:378
5 0.0710 2098768 xmlrpc_client->sendPayloadHTTP10( ) ..\xmlrpc.php:1223
6 0.0710 2098768 jsonrpcmsg->createPayload( ) ..\xmlrpc.php:1244
7 0.0712 2099040 serialize_jsonrpcval( ) ..\jsonrpc.php:953
8 0.0721 2099888 serialize_jsonrpcval( ) ..\jsonrpc.php:1498
9 0.0723 2100144 each ( ) ..\jsonrpc.php:1444
Caught exception: Didn't receive 200 OK from remote server. (HTTP/1.1 500 Internal Server Error)

Add this code to this line. https://github.com/mikegogulski/bitcoin-php/blob/5d425e1de01b2e6b0e08e897a39c5f973ea7ce3e/src/includes/jsonrpc.inc#L1491
Remember ADD not replace.

Code:
if (array_keys($val) !== range(0, count($val) - 1)) {
foreach($val as $key2 => $val2) {
$rs .= ',"'.json_encode_entities($key2, null, $charset_encoding).'":';
$rs .= serialize_jsonrpcval($val2, $charset_encoding);
}
$rs = '{' . substr($rs, 1) . '}';
break;
}


I have not received any coins yet. What address did you send to?


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: SgtSpike on July 01, 2011, 08:42:24 AM
Sorry - I was excited to have working code, and promptly forgot to send you coins after posting that message.  Just sent them now.  :P


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: codler on July 01, 2011, 08:54:21 AM
Sorry - I was excited to have working code, and promptly forgot to send you coins after posting that message.  Just sent them now.  :P

np, I see you sent now, Thanks!

Do the latest patch work?


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: SgtSpike on July 01, 2011, 09:00:46 AM
I haven't had the opportunity to try it yet - in the middle of some operations.  But I'll let you know if it does!


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: jav on July 01, 2011, 09:44:31 AM
Ok, you'll have to forgive me, because I know very little about python except for how to open one from the command line.  :P  What do I do with the library file?

Just put both files in the same directory (so authproxy.py and let's say sendmany.py which has the code that I listed) and then run:
python sendmany.py


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: brendio on July 10, 2011, 02:16:22 PM
Thanks jav, token tip sent your way.

I do have a question though. Why could I not get sendmany to work from the Windows command line?

I tried many variations of the following command, formatted according to Gavin's original patch (http://forum.bitcoin.org/?topic=4254.0), but each time get an error message, "type mismatch".

Quote
bitcoind.exe sendmany "" '{"1BrendiovuqgHwxTq9QWRGvMHTkp3YSnKF":0.0001,"1TipMEDeqWT1VUmmhH3rmkVrkA4KYRk2C":0.0001}'

I also discovered that with jav methods, I had insufficient funds in my "" account as it had a negative balance. I got around that by creating another account and transferring a heap across to my "", putting it in the black and the newly made account majorly in the red.


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: jav on July 10, 2011, 03:38:35 PM
Thanks jav, token tip sent your way.

I do have a question though. Why could I not get sendmany to work from the Windows command line?

Quote
bitcoind.exe sendmany "" '{"1BrendiovuqgHwxTq9QWRGvMHTkp3YSnKF":0.0001,"1TipMEDeqWT1VUmmhH3rmkVrkA4KYRk2C":0.0001}'

I never tried this on Windows. Maybe the ' character is interpreted differently there? Have you tried something like this instead?

bitcoind.exe sendmany "" "{\"1BrendiovuqgHwxTq9QWRGvMHTkp3YSnKF\":0.0001,\"1TipMEDeqWT1VUmmhH3rmkVrkA4KYRk2C\":0.0001}"

I also discovered that with jav methods, I had insufficient funds in my "" account as it had a negative balance. I got around that by creating another account and transferring a heap across to my "", putting it in the black and the newly made account majorly in the red.

Not sure how you ended up in this situation in the first place, but I don't think this is specific to the method I described.


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: brendio on July 11, 2011, 12:34:45 AM

Quote
bitcoind.exe sendmany "" '{"1BrendiovuqgHwxTq9QWRGvMHTkp3YSnKF":0.0001,"1TipMEDeqWT1VUmmhH3rmkVrkA4KYRk2C":0.0001}'

I never tried this on Windows. Maybe the ' character is interpreted differently there? Have you tried something like this instead?

bitcoind.exe sendmany "" "{\"1BrendiovuqgHwxTq9QWRGvMHTkp3YSnKF\":0.0001,\"1TipMEDeqWT1VUmmhH3rmkVrkA4KYRk2C\":0.0001}"
Genius. Yep, that worked. Just tipped myself :)

I also discovered that with jav methods, I had insufficient funds in my "" account as it had a negative balance. I got around that by creating another account and transferring a heap across to my "", putting it in the black and the newly made account majorly in the red.

Not sure how you ended up in this situation in the first place, but I don't think this is specific to the method I described.
I think it has to do with naming my receiving addresses in the client, so they all had positive balances, but then when it sends, it sends from the "" account. I don't think there is a way to send from a particular account in the client.

Agree this is off topic. Just thought it interesting that the sendmany command (and possibly other command line commands) won't put an account into negative territory, whereas the GUI client will.


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: SgtSpike on July 11, 2011, 06:03:52 AM
Sorry, forgot to send jav the other half of the bounty.  Sent!  Thank you both for your contributions.  :)


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: triplef on July 05, 2014, 08:34:02 PM
BTW this aint working for me...


$sendmany.="{";

foreach ($bob as $b) {

$sendmany  .= '"B9zb7z2C8JkFnfDRMg1cgK6BKEtY7tDiDJ":'.(float)$b;
$sendmany.= ",";
}
$sendmany.="}";
 $sent = $test->sendmany($wallet,$sendmany);

tried with array_push same results...

any idea ? jsonrpc lib


Error: Fatal error:  Uncaught exception 'Exception' with message 'Request error: -1 - value is type str, expected obj'

jsonRPCClient->sendmany('test', '{"B9zb7z2C8JkFn...')


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: BitCoinDream on July 05, 2014, 08:44:29 PM
BTW this aint working for me...


$sendmany.="{";

foreach ($bob as $b) {

$sendmany  .= '"B9zb7z2C8JkFnfDRMg1cgK6BKEtY7tDiDJ":'.(float)$b;
$sendmany.= ",";
}
$sendmany.="}";
 $sent = $test->sendmany($wallet,$sendmany);

tried with array_push same results...

any idea ? jsonrpc lib


Error: Fatal error:  Uncaught exception 'Exception' with message 'Request error: -1 - value is type str, expected obj'

jsonRPCClient->sendmany('test', '{"B9zb7z2C8JkFn...')


Can u please publish the complete code that is giving trouble ?


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: Initscri on July 05, 2014, 11:40:49 PM
I completed this for a client a while back and released the source code here : https://bitcointalk.org/index.php?topic=620353.0

This should be exactly what everyone is looked for.


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: triplef on July 06, 2014, 12:14:32 AM
nm found it


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: seoincorporation on October 02, 2014, 05:41:17 PM
Easy sendmany bash script

Code:
#!/bin/bash
#Guid
gu="xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx"
#Blockchain password
pas="xxxxxxxxxx"
green="1LuckyG4tMMZf64j6ea7JhCz7sDpk6vdcS"
yellow="1LuckyY9fRzcJre7aou7ZhWVXktxjjBb9S"
red="1LuckyR1fFHEsXYyx5QK4UFzv3PEAepPMK"
BTCg="250000"
BTCy="150000"
BTCr="100000"
echo ""
curl "https://blockchain.info/merchant/$gu/sendmany?password=$pas&recipients=%7B%22$green%22%3A$BTCg%2C%22$yellow%22%3A$BTCy%2C%22$red%22%3A$BTCr%7D&shared=false&fee=10000"

Bash Script + Curl + Blockchain API

Source:https://bitcointalk.org/index.php?topic=806051.


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: SgtSpike on October 02, 2014, 08:17:49 PM
Easy sendmany bash script

Code:
#!/bin/bash
#Guid
gu="xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx"
#Blockchain password
pas="xxxxxxxxxx"
green="1LuckyG4tMMZf64j6ea7JhCz7sDpk6vdcS"
yellow="1LuckyY9fRzcJre7aou7ZhWVXktxjjBb9S"
red="1LuckyR1fFHEsXYyx5QK4UFzv3PEAepPMK"
BTCg="250000"
BTCy="150000"
BTCr="100000"
echo ""
curl "https://blockchain.info/merchant/$gu/sendmany?password=$pas&recipients=%7B%22$green%22%3A$BTCg%2C%22$yellow%22%3A$BTCy%2C%22$red%22%3A$BTCr%7D&shared=false&fee=10000"

Bash Script + Curl + Blockchain API

Source:https://bitcointalk.org/index.php?topic=806051.
Thanks for contributing, even though the bounty is over.  I'm sure this will be helpful to someone!


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: Vortex20000 on October 03, 2014, 12:29:12 AM
Working on sendmany for implementation on MC-CC?  ;)


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: seoincorporation on October 03, 2014, 12:52:24 AM
Easy sendmany bash script

Code:
#!/bin/bash
#Guid
gu="xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx"
#Blockchain password
pas="xxxxxxxxxx"
green="1LuckyG4tMMZf64j6ea7JhCz7sDpk6vdcS"
yellow="1LuckyY9fRzcJre7aou7ZhWVXktxjjBb9S"
red="1LuckyR1fFHEsXYyx5QK4UFzv3PEAepPMK"
BTCg="250000"
BTCy="150000"
BTCr="100000"
echo ""
curl "https://blockchain.info/merchant/$gu/sendmany?password=$pas&recipients=%7B%22$green%22%3A$BTCg%2C%22$yellow%22%3A$BTCy%2C%22$red%22%3A$BTCr%7D&shared=false&fee=10000"

Bash Script + Curl + Blockchain API

Source:https://bitcointalk.org/index.php?topic=806051.
Thanks for contributing, even though the bounty is over.  I'm sure this will be helpful to someone!

I know the bounty is over, i just want to share this nice code. It works nice for me and i like to share the knowledge.


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: SgtSpike on October 08, 2014, 04:10:39 AM
Working on sendmany for implementation on MC-CC?  ;)
Hah, yep that's exactly what it was for!


Title: Re: [1 BTC BOUNTY] A way to use sendmany
Post by: DiamondCardz on October 08, 2014, 04:40:09 PM
Working on sendmany for implementation on MC-CC?  ;)
Hah, yep that's exactly what it was for!

I figured half as much, haha. MinecraftCC is still up, then? Haven't logged on in a while as I've been swept up with managing my own Minecraft server...good to see that my Sponsor rank suggestion was successful though ;)