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,550 points
32 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,170 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 bitcoin transaction. You ...READ MORE

answered Jul 20, 2018 in Blockchain by Christine
• 15,790 points
467 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,020 points
40 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,020 points
458 views
0 votes
1 answer
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,550 points
83 views
+1 vote
1 answer
0 votes
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,170 points
39 views