Author

Topic: blockchain.info API, problem in sendmany (Read 1597 times)

newbie
Activity: 7
Merit: 0
October 23, 2014, 11:18:04 PM
#4
Hi,
i had alot of problems with this Bitcoin API too, specialy the callback URL
after 2 nights of Headaches,i finaly found the problem :p
this is a DEMO, who is interesting to integrate this LOVELY API on his website he can "Check before Buy" here is the link : http://ex-currency.com/btc/index.php
Payment Sent/Recieved/Confirmed IMMEDIATLY
the price of curiosity is 1 USD
p4u
member
Activity: 111
Merit: 10
crypto lover
Finally I found it. Seems that blockchain.info does not accept amounts in decimal format. They use "Satoshis" (I already knew that) but amount must be integer.

So, blockchain.py library is working fine Smiley Feel free to use it.
p4u
member
Activity: 111
Merit: 10
crypto lover
I've made some advances.

This is the HTTP/post content I'm sending now with the last code of my github repository.

Quote
recipients=%7B%221KfC6Q1GLxSJm3QdMRqi745QN2nJ7JjsQC%22%3A%22182445.18%22%2C%22181rvCtNX5uPYkcDfpNrM9itC6LRdQBUYP%22%3A%22150000.0%22%7D

Now blockchain.info says:

Quote
RuntimeError: ERROR: java.lang.String cannot be cast to java.lang.Long

lol
p4u
member
Activity: 111
Merit: 10
crypto lover
Hi.
I'm working on this https://github.com/p4u/blockchain.py
It is a blockchain.info python API (I did not find any code light and working). I've problems with the "sendManyPayment" method, I hope you can help me.

According to blockchain.info API specification (https://blockchain.info/es/api/blockchain_wallet_api):

Code:
https://blockchain.info/es/merchant/$guid/sendmany?password=$main_password&second_password=$second_password&recipients=$recipients&shared=$shared&fee=$fee

    $main_password Your Main My wallet password
    $second_password Your second My Wallet password if double encryption is enabled.
    $recipients Is a JSON Object using Bitcoin Addresses as keys and the amounts to send as values (See below).
    $from Send from a specific Bitcoin Address (Optional)
    $shared "true" or "false" indicating whether the transaction should be sent through a shared wallet. Fees apply. (Optional)
    $fee Transaction fee value in satoshi (Must be greater than default fee) (Optional)
    $note A public note to include with the transaction (Optional)

{
    "1JzSZFs2DQke2B3S4pBxaNaMzzVZaG4Cqh": 100000000,
    "12Cf6nCcRtKERh9cQm3Z29c9MWvQuFSxvT": 1500000000,
    "1dice6YgEVBf88erBFra9BHf6ZMoyvG88": 200000000
}

Recipients is a JSON object with the BTC address as key and the amount in Satoshi as value.

Sending the recipients dictionary as is, does not work:

Code:
RuntimeError: ERROR: Invalid Recipients JSON. Please make sure it is url encoded and consult the docs.

And trying to encode it by

Code:
data['recipients'] = urllib.parse.urlencode(recipients)

Does not work either.

Code:
RuntimeError: ERROR: Invalid Recipients JSON. Please make sure it is url encoded and consult the docs.

Do you have any experience with it? Do you know which kind of data are they expecting? Could it be that they use another url encode RFC?

Thanks!

EDIT: typo
Jump to: