0

I heard that apparently, exchanges and similar "load up" and then "batch-send" many Bitcoin transactions at once, with just one fee, instead of sending each one with a separate fee.

Is this actually possible? Is it easy to do? Should I be doing it for all my "withdrawals"? Will it save me lots of money versus making separate Bitcoin transactions for each customer? (I'm not running or planning on running an exchange, but a Bitcoin-based service where people will get sent Bitcoin.)

0

1 Answer 1

2

Is this actually possible?

Yes. Transactions may have arbitrarily many inputs and outputs (subject to them fitting inside a block, of course). The inputs must be UTXOs that you can provide signatures for (coins you own), and the outputs will be new UTXOs, each of which can be associated with any address(es) you like (that is, the coins you own can be distributed amongst as many addresses as you like).

Is it easy to do?

The reference implementation (Bitcoin Core / bitcoind) allows you to do this on the command line (that is, with bitcoin-cli) using its sendmany command. You can see an example usage of that command in this answer to a similar question.

I'm not aware of any wallets or solutions that make this easy to do via a GUI. Bitcoin Core and Samourai have easy ways to do batch spends. In Bitcoin Core, there is an [Add Recipient] button at the bottom of the "Send" tab. In Samourai, when at the "Send" screen where you would enter the destination address and amount, you can tap the three dots in the upper-right, and then tap [Batch spend].

There must be automated business solutions out there that companies such as exchanges and large merchants are using, though I'm not aware of any specific ones. Perhaps this functionality is present in BTCPay Server, but if so, I'm not familiar with it.

Will it save me lots of money versus making separate Bitcoin transactions for each customer?

That depends on the frequency at which you receive orders and the frequency at which you wish to fulfill those orders. If, say, you're receiving 10 orders per minute, then you could batch 50 orders into one transaction, allowing you to fulfill orders within 5 minutes. If you're only receiving 1 order per minute, then you could only batch 5 orders into one trasaction whilst still fulfilling orders within 5 minutes; to batch 50 transactions, you'd have to wait until you'd received 50 orders, meaning your customers would have to wait up to 50 minutes before you fulfill their particular order.

The average BTC transaction that contains one input (your funds) and two P2PKH outputs (recipient and change) is around 250 bytes. Each additional P2PKH output requires 34 bytes. In this way, assuming a transaction fee of 90 sats/byte:

  • 50 individual transactions with 1 recipient (2 outputs) each would in total cost 1,125,000 sats ≈ 0.011 BTC (≈ 486 USD at time of writing).

  • 1 batch transaction with 50 recipients (51 outputs) would only cost 172,440 sats ≈ 0.0017 BTC (≈ 74.50 USD at time of writing).

You can see how this becomes very economical at scale!


Having said all that, in practice this is much less of an issue nowadays because of Layer 2 networks like the Lightning Network. With Lightning, fees average no more than 20 sats per off-chain transaction, and then the resulting balance after many, many Lightning transactions will ultimately be settled on-chain by paying a single BTC transaction fee. Let's say you fund a Lightning channel, perform 50 transactions, and then settle the channel. That's:

  1. One on-chain transaction of 250 bytes, paying 90 sats/byte, so 22,500 sats.
  2. 50 Lightning transactions at no more than 20 sats each, so no more than 1,000 sats.
  3. Another on-chain transaction with another 22,500 sat fee.

So in total, that's 46,000 sats = 0.00046 BTC (≈ 20 USD at time of writing).

In practice, you can expect to perform many more than just 50 transactions with a single Lightning channel, further reducing the effective cost per transaction.

5
  • 1
    Almost every bitcoin wallet has the GUI to enter multiple outputs for a transaction
    – user103136
    Commented Feb 8, 2021 at 15:15
  • @Prayank — I have been using Samourai for a while now but never noticed the "Batch spend" option in the [...] menu, so thanks for that! However, I just took a look at Bitcoin Core for macOS, and Mycelium, Schildbach's Bitcoin Wallet, and Phoenix for Android in case they changed since I last used them, and it seems that they still do not support batch spending. Do you know of any other GUI wallets that do?
    – Jivan Pal
    Commented Feb 8, 2021 at 15:46
  • 1
    The Bitcoin Core GUI lets you enter multiple amounts/destinations. Commented Feb 8, 2021 at 16:01
  • 1
    @PieterWuille, d'oh! I have just now seen the [Add Recipient] button... I must be blind! Had to search "bitcoin core multiple destinations" to realise that, was searching "bitcoin core batch spend" before and not finding out anything. Thanks 🙂
    – Jivan Pal
    Commented Feb 8, 2021 at 16:05
  • Bitcoin core and Electrum screenshots are mentioned in this answer: bitcoin.stackexchange.com/a/100396 all the other Desktop wallets mentioned in bitcoinwallet.guide allow multiple outputs in transactions. For mobile wallets: I prefer Samourai and Bluewallet, both have options to add multiple outputs.
    – user103136
    Commented Feb 8, 2021 at 16:15

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