Bitcoin Forum
November 02, 2024, 01:38:46 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: blockchain.info API, problem in sendmany  (Read 1596 times)
p4u (OP)
Member
**
Offline Offline

Activity: 111
Merit: 10

crypto lover


View Profile
May 08, 2014, 05:44:14 PM
 #1

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
p4u (OP)
Member
**
Offline Offline

Activity: 111
Merit: 10

crypto lover


View Profile
May 08, 2014, 06:40:02 PM
 #2

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 (OP)
Member
**
Offline Offline

Activity: 111
Merit: 10

crypto lover


View Profile
May 09, 2014, 10:15:04 AM
 #3

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.
ExchangeCurrency
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
October 24, 2014, 04:18:04 AM
 #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
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!