-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sendmany fails when passing valid json string #57
Comments
Thank you for your feedback! This client accepts only standard php arrays as parameters ($payments and $addresses in this case) and doesn't support json strings at all. Please use php arrays directly (do NOT convert them to string via // payments must be passed as an array instead of json string
$payments = array(
"tb1q87nfvuezn53pv5c6fwzz5tm9mp3dga9dajzel2" => "0.00014664",
"tb1q87nfvuezn53pv5c6fwzz5tm9mp3dga9dajzel2" => "0.00048881",
"tb1qmcnn8mxhdxa742nzdpcz0kzrdqtg7m0xvkes8t" => "0.0002444",
"tb1qgc5vlfnt7fhnx5ly9yjt8zte8jppre0fa68xjl" => "0.00019776"
);
// same with addresses
$addresses = array(
"tb1q87nfvuezn53pv5c6fwzz5tm9mp3dga9dajzel2",
"tb1q87nfvuezn53pv5c6fwzz5tm9mp3dga9dajzel2",
"tb1qmcnn8mxhdxa742nzdpcz0kzrdqtg7m0xvkes8t",
"tb1qgc5vlfnt7fhnx5ly9yjt8zte8jppre0fa68xjl"
); |
Ah! I was so focused on the RPC docs that I forgot you've done much of the heavy lifting for us! I assume this array: For addresses to take fees from is OK? |
Quick Q.. I'm noticing that the sendmany option isn't quite correct. I'm telling my node to send 990000 sats to two addresses each You'll see that I'm actually sending Making So I'm logging on my system, that I've sent 990000 sats, and telling the sendmany to send that and take the fees from those payments... BUT, I'm still sending MORE than the 990000 sats I've told the function to. You come across this before? Cheers! |
No, you did not. You sent -0.989868 + fee: -0.00000132 = -0.990000 |
When I prep a valid json string and pass it to
sendmany
, I get told it's not a valid json object:https://developer.bitcoin.org/reference/rpc/sendmany.html
Denpa\Bitcoin\Exceptions\BadRemoteCallException
JSON value is not an object as expected
Here are some testnet addresses and amounts:
$payments = '{"tb1q87nfvuezn53pv5c6fwzz5tm9mp3dga9dajzel2":0.00014664,"tb1q87nfvuezn53pv5c6fwzz5tm9mp3dga9dajzel2":0.00048881,"tb1qmcnn8mxhdxa742nzdpcz0kzrdqtg7m0xvkes8t":0.0002444,"tb1qgc5vlfnt7fhnx5ly9yjt8zte8jppre0fa68xjl":0.00019776}';
Addresses to deduct fees from:
$addresses = '["tb1q87nfvuezn53pv5c6fwzz5tm9mp3dga9dajzel2","tb1q87nfvuezn53pv5c6fwzz5tm9mp3dga9dajzel2","tb1qmcnn8mxhdxa742nzdpcz0kzrdqtg7m0xvkes8t","tb1qgc5vlfnt7fhnx5ly9yjt8zte8jppre0fa68xjl"]';
I'm calling:
And getting the error described above.
I'm expecting a TXID returned from the BTC node
Logs
If applicable, attach log files.
Feel free to omit any sensitive information.
Environment
Describe your runtime environment:
I've tried creating an array and json_encode() etc.. all fails.
Seems I need to explicitly send an object, but JSON is just a string.
The text was updated successfully, but these errors were encountered: