How to send bitcoins to multiple recipients at once

0 votes

Hi.. I have gone through blockchain API documentation and understood how to send bitcoins to a recipient but now I want to send bitcoins to two recipients at once. I am using the following code:

recipes ={'1Pd9gXJ8EqyGrqMKVevQWNjjF4B4dcSykf':10000,'14gVMjoCbjaGU3s9EQghVxYTAJgkmqqtHV':10000}

url_multi = 'https://blockchain.info/nl/merchant/MYKEY/sendmany?password=MYPASSWORD&recipients='+recipes+'&fee=15000'

requests.get(url_multi)

but it doesn’t work. How can I do it?

Error log:

TypeError: cannot concatenate 'str' and 'dict' objects

Aug 1, 2018 in Blockchain by digger
• 26,740 points
692 views

1 answer to this question.

0 votes

To send bitcoins to multiple recipients, you need to send the recipients address as JSON object.

To convert it to JSON object, use the following code:

x = json.dumps(recipes)

Next, you can use your request as usual but by using the JSON object, like this:

url_multi = 'https://blockchain.info/nl/merchant/MYKEY/sendmany?password=MYPASSWORD&recipients='+x+'&fee=15000'

requests.get(url_multi)

answered Aug 1, 2018 by slayer
• 29,370 points

Related Questions In Blockchain

0 votes
1 answer

How to send Bitcoins with node.js?

This website https://blockr.io/tx/push will successfully do the ...READ MORE

answered Jul 20, 2018 in Blockchain by Christine
• 15,790 points
3,403 views
0 votes
1 answer

How secure is to implement blockchain at a smaller scale??

Blockchain relies on the number of nodes ...READ MORE

answered Apr 18, 2018 in Blockchain by Perry
• 17,100 points
788 views
0 votes
1 answer

How do I send back ethers to the sender of the tokens in a smart contract?

Whenever a smart contract receives ether via ...READ MORE

answered May 30, 2018 in Blockchain by Perry
• 17,100 points
3,601 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,451 views
0 votes
1 answer

Invalid Batch or signature in Savtooth

This will solve your problem import org.apache.commons.codec.binary.Hex; Transaction txn ...READ MORE

answered Aug 1, 2018 in Blockchain by digger
• 26,740 points
1,004 views
+1 vote
1 answer
0 votes
1 answer

How to use third party contract to send ERC token?

You can do it by using a ...READ MORE

answered Aug 10, 2018 in Blockchain by slayer
• 29,370 points
1,040 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP