Batching transactions

Batching transactions

Batching transactions means combining multiple payments into one transaction. This can have multiple benefits like:

1. Decreased transaction fees

    Transaction fees are determined by the size of the transaction and the current market demand for processing. The size is influenced by the number of inputs and outputs in the transaction. For instance, a typical single payment transaction might have one input and three outputs. Let's illustrate this with an example: You have 1 bitcoin and want to send 0.3 bitcoin to a friend. The transaction breakdown would be as follows:

    Input(s): 

      1. you're 1 btc

    Output(s)

      1. 0.001 btc The transaction fee (imaginary number)
      2. 0.3 btc for you're friend
      3. 0.699 btc back into you're wallet as change

    This 1 input, 3 output transaction has a size of 172 vBytes, and you paid 0.001 BTC as a fee for processing.

    However, when sending 0.3 BTC to one friend and 0.2 BTC to another, you have two options: either create two separate transactions of 172 vBytes each (paying 344 vBytes, equivalent to 0.002 BTC), or use batching to consolidate the payments into a single transaction:

    Input(s): 

    1. you're 1 btc

    Output(s)

    1. 0.00125 btc The transaction fee (imaginary number)
    2. 0.3 btc to friend 1
    3. 0.2 btc to friend 2
    4. 0.49875 btc back into you're wallet as change
    This batched transaction will have a size of 203 vBytes and incur a fee of 0.00125 BTC. Compared to two individual transactions, batching significantly reduces the average fee per payment, leading to notable cost savings and preserving your precious sats! Embracing this advantage of batching can make a significant difference in optimising your transaction fees.

     2. Faster processing 

    We could look at a batched transaction in another way. If we would set the average transaction fee per payment to the amount we would have payed for singe transaction, the overall fee of the transaction will be way higher. En example:

    Imaging you need to make 3 payments. The "slow" option is making 3 single 1 in/ 3 out transactions at a cost of 3* 172 vBytes at 10sats/vByte = 5160 sats.

    A batched transaction 1 in/ 5 out (making 3 payments in one transaction) would cost 235 vBytes or 2350 sats at 10sats/vByte.

    -> We can speed up the transaction by paying 20sats/vByte and we would still spend less sats than we would if we had made 3 individual transactions! 

    Downside

    By batching transactions by either combining inputs, outputs or both you will lose privacy. The blockchain will know that all the inputs are controlled by a single source. And that the outputs have been payed by that source. Not a big deal is the outputs are anonymous, but if one of the outputs is known this could become an issue.

    Back to blog

    Leave a comment

    Please note, comments need to be approved before they are published.