0

Let's say you got 1 BTC. And you do the following:

  • Send a transaction of 1 BTC to address A; fee: 1 sat/byte

If you'd only calculate what's in the blockchain, you'd still have a balance of 1 BTC. But if you also include the mempool you'd have a balance of 0.

Am I now able to send a second transaction, such as:

  • 1 BTC to address B, fee: 1000 sat/byte

The second transaction would likely be confirmed first; what would then happen to the first one? Would it simply be lost since now I don't have enough balance anymore?

1 Answer 1

2

All Bitcoin balances are held in separate uniquely identifiable unspent transaction outputs (). Transaction outputs are uniquely identified by their outpoint which is composed from the identifier of the transaction that created the output and the position in the transaction’s outputs (txid:output_position). When you create a transaction, you spend one or more UTXOs and create one or more UTXOs.

In this scenario, it sounds like you have your balance in a single UTXO that is spent by both transactions. Since each transaction output can only be spent once, these two transactions are in conflict. Only one of them can be included in the best chain. Assuming that both transactions have roughly the same transaction weight, miners would prefer the second transaction as the higher feerate would translate to the miner collecting a drastically higher fee. Once the second transaction is confirmed (included in a block), the first transaction would appear invalid to any nodes, because the UTXO consumed by the input is no longer available. If the first transaction is included in a block before the miner sees the second, the second would be invalid.

3
  • Wouldn't the UTXO be different since I'm sending to two different addresses?
    – Myzel394
    Commented Nov 26 at 21:10
  • 2
    No, the UTXO is consumed as an input. It is the same UTXO regardless of whatever outputs are created in the transaction in which that UTXO is referenced as an input. A UTXO used as an input is a reference like TXID 123...987 Output No. 7 pointing to an unsent output of an older transaction Commented Nov 27 at 0:08
  • I’ve expanded my answer to hopefully clarify that the conflict arises from the wallet starting with a single UTXO that is spent by both transactions.
    – Murch
    Commented Dec 2 at 16:03

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.