Author

Topic: What happens if double-double spending happens? (Read 1233 times)

legendary
Activity: 3472
Merit: 4801
Thanks for clearing that up. I need to get my information from better sources..

Much of the confusion comes from the fact that it has become common to use the words "double spend" to mean something other than an actual double spend.

One of the truly innovative things that was accomplished with the creation of the bitcoin protocol was that it provided a decentralized way to make it impossible to double spend a digital asset. Prior to the creation of bitcoin, it was possible to use a digital signature system to provide a chain of custody proof that control of a digital asset was being transferred from one person to another.  However, it required a centralized "clearing house" to make sure that the digital asset wasn't duplicated and control of multiple copies of it wasn't turned over to multiple recipients.

Without the centralized clearing house, a malevolent entity could make an exact duplicate of the digital asset and then "spend" both copies.  There would be no way to determine which was the "valid" one, and which was the "invalid" copy.  Each recipient would receive an equally "valid" instance of the asset.

The bitcoin protocol uses a blockchain with a proof-of-work to create a public record of which transaction is the "valid" one.  Any other transaction that attempts to transfer control of the asset is "invalid", and this can be determined and proven by everyone that has access to the blockchain.  Nodes do not trust the information they receive. Every full node on the network validates every transaction they ever receive (and reject invalid transactions regardless of where they come from).  Every full node on the network validates every block that is ever receives (and rejects invalid blocks regardless of how much hash power was used to create it).  One of the "rules" of the protocol that is used to determine if a transaction is "valid" is that it cannot spend an input that has already been spent in an earlier block in the blockchain.  One of the "rules" of the protocol that is used to determine if a block is valid is that it cannot include any invalid transactions.

So, with a large enough share of the global hashpower, you could choose which of multiple transactions is the "valid" ONE.  You caould even go back a few blocks and remove a previously "valid" transaction, replacing it with a different transaction that spends the same inputs.  However, at any given time, you could only include ONE transaction in the blockchain that spends any given input, and during the time that any particular transaction is in the blockchain, it is the ONLY valid transaction spending that input.

Therefore, it is impossible for 2 (or more) transactions which both attempt to spend the same input to both be simultaneously in a "confirmed" state.  It will ALWAYS be publicly clear which transaction is the "valid" transaction at that moment.

What CAN happen with enough hash power is theft and fraud.  The entity with control of a large enough percentage of the global hash power could create a transaction to purchase a product or service.  Then they could wait for that transaction to receive enough confirmations for the merchant to feel comfortable providing the product or service.  Then they could go back and unconfirm the original transaction and in its place confirm a new transaction that sends the bitcoins to an address under the thief's control.  As such, they will have taken possession of the product or service without providing the agreed payment.  Although you may frequently hear people mistakenly describe this as a "double-spend" (possibly because there are two different transactions being created), it isn't truly a "double-spend" since the first transaction stops being valid when the replacement transaction is confirmed.

Another thing that can happen is that someone can broad cast multiple unconfirmed transactions that each share the same input. Although only one of these transactions will make it into the blockchain and be confirmed, until that happens it is impossible for the network to know which is the "valid" transaction.  If a merchant is willing to provide a product or service prior to a transaction receiving its first confirmation, then it can be possible to get the merchant to see the unconfirmed transaction that pays their address while getting a significant percentage of the global hash power to see an unconfirmed transaction spending the same input paying the thief's address.  This will occasionally be described as a "double-spend attempt" (since there are two competing transactions that are both "attempting" to be confirmed).  Only one of the two transactions will ever be confirmed though, so it isn't an actual "double-spend".
legendary
Activity: 2212
Merit: 1118
Lie down. Have a cookie
Double-spending can be achieved with a 51% hashrate attack.

No. it can't.

With control over a significant majority of the global hash power, it is possible to choose which VALID transactions get confirmed.  It is NOT possible to confirm two transactions that both spend the same bitcoins (that would be an INVALID transaction). Even with 100% of the hash power double-spending can not be achieved.

Meaning a corrupt player can confirm whatever they'd like and control the transactions.

No.  They can't confirm "whatever they'd like".  They can only confirm VALID transactions. If they attempt to confirm invalid transactions (such as a double spend), then the entire network will ignore their blocks.

That evildoer would have the "Best Chain" and the rest of the network would have to work to beat him.

It isn't enough to have the chain with the most proof of work.  They have to have a VALID chain with the most proof of work.

Thanks for clearing that up. I need to get my information from better sources..
legendary
Activity: 3472
Merit: 4801
Double-spending can be achieved with a 51% hashrate attack.

No. it can't.

With control over a significant majority of the global hash power, it is possible to choose which VALID transactions get confirmed.  It is NOT possible to confirm two transactions that both spend the same bitcoins (that would be an INVALID transaction). Even with 100% of the hash power double-spending can not be achieved.

Meaning a corrupt player can confirm whatever they'd like and control the transactions.

No.  They can't confirm "whatever they'd like".  They can only confirm VALID transactions. If they attempt to confirm invalid transactions (such as a double spend), then the entire network will ignore their blocks.

That evildoer would have the "Best Chain" and the rest of the network would have to work to beat him.

It isn't enough to have the chain with the most proof of work.  They have to have a VALID chain with the most proof of work.
copper member
Activity: 1498
Merit: 1528
No I dont escrow anymore.
For some reason it just doesn't seem to "sink in" that "you cannot double-spend Bitcoin at all".

If the Bitcoin system "actually allowed double-spending" then it would be 100% *useless* and would not have ever been known to anyone (as it would have solved *nothing at all*).

What is often called "double-spending" is just a problem of vendors wanting to accept txs before they have been confirmed enough times (the minimum being once although small re-orgs do happen regularly which is why more confirmations are generally recommended).

The blockchain will never accept a "double-spend" and the "best chain" is always the one with the most work so it will be up to the miners to end up deciding which txs are legit or are rejected in such scenarios (but you'll never find one single "double spend" in the history of the current blockchain).


Double-spending can be achieved with a 51% hashrate attack.

Nope it only allows you to reverse transactions. There is no way (with the current code) to use a single input in two confirmed(!) transactions.
legendary
Activity: 2212
Merit: 1118
Lie down. Have a cookie
For some reason it just doesn't seem to "sink in" that "you cannot double-spend Bitcoin at all".

If the Bitcoin system "actually allowed double-spending" then it would be 100% *useless* and would not have ever been known to anyone (as it would have solved *nothing at all*).

What is often called "double-spending" is just a problem of vendors wanting to accept txs before they have been confirmed enough times (the minimum being once although small re-orgs do happen regularly which is why more confirmations are generally recommended).

The blockchain will never accept a "double-spend" and the "best chain" is always the one with the most work so it will be up to the miners to end up deciding which txs are legit or are rejected in such scenarios (but you'll never find one single "double spend" in the history of the current blockchain).


Double-spending can be achieved with a 51% hashrate attack. Meaning a corrupt player can confirm whatever they'd like and control the transactions. That evildoer would have the "Best Chain" and the rest of the network would have to work to beat him.
legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
For some reason it just doesn't seem to "sink in" that "you cannot double-spend Bitcoin at all".

If the Bitcoin system "actually allowed double-spending" then it would be 100% *useless* and would not have ever been known to anyone (as it would have solved *nothing at all*).

What is often called "double-spending" is just a problem of vendors wanting to accept txs before they have been confirmed enough times (the minimum being once although small re-orgs do happen regularly which is why more confirmations are generally recommended).

The blockchain will never accept a "double-spend" and the "best chain" is always the one with the most work so it will be up to the miners to end up deciding which txs are legit or are rejected in such scenarios (but you'll never find one single "double spend" in the history of the current blockchain).
staff
Activity: 3458
Merit: 6793
Just writing some code
The 1 BTC will go to the transaction that is first confirmed. Most nodes will reject and not relay double spends. They will keep the first one that they see. So, if the first transaction is sent first, it will probably reach most of the network before the second is sent, thus the first transaction will confirm first. It really depends on which transaction reaches which miners first and whichever transaction that the miner who mines the next block includes. It WILL NOT double itself. There will only be 1 BTC spent and the double spent transaction will be dropped after the other is confirmed.
hero member
Activity: 854
Merit: 1009
JAYCE DESIGNS - http://bit.ly/1tmgIwK
What happens at this scenario

1) Wallet A sends 1 BTC to wallet B (before 1 confirm)

2) Wallet A double-sends 1 BTC to wallet C (before 1 confirm)

3) Wallet B sends the 1 BTC to walled D (before 1 confirm)

4) Wallet C sends the 1 BTC to wallet E (before 1 confirm)


Where will the 1 BTC go to? Will it double itself? Where will the destination of the 1 BTC go to, or if multiple destinations then specify please.

I`m just curous what happense in a double-double spend.
Jump to: