40

Do they just sit there unconfirmed (e.g. when you be evil and don't pay a tx fee) forever? Or do they get deleted after a few days?

2 Answers 2

29

Most clients on the network have a transaction pool in their memory. The same basically applies to miners: they just dump the top 500KB (or some other value) transactions into a block, sorted by transaction fee (descending, of course). When there aren't many transactions, maybe because of a series of block in a short amount of time, it will be confirmed anyway.

But to answer your actual question: yes, transactions (sort of) expire. When you send a transaction, it sends a tx frame to all connected peers. These peers store the transaction in their memory pools and tell all their connections that they have a new transaction. When those connections don't have it yet, they ask for it, and that's how a transaction spreads over the network.

At some point every node in the network will have the transaction in their memory pool, and at that point it will no longer be sent over the network. Now when a user restarts their client, the memory pool is wiped, and the transaction is deleted from that computer. (Plus a few other ways to delete transactions from the pool)

Because of that it's very unlikely for the transaction to be gone from the entire network, but in case it does happen: the reference client will automatically re-send the transaction every x hours(/minutes?) when it's still not confirmed.

Oh, and I forgot the most important part: transactions on Bitcoin (tx frames in the protocol) don't have a 'time' field, which means that transaction expiration can't be a feature of Bitcoin.

To summarize: yes, the transaction can expire, but that is really unlikely.

4
  • Thanks! If enough clients/miners remove a transaction from their memory pool, is it possible to make a transaction that over-writes that one (uses the same inputs) which will then get into a block? Then the first transaction would be deleted, right?
    – lurf jurv
    Apr 14, 2013 at 15:06
  • 1
    A new transaction will only be accepted into the pool if the previous one is no longer in that pool and not in a block either. As soon as it gets into a block, the entire pool is checked for conflicts again, and in that case the old transaction would be deleted. So yes, if enough nodes restart to clear a path for the new transaction, and a miner accepts the new transaction instead of the old one, the old transaction could be deleted. Apr 14, 2013 at 15:59
  • Doesn't a transaction basically "expire" by becoming invalid (e.g., when its UTXO(s) are spent)?
    – Geremia
    Feb 27, 2017 at 20:50
  • What about locktime? Isn't locktime like an expiry date for transactions?
    – Geremia
    Feb 28, 2017 at 1:30
7

I recently sent 0.03 BTC to Satoshi Dice without a tx fee from a blockchain.info wallet. It stayed for about 3 days without being confirmed and it finally expired. At some moments while the tx was unconfirmed the network propagation was dropping to 2 nodes and then going back up to about 50 nodes. After it expired the sum of the transaction was added back to my balance. Any details of the transaction disappeared from my wallet and from the block explorer... Several hours after the expiry a new transaction has been issued automatically with the same amount to the same Satoshi Dice address.

1
  • 3
    Regarding "a new transaction has been issued automatically with the same amount to the same Satoshi Dice address".. is this only happening for blockchain.info wallets?
    – Pacerier
    Apr 19, 2014 at 3:34

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