If somebody is sending bitcoin with low transaction charges after which sends the identical bitcoin with greater transaction charges earlier than the earlier one is confirmed, so it’s apparent that miners will choose the second
By default, the miner will not choose the second, besides the earlier one had Decide-in RBF enabled.
Nevertheless, technically or theoritically talking, a miner all the time has the power to select any transaction he likes into his block template, in order that he may mine such transaction(s) into his block. It is simply the matter of whether or not his block could be extensively accepted by the community (together with different miners, non-mining full nodes which the pockets relied on, and so on).
ethereum has nonce worth of every transaction which avoids this, however how does bitcoin keep away from it?
I do not know a lot about Ethereum. So far as I do know, the UTXO mannequin itself is the equal of the nonce worth, since every UTXO (uniquely recognized with TXID and output index) could possibly be spent solely as soon as, in any other case it could be an invalid transaction or block.
Observe that the nonce worth/UTXO mannequin and double spending by forking the chain are two distinct issues.
With out the nonce worth/UTXO mannequin, even a person chain itself can’t rule out double spending or replayed transactions, which is definitely inflation in bitcoin, or replay assault in ethereum (the replayed transaction would make the sufferer make one other surprising repeated fee, so he would lose cash).
Nevertheless, even with nonce worth/UTXO mannequin, the attacker can nonetheless produce forked chain to “rewrite the historical past” (in such case, the earlier transaction could be truly discarded, which typically means the earlier legit fee could be maliciously withdrawn), which is the explanation why we’d like a consensus mechanism like proof-of-work.