# Is something gained by double spending myself on a 51% attack?

I try to understand what consequences double spending may have.

Let's assume I own 51% of the network and own three bitcoins wallets. If I double spend the coins from Wallet A to B and C - would I have doubled my coins?

I know that they are not really doubled, but if no one would noticed, would I be able to e.g. send them to Coinbase wallet and convert the double amount to USD?

If not, how does an attacker actually make money from a double spending?

Double spending is not about doubling, but about using the same UTXO twice. So, you won't gain anything by double spending coins to yourself.

Let me explain you, with a simple example, how double-spending works:

Lets `Alice` be an attacker trying to double spend some coins. `Alice` goes to `Bob`'s store to buy some goods. In order to pay for the goods, she create a transaction, `TX1`, that spends from an UTXO from a previous transaction, `TX0`, and pays to `Bob`. Later on, `Alice` generates a second transaction, `TX2`, that also spends from `TX0` but this time pays back all the money to herself. Down bellow you can see the scenario depicted.

Now, `Alice` has multiples ways of double-spending the transaction, depending on her hash power and on whether `TX1` has been included in the blockchain or not. Since you assumed you have a 51% of the network hash power, we can assume that `Alice` can mine a block with a greater probability than anyone else, so we will take it for granted, an analyze only the other factor, what happens with `TX1`.

TX1 not confirmed

If we assume that `TX1` is still not confirmed, but it has been broadcast and the nodes are aware of it, `Alice` can double spend `TX1` with `TX2` by just including `TX2` in the next block she mines. If Bob has accepted the zero-confirmation transaction as a payment and has delivered the good to `Alice` before the inclusion of `TX1` in the blockchain, `Alice` will obtain both the goods and the double-spent amount.

TX1 confirmed

If `TX1` gets confirmed, either because, against the odds, another miner has mined a block in which the transaction was included before `Alice` mined hers, since `Alice` has the greater hash rate she can overcome the previous block by continue mining on the top of the previous block. This will create a blockchain fork, and eventually `Alice` branch will be longer than the other, since her hash rate is bigger. Notice that if `Alice` does that frequently lots of forks will occur, in which double-spending transaction could be identified, what will undermine the trust on the currency.

Last, being `Alice` the most powerful miner, she could just include double-spending transaction without forking the chain, by including a `TX2` in the same branch than `TX1` was included. Notice that this violates the blockchain inclusion rules, since two transactions can not spend from the same source. Therefore, the rest of the network will not accept this block as valid. However, since `Alice` has the greater hash power she can just keep going and mine over that block. In this case two things can happen, either the trust in the currency is lost since more of the 51% of the hash power is devoted to cheating, or the branch that includes both transactions is just ignored by the rest of the network.

In conclusion, no good comes from someone controlling such amount of hash power.

• What does it mean "will not releayed by the rest of the nodes"? I understand that I need to add a double-spend in the same block in order to succeed, is that correct? – shredding Jun 29 '17 at 18:01
• A block won't be valid if a transaction spends from the same source (UTXO) than a previous transaction. In the same way, two transactions included in the same block can not spend from the same source, if this happens the block will not be considered valid, since one of the transactions will double spend the other. – sr-gi Jun 29 '17 at 21:25
• But if this validation exists, how could i overcome it with 51? Wouldnt I just Produce invalid Blocks faster? – shredding Jun 30 '17 at 7:17
• I've updated the answer, maybe now it's clearer. – sr-gi Jun 30 '17 at 8:24
• Same block = reject. Different block but same block height = chain fork. Different block but different height (the doble spend is published after) = reject. – sr-gi Jun 30 '17 at 19:02

There is no reason to move coins to your wallets. You should purchase something valueable (a house + a car + a pet), and reorganize the blockchain from the point when the coins were in your wallet A. So, after all you have a house + a car + a pet plus coins in wallet. Proceed with step (1) again