39

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?

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.

  • 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 '13 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. – Tom van der Woerdt Apr 14 '13 at 15:59
  • Doesn't a transaction basically "expire" by becoming invalid (e.g., when its UTXO(s) are spent)? – Geremia Feb 27 '17 at 20:50
  • What about locktime? Isn't locktime like an expiry date for transactions? – Geremia Feb 28 '17 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.

  • 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 '14 at 3:34

protected by Community Jan 14 '18 at 17:19

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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