Scenario: Suppose that I have to make three transactions simultaneously to Alice, Bob and Claudia. Now the condition is if any one transaction fails the other two must also not go through.

Query: How can I achieve this in BTC blockchain? Is there any feature that BTC provide to batch transactions as one so that it's atomicity is maintained?

2 Answers 2


If you have no trouble with Alice, Bob and Claudia know about each other, you could create a single transaction with 3 outputs, one for each of them. In such case they will all three get bitcoins, or all three would not get bitcoins (because actually it would be 1 transaction, which will get into blockchain, or would not).


I can show you the way to make it with bitcoin-cli. For this you'll need full node running on your machine (bitcoind). This node must own your funds (privkeys for accounts with your funds must be in its wallet.dat). If this is the case, then you need sendmany method.


# Unlock the wallet (If your wallet is unencrypted, skip this step)
bitcoin-cli walletpassphrase "passphrase" 10
# Send all funds to everybody you need
bitcoin-cli sendmany "" '{"2N8hwP1WmJrFF5QWABn38y63uYLhnJYJYTF": 0.05, "2N5zxMH53RX3JLWbV5csmZrAhWY1R7Fr1SA": 0.05}'
# Lock the wallet
bitcoin-cli walletlock

You'll get transaction id as the result of sendmany call:


(it is real transaction in bitcoin testnet)

To get more info about sendmany method, you can run bitcoin-cli help sendmany, you'll see the list of available params and examples of using it with curl. Or you can go to the official documentation


If you have access to bitcoin node, but this node does not have your funds, you can create new unsigned transaction using createrawtransaction method on the node, then sign this transaction in your wallet and send it, using sendrawtransaction.

  • Thanks a lot! Can you please guide me how to create 3 outputs from a single transaction?
    – Gagan
    Commented Jul 12, 2018 at 13:47

AFAIK no... the proof, that transaction has gone through is it‘s appearance in a block. So it has a confirmation. This cannot be verified by other transactions. You would have to write a surrounding script, which verifies the confirmation status on the blockchain, and then triggers the other transactions.

It get‘s even more difficult in your scenario - what do you mean by simultaneously? If the first goes through, and the second not, then the first shall be revoked? Also impossible with the standard toolset. In general: why would a tx not go through? Based on a time limit? Or do you think more of double spent or similar?

Update after comments section below:

to have three outputs, the command from the bitcoin developer pages would become three pairs of address/bitcoin value:

  "'$NEW_ADDRESS1'": 79.9999, 
  "'$NEW_ADDRESS2'": 10, 
  "'$NEW_ADDRESS3'": 1 

(lines are terminated by a comma or the final curly brace)

  • Hi @pebwindkraft, "what do you mean by simultaneously?" I mean I want to send all three transactions logically as a single transaction.
    – Gagan
    Commented Jul 12, 2018 at 13:36
  • "If the first goes through, and the second not, then the first shall be revoked?" Yes, that's exactly what I mean.
    – Gagan
    Commented Jul 12, 2018 at 13:37
  • "why would a tx not go through? Based on a time limit? Or do you think more of double spent or similar?" As I mentioned above that I want these three transactions to be submitted as a single transaction logically. What I was expecting here was to know if there was any in-built feature already available. But seems like it's not possible without scripting. Is that right?
    – Gagan
    Commented Jul 12, 2018 at 13:41
  • I get your point, in bitcoin logic you would have one transaction with three outputs. Thats not batching... anyhow, creating a raw tx is described in the developer section of bitcoin.org (bitcoin.org/en/developer-examples#complex-raw-transaction). You would simply add a third address/amount pair... that is a standard way of creating tx in bitcoin, you can have even more than 3 outputs... Commented Jul 12, 2018 at 21:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.