How can an output be spent while the transaction is in mempool

I have seen transactions on a block explorer where the transaction is in mempool (unconfirmed) but one of the outputs already appears as spent, I am curious how this works. This question is a duplicate of this question, but the answer there doesn’t quite satisfy my confusion. I am thinking about how this process is permissible in conjunction with the protocol rules for ‘tx’ messages listed here, particularly rule 9, 10, 12.

  1. For each input, if the referenced output exists in any other tx in the pool, reject this transaction.

  2. For each input, look in the main branch and the transaction pool to find the referenced output transaction. If the output transaction
    is missing for any input, this will be an orphan transaction. Add to
    the orphan transactions, if a matching transaction is not in there

  1. For each input, if the referenced output does not exist (e.g. never existed or has already been spent), reject this transaction


  1. Part of what might be causing confusion is the definition of “spent” on the block explorer – when it claims an output is spent does this equate to “there exists a transaction at least in mempool that uses the output as an input”?
  2. The ability to broadcast a tx message that uses the output of an unconfirmed tx as an input seems to explicitly violate rule 9. Does it not?
  3. Rule 9 & 10 seem to be at odds with each other. Rule 9 says to reject if the output is in a tx in mempool, rule 10 says to check mempool for the output (as though it is permissible). Are they not?
  4. It is my belief that full nodes keep a “UTXO” set for validating some of these criterium – is the UTXO set updated once a transaction hits mempool (i.e not waiting for a confirmation)?
  5. Is mempool relative to one node? I.e, if I broadcast a transaction and a node accepts it as valid does it then pass the transaction around so that other nodes can add it to “their” mempool, or is there somehow a “central mempool” that any validated transaction can get sent to.
  6. Is it possible to cancel a tx message that has been added to mempool? I am not asking if typical software has this feature – but is it theoretically possible for a power user or is it “permissible behavior” within the bitcoin protocol.

bitcoin core – Trying to understand the mempool and how transactions are picked

Is one transaction only picked by one miner or is it possible, that more miners can pick the same transaction?

Miners can pick different transactions. There is no explicit coordination. When the rate of new transactions is low, it is likely that each miner will have the same set, or nearly the same set, of transactions to work with.

If only one miner can pick a transaction, what happens if this miner has weak hardware?

Not applicable. Each miner is free to pick whichever transactions they want. They have no knowledge of what other miners are working on.

If more miners can pick a transaction, what happens to the other miners(that couldnt calculate the hash first).

When they see another miner has produced a new block, the others stop their work and start on the next block based on the new block produced by the other miner. They first remove from their mempool any transactions included in the other miner’s new block.

Things are a little more complicated for mining pools. Members of a pool coordinate their work cooperatively. But you can think of each pool as a miner and the above applies.

mining pools – What unconfirmed transactions in Mempool get into a block?

I have a question regarding picking unconfirmed transactions from the mempool. Let’s say, there are 1000 transactions in the mempool. Can I randomly select some transactions, say, transaction a, b, c, d from them, and work on the nonce and create a new block? Is there any criteria about what transactions need to be in the next block?

Where in ~/.bitcoin are mempool and UTXO pools written?

Where in ~/.bitcoin are the two pools in question stored when their size grows above the size set by dbcache and maxmempool in bitcoin.conf.
Is UTXO pool written to such location at Bitcoin Core’s shutdown?

mempool – Unconfirmed transaction for 6 days now. need assistance for using CPFP

I have an unconfirmed transaction that has been sitting there for 6 days now.
The fees only got higher sins i’ve made the transaction and i do not feel comfortabel waiting.
I’m unable to use RBF sins trezor thus not support this and i’m nor sure on how to use CPFP
the TX is : 8b5032bcc435ebc612128fb66c30d85af19febd6f03dafb9114253dac6a9e0cf

After the transaction i’ve noticed that the recieving wallet is a legacy one, while i’ve send it from a segwit. could that cause any problems?

Is there any risk comming with waiting any longer?


bitcoin core – How long does it take for an unconfirmed transaction to drop from the mempool?

I have a transaction currently in unconfirmed limbo for 24+ hours. It was from an old 0.15 bitcoin core wallet, and I guess the fee was set too low. The old version of bitcoin-qt does not support replace by fee, so I have attempted to issue a double spend with higher fee. The double spend is not being picked up though, and the transaction id does not show up on any block viewer sites.

Will the original transaction drop from the mempool after a certain time period? Is there another way to issue the double spend to make it work and take precedence over the original?

mempool – Where can I find a survey on different fee estimation algorithms?

I am looking for a comparison or summary of different fee estimation algorithms. Does anyone know of one? I would like to see what the best starting point is in order to see where optimization can be done.

From a cursory search, there is documentation for Bitcoin Core’s fee estimation, but there are many other providers including APIs like Earn/Blockstream/Bitgo. They all provide estimates which are different from Bitcoin Core’s estimation. I am assuming that their mempool is similar but their algorithm is different.

For reference, so far I have found
John Newbery’s outline on Core’s fee estimation, a gist by Alex Morcos with a High level description Bitcoin Core’s fee estimation algorithm, and of course the Bitcoin Core code itself.

transaction fees – Can you explain some of the dynamics that drive the variations in mempool depth?

I often see mempool graphs such as Jochen Hoenicke’s that show significant fluctuations in mempool depth and hence the fee needed to get into upcoming blocks. Can you explain some of the dynamics that are driving these variations?

Should I be monitoring and understanding these graphs before making a transaction if I want to choose an opportune time to broadcast a lower fee transaction?

I have heard it is generally better to broadcast transactions at the weekend as there is less activity on the network. Is this a good rule of thumb such that I don’t need to monitor these graphs?

electrum – How can I troubleshoot whether an unconfirmed transaction that seems stuck is a problem on my end or just from high volume on mempool?

Never had transaction hang unconfirmed like this before. Granted its only been a few hours but it’s not like I skimped on fees either. I always choose the default electrum fee, but when it got stuck I doubled it using RBF to increase the fee.

But it’s still stuck!

How can I check whether I’m really in the queue being ignored because people are paying higher fees or if there’s something wrong I’m doing on my end?

Regenerating my wallet in electrum at least restored my pre-send balance. So at least I can see my coin even if there’s no movement on this transaction that I’d love to either cancel out of or see confirmed.

transactions – double spend the mempool to outbid an attacker

Many nodes today will not replace any transaction in their mempool with another transaction that spends the same inputs, making it difficult for spenders to adjust their previously-sent transactions to deal with unexpected confirmation delays or to perform other useful replacements.

First paragraph of ‘Abstract’ section in BIP 125

Maybe if the transaction had RBF enabled it would be helpful or if the transaction had a change address in outputs to try CPFP

Hackers are expected to use high fee rate, no RBF, no change address etc. although it’s not the case in lot of incidents that I have observed.