<p>The <a href="https://en.bitcoin.it/wiki/Double-spending#Finney_attack">Finney attack</a> is a variation of a double-spend attack. The attacker creates two transactions - one crediting the victim and one crediting themselves. They keep the first transaction for now and proceed to try mining the second one into a block. When they succeed (this may take awhile), they quickly make a purchase with the first transaction, get the goods they purchased, and then release the pre-mined block. This way the first transaction will become invalidated, even if it is propagated through the whole network.</p>

<p>This variant of double-spend attack is harder to execute (mining a block by oneself hasn't been easy for a long while), but is undetectable until it has been fully executed. The only way to protect oneself against such an attack is to require at least one confirmation for transaction before giving out purchased goods, and requiring more confirmations for transactions worth more.</p>

CC BY-SA 3.0
2014-05-22T18:25:51.473Z
Considering the bitcoin network is now so humongous, is the Finney attack purely theoretical? Are there any past records of the Finney attack suspected or happening?
Pacerier
CC BY-SA 3.0
2014-05-23T00:04:12.247Z
@Pacerier As far as I remember I heard that some mining pool was regularly using this against gaming websites like SatoshiDice. Essentially, you create a block with a transaction crediting yourself. You send a conflicting transaction to SD that can net you more than the block reward. If you lose, you release the block and get your money back. If you win, you discard the block and keep the winnings.
ThePiachu
CC BY-SA 3.0
2014-05-23T14:09:24.063Z
Wow, so SatoshiDice could be bankrupted by repeated acts of this?
Pacerier
CC BY-SA 3.0
2014-05-23T17:00:49.540Z
@Pacerier Yes, unless they switch over to only processing bets with 1+ confirmations.
ThePiachu
CC BY-SA 3.0
2014-05-23T17:03:45.397Z
Seems odd that no one has attacked SatoshiDice yet. It looks to be a really *tasty* target.
Pacerier
CC BY-SA 3.0
2014-05-24T06:18:19.293Z
@Pacerier maybe someone has, but maybe they are making enough money not to care. Beats me.
ThePiachu
CC BY-SA 3.0
2016-09-02T11:31:53.360Z
can you explain for me, why the first transaction will be invalidate. For example, you have 10 coins. you move 3 coins to yourself, and you buy other 3 coins. I see no conflict in here. thanks.
hqt
CC BY-SA 3.0
2016-09-07T10:13:46.307Z
@hqt If you send 3 coins to yourself and you sell the exact same 3 coins to someone else, only one of those transactions will go through. You aim to create a conflict and get it into a block.
ThePiachu
CC BY-SA 3.0
2016-09-07T10:15:55.953Z
@ThePiachu so the key point is `exactly that same 3 coins` (look like each coin has something similar like id). We can control this action ? thanks
hqt
CC BY-SA 3.0
2016-09-08T13:13:46.720Z
@hqt Read up on Bitcoin transactions, TxIDs, etc. You first need to understand how those work to understand why Finney Attack works.
ThePiachu
CC BY-SA 3.0
2018-03-09T19:42:47.137Z
@ThePiachu "If you win, you discard the block and keep the winnings." Why even discard can't we keep both, unless we will only get win money after transaction has been confirmed.. But the website that does not even see if transaction is confirmed and lets you place the bet, won't even try to confirm other thing too, am I right?
Suraj Jain
CC BY-SA 3.0
2018-03-09T22:00:41.273Z
@SurajJain the block you are mining doesn't have the transaction. It's meant to roll back what you did in case you lose. Otherwise it's not a finney attack
ThePiachu
CC BY-SA 3.0
2018-03-10T03:56:15.950Z
@ThePiachu I meant If I win and I have been credited money then Why discard the block that contain transaction to me, as that way I will get my money also back which I used on bet, I mean why not roll even after I win, will get to keep both
Suraj Jain
CC BY-SA 3.0
2018-03-11T04:51:50.677Z
@SurajJain You are creating a block WITHOUT the transaction. If you LOSE, you release your block, thus cancelling the bet. If you WIN, you discard the block and keep the winnings.
ThePiachu
CC BY-SA 3.0
2018-03-11T06:19:28.893Z
Does after winning they would check the transaction to be confirmed before giving price?
Suraj Jain
CC BY-SA 3.0
2018-03-11T06:20:08.050Z
I thought we would get winning price instantly and then we would release that block so we also get to keep the money we spent on the bet.
Suraj Jain
CC BY-SA 3.0
2012-10-03T09:14:02.593Z
2012-10-03T09:14:02.593Z
ThePiachu
<p>The Finney attack is named after <a href="http://en.wikipedia.org/wiki/Hal_Finney_%28cypherpunk%29" rel="noreferrer">Hal Finney</a>, who suggested it in <a href="https://bitcointalk.org/index.php?topic=3441.msg48384#msg48384" rel="noreferrer">this comment</a>. (Hal happens to be the first recipient of a Bitcoin transaction, and the first person to comment on the release of the Bitcoin source code.)</p>

<p>It is a <a href="https://en.bitcoin.it/wiki/Double-spending#Finney_attack" rel="noreferrer">double spending</a> attack with the following features:</p>

<ul>
<li><p>It only works if the merchant accepts unconfirmed transactions.</p></li>
<li><p>It still works, however, if the merchant waits a few seconds to
verify that everyone in the network agrees he was paid.</p></li>
<li><p>It requires the attacker to be mining and controlling the content of
his blocks; however, he can in theory do this with any hashrate, in particular significantly less than 50% of the network hashrate.</p></li>
</ul>

<p>It proceeds as follows:</p>

<ol>
<li><p>The attacker mines blocks normally; in the block he is trying to find, he includes a transaction which sends some of his coins back to himself, without broadcasting this transaction.</p></li>
<li><p>When he finds a block, he does not broadcast it; instead, he sends the same coins to a merchant for some goods or service.</p></li>
<li><p>After the merchants accepts the payment and irreversibly provides the service, the attacker broadcasts his block; the transaction that sends the coins to himself, included in this block, will override the unconfirmed payment to the merchant.</p></li>
</ol>

<p>If the time from finding the block until the attacker sends payment and the merchant accepts it is t, and the average time to find a block is T, there is a probability of t/T that another block will be found on the network in this time; in this case the attack will fail, <em>and</em> the attacker will lose the block reward of B.</p>

<p>This means that the average cost of attempting the attack is about (t/T) * B; as a rule of thumb the merchant should wait at least t=V*T/B (V is the value of the transaction), to make sure that trying to carry out this attack against him isn't profitable; this may not be sufficient though, as a nimble attacker can use the same block for multiple attacks, potentially gaining the total of their value.</p>

<p>Clearly, the lower the attacker's hashrate, the less opportunities he has to carry out the attack. If the attack is for obtaining some illiquid good, it is difficult to make the need for this good coincide with finding a block. If the attack is for obtaining something liquid (e.g. exchanging bitcoins for other money), an opportunity is ever-present but the merchant is likely to require a few confirmations. This makes the attack difficult to use in practice.</p>

CC BY-SA 3.0
2012-10-04T11:11:47.030Z
2017-10-30T13:02:10.197Z
2017-10-30T13:02:10.197Z
Meni Rosenfeld
<p>What is a Finney attack? Extra points for explaining its purpose, the prerequisites for it to be possible, how the attack can be performed and the origin of the name "Finney attack".</p>

<transactions><security><doublespend><attack><finney-attack>
What is a Finney attack?
Dr.Haribo
# What is a Finney attack?

(Asked by: username_0 on 2012-10-03)

What is a Finney attack? Extra points for explaining its purpose, the prerequisites for it to be possible, how the attack can be performed and the origin of the name "Finney attack".

**Tags:** transactions, security, doublespend, attack, finney-attack


---

## 2 answers

### Answer by username_5 on 2012-10-04. Score: 51 | Accepted answer

The Finney attack is named after [Hal Finney](http://en.wikipedia.org/wiki/Hal_Finney_%28cypherpunk%29), who suggested it in [this comment](https://bitcointalk.org/index.php?topic=3441.msg48384#msg48384). (Hal happens to be the first recipient of a Bitcoin transaction, and the first person to comment on the release of the Bitcoin source code.)

It is a [double spending](https://en.bitcoin.it/wiki/Double-spending#Finney_attack) attack with the following features:

* It only works if the merchant accepts unconfirmed transactions.
* It still works, however, if the merchant waits a few seconds to
  verify that everyone in the network agrees he was paid.
* It requires the attacker to be mining and controlling the content of
  his blocks; however, he can in theory do this with any hashrate, in particular significantly less than 50% of the network hashrate.

It proceeds as follows:

1. The attacker mines blocks normally; in the block he is trying to find, he includes a transaction which sends some of his coins back to himself, without broadcasting this transaction.
2. When he finds a block, he does not broadcast it; instead, he sends the same coins to a merchant for some goods or service.
3. After the merchants accepts the payment and irreversibly provides the service, the attacker broadcasts his block; the transaction that sends the coins to himself, included in this block, will override the unconfirmed payment to the merchant.

If the time from finding the block until the attacker sends payment and the merchant accepts it is t, and the average time to find a block is T, there is a probability of t/T that another block will be found on the network in this time; in this case the attack will fail, *and* the attacker will lose the block reward of B.

This means that the average cost of attempting the attack is about (t/T) \* B; as a rule of thumb the merchant should wait at least t=V\*T/B (V is the value of the transaction), to make sure that trying to carry out this attack against him isn't profitable; this may not be sufficient though, as a nimble attacker can use the same block for multiple attacks, potentially gaining the total of their value.

Clearly, the lower the attacker's hashrate, the less opportunities he has to carry out the attack. If the attack is for obtaining some illiquid good, it is difficult to make the need for this good coincide with finding a block. If the attack is for obtaining something liquid (e.g. exchanging bitcoins for other money), an opportunity is ever-present but the merchant is likely to require a few confirmations. This makes the attack difficult to use in practice.


---

### Answer by username_1 on 2012-10-03. Score: 17

The [Finney attack](https://en.bitcoin.it/wiki/Double-spending#Finney_attack) is a variation of a double-spend attack. The attacker creates two transactions - one crediting the victim and one crediting themselves. They keep the first transaction for now and proceed to try mining the second one into a block. When they succeed (this may take awhile), they quickly make a purchase with the first transaction, get the goods they purchased, and then release the pre-mined block. This way the first transaction will become invalidated, even if it is propagated through the whole network.

This variant of double-spend attack is harder to execute (mining a block by oneself hasn't been easy for a long while), but is undetectable until it has been fully executed. The only way to protect oneself against such an attack is to require at least one confirmation for transaction before giving out purchased goods, and requiring more confirmations for transactions worth more.

> **Comments:**
> **username_2**: Considering the bitcoin network is now so humongous, is the Finney attack purely theoretical? Are there any past records of the Finney attack suspected or happening?  
> **username_1**: @username_2 As far as I remember I heard that some mining pool was regularly using this against gaming websites like SatoshiDice. Essentially, you create a block with a transaction crediting yourself. You send a conflicting transaction to SD that can net you more than the block reward. If you lose, you release the block and get your money back. If you win, you discard the block and keep the winnings.  
> **username_2**: Wow, so SatoshiDice could be bankrupted by repeated acts of this?  
> **username_1**: @username_2 Yes, unless they switch over to only processing bets with 1+ confirmations.  
> **username_2**: Seems odd that no one has attacked SatoshiDice yet. It looks to be a really *tasty* target.  
> **username_1**: @username_2 maybe someone has, but maybe they are making enough money not to care. Beats me.  
> **username_3**: can you explain for me, why the first transaction will be invalidate. For example, you have 10 coins. you move 3 coins to yourself, and you buy other 3 coins. I see no conflict in here. thanks.  
> **username_1**: @username_3 If you send 3 coins to yourself and you sell the exact same 3 coins to someone else, only one of those transactions will go through. You aim to create a conflict and get it into a block.  
> **username_3**: @username_1 so the key point is `exactly that same 3 coins` (look like each coin has something similar like id). We can control this action ? thanks  
> **username_1**: @username_3 Read up on Bitcoin transactions, TxIDs, etc. You first need to understand how those work to understand why Finney Attack works.  
> **username_4**: @username_1 "If you win, you discard the block and keep the winnings." Why even discard can't we keep both, unless we will only get win money after transaction has been confirmed.. But the website that does not even see if transaction is confirmed and lets you place the bet, won't even try to confirm other thing too, am I right?  
> **username_1**: @username_4 the block you are mining doesn't have the transaction. It's meant to roll back what you did in case you lose. Otherwise it's not a finney attack  
> **username_4**: @username_1 I meant If I win and I have been credited money then Why discard the block that contain transaction to me, as that way I will get my money also back which I used on bet, I mean why not roll even after I win, will get to keep both  
> **username_1**: @username_4 You are creating a block WITHOUT the transaction. If you LOSE, you release your block, thus cancelling the bet. If you WIN, you discard the block and keep the winnings.  
> **username_4**: Does after winning they would check the transaction to be confirmed before giving price?  
> **username_4**: I thought we would get winning price instantly and then we would release that block so we also get to keep the money we spent on the bet.  

---

