Pages:
Author

Topic: [1 BTC BOUNTY] A way to use sendmany (Read 5127 times)

legendary
Activity: 1134
Merit: 1112
October 08, 2014, 12:40:09 PM
#31
Working on sendmany for implementation on MC-CC?  Wink
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 Wink
legendary
Activity: 1400
Merit: 1005
October 08, 2014, 12:10:39 AM
#30
Working on sendmany for implementation on MC-CC?  Wink
Hah, yep that's exactly what it was for!
legendary
Activity: 2982
Merit: 2681
Top Crypto Casino
October 02, 2014, 08:52:24 PM
#29
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.
hero member
Activity: 504
Merit: 500
sucker got hacked and screwed --Toad
October 02, 2014, 08:29:12 PM
#28
Working on sendmany for implementation on MC-CC?  Wink
legendary
Activity: 1400
Merit: 1005
October 02, 2014, 04:17:49 PM
#27
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!
legendary
Activity: 2982
Merit: 2681
Top Crypto Casino
October 02, 2014, 01:41:17 PM
#26
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.
full member
Activity: 338
Merit: 100
https://eloncity.io/
July 05, 2014, 08:14:32 PM
#25
nm found it
hero member
Activity: 1540
Merit: 759
July 05, 2014, 07:40:49 PM
#24
I completed this for a client a while back and released the source code here : https://bitcointalksearch.org/topic/ann-bitcoin-transaction-split-script-using-blockchaininfo-api-620353

This should be exactly what everyone is looked for.
legendary
Activity: 2282
Merit: 1204
The revolution will be digital
July 05, 2014, 04:44:29 PM
#23
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 ?
full member
Activity: 338
Merit: 100
https://eloncity.io/
July 05, 2014, 04:34:02 PM
#22
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...')
legendary
Activity: 1400
Merit: 1005
July 11, 2011, 02:03:52 AM
#21
Sorry, forgot to send jav the other half of the bounty.  Sent!  Thank you both for your contributions.  Smiley
hero member
Activity: 518
Merit: 500
July 10, 2011, 08:34:45 PM
#20

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 Smiley

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.
jav
sr. member
Activity: 249
Merit: 251
July 10, 2011, 11:38:35 AM
#19
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.
hero member
Activity: 518
Merit: 500
July 10, 2011, 10:16:22 AM
#18
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, 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.
jav
sr. member
Activity: 249
Merit: 251
July 01, 2011, 05:44:31 AM
#17
Ok, you'll have to forgive me, because I know very little about python except for how to open one from the command line.  Tongue  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
legendary
Activity: 1400
Merit: 1005
July 01, 2011, 05:00:46 AM
#16
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!
full member
Activity: 191
Merit: 100
July 01, 2011, 04:54:21 AM
#15
Sorry - I was excited to have working code, and promptly forgot to send you coins after posting that message.  Just sent them now.  Tongue

np, I see you sent now, Thanks!

Do the latest patch work?
legendary
Activity: 1400
Merit: 1005
July 01, 2011, 04:42:24 AM
#14
Sorry - I was excited to have working code, and promptly forgot to send you coins after posting that message.  Just sent them now.  Tongue
full member
Activity: 191
Merit: 100
July 01, 2011, 04:35:13 AM
#13
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?
legendary
Activity: 1400
Merit: 1005
July 01, 2011, 01:49:47 AM
#12
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)
Pages:
Jump to: