Link Search Menu Expand Document
Satoshi's Archive
Bitcoin Whitepaper
Wei Dai
Citation of your b-money page - 2008-08-22 16:38
Re: Citation of your b-money page - 2009-01-10 11:17
Cryptography Mailing List
Bitcoin P2P e-cash paper - 2008-10-31 18:10:00 UTC
Bitcoin v0.1 released - 2009-01-08 19:27:40 UTC
[bitcoin-list]
[bitcoin-list] Welcome - 2008-12-10 17:00:23 UTC
[bitcoin-list] Bitcoin v0.1.2 now available - 2009-01-11 22:32:18 UTC
[bitcoin-list] Bitcoin v0.1 Alpha release notes - 2009-01-12 20:20:47 UTC
[bitcoin-list] Bitcoin v0.1.3 - 2009-01-12 22:48:23 UTC
Re: [bitcoin-list] Bitcoin v0.1 released - 2009-01-16 18:35:32 UTC
Re: [bitcoin-list] Problems - 2009-01-25 16:45:25 UTC
[bitcoin-list] Bitcoin v0.1.5 released - 2009-02-04 19:46:04 UTC
Re: [bitcoin-list] Bitcoin v0.1.5 released - 2009-02-22 17:47:52 UTC
Re: [bitcoin-list] Does Bitcoin Crash in Windows? - 2009-10-23 23:57:51 UTC
[bitcoin-list] Bitcoin 0.2 released - 2009-12-17 06:52:09 UTC
[bitcoin-list] Bitcoin 0.3 released! - 2010-07-06 21:53:53 UTC
[bitcoin-list] Alert: upgrade to bitcoin 0.3.6 - 2010-07-30 06:02:38 UTC
[bitcoin-list] ALERT - we are investigating a problem - 2010-08-15 20:38:33 UTC
[bitcoin-list] Bitcoin 0.3.18 is released - 2010-12-08 23:11:55 UTC
Gavin Andresen
Satoshi's Last Email - 2011-04-26
Mike Hearn
Re: Questions about BitCoin - 2009-04-12 22:44
Re: Lack of chargeback support - 2009-04-27 12:11
Re: More BitCoin questions - 2010-12-29 22:42
Re: Open sourced my Java SPV impl - 2011-03-09 17:15
Re: Holding coins in an unspendable state for a rolling time window - 2011-04-20 11:39
Laszlo Hanec
Satoshi Emails Laszlo Hanec
[p2p-research]
Bitcoin open source implementation of P2P currency - 2009-02-11 23:30:54 CET
Re: [p2p-research] Bitcoin open source implementation of P2P - 2009-02-12 19:01:24 +0000
[p2p-research] Bitcoin P2P e-currency v0.1 released - 2009-02-13 19:45:28 +0100
Jon Matonis
Re: Introduction - 2010-03-04 21:55
Hal Finney
Bitcoin v0.1 - 2008-01-08 20:54:55 +0000
Dustin Trammel
Re: Bitcoin v0.1 released - 2009-01-12 18:52:45 +0000
Re: A few thoughts... - 2009-01-15 19:46:35 +0000
Re: Bitcoin Transfer - 2009-01-18 17:01:09 +0000
Bitcoin open source implementation of P2P currency - 2009-02-11 22:27:00 UTC
Welcome to the new Bitcoin forum! - 2009-11-22 18:04:28 UTC
Repost: Bitcoin Maturation - 2009-11-22 18:31:44 UTC
Request: Make this anonymous? - 2009-11-22 18:32:00 UTC
Re: Repost: Bitcoin Maturation - 2009-11-22 18:34:21 UTC
Re: Repost: Request: Make this anonymous? - 2009-11-22 18:35:15 UTC
Repost: How anonymous are bitcoins? - 2009-11-25 18:15:57 UTC
Re: Repost: How anonymous are bitcoins? - 2009-11-25 18:17:23 UTC
Repost: Linux/UNIX compile - 2009-11-27 17:17:22 UTC
Re: Repost: Linux/UNIX compile - 2009-11-27 17:27:09 UTC
[OLD THREAD] Bitcoin version 0.2 development status - 2009-11-27 22:48:39 UTC
Re: A few suggestions - 2009-12-09 18:45:10 UTC
Re: Questions about Bitcoin - 2009-12-10 20:49:02 UTC
Bitcoin 0.2 released! - 2009-12-16 22:45:36 UTC
Re: Is my second Transaction working correctly? +Transfer Question - 2010-01-05 20:00:46 UTC
Re: 64bit support - 2010-01-14 20:17:20 UTC
Re: Number of connections? - 2010-01-20 20:07:15 UTC
Re: TOR and I2P - 2010-01-20 22:05:28 UTC
Re: Bitcoin crash when sending coins - 2010-01-27 21:52:27 UTC
Re: A newb's test - anyone want to buy a picture for $1? - 2010-01-28 01:01:48 UTC
Re: Blocks never stop generating? - 2010-01-28 01:08:33 UTC
Re: Payment server - 2010-01-28 23:26:09 UTC
Re: Win32 CPU Cycles vs 'Live Protection' Engines ? - 2010-02-03 23:36:54 UTC
Re: Questions about Addresses - 2010-02-04 00:07:07 UTC
Proof-of-work difficulty increasing - 2010-02-05 19:19:12 UTC
Re: How divisible are bitcoins and other market/economic questions - 2010-02-06 23:25:53 UTC
Re: Make your "we accept Bitcoin" logo - 2010-02-08 01:22:29 UTC
Bitcoin client and website translation - 2010-02-08 01:27:02 UTC
Re: Simple to implement feature requests - 2010-02-08 16:37:24 UTC
Re: DEB Package? - 2010-02-12 02:33:02 UTC
Re: What's with this odd generation? - 2010-02-12 03:08:08 UTC
Re: Proof-of-work difficulty increasing - 2010-02-15 06:28:38 UTC
Re: Setting up multiple bitcoin machines behind NAT - 2010-02-16 01:34:56 UTC
Re: Bitcoin client and website translation - 2010-02-17 19:19:43 UTC
Re: Number of connections - 2010-02-21 03:43:48 UTC
Post your static IP - 2010-02-21 04:19:53 UTC
Re: Current Bitcoin economic model is unsustainable - 2010-02-21 05:44:24 UTC
UI improvements - 2010-02-21 21:48:01 UTC
Re: generation slowed down dramatically - 2010-02-23 00:49:56 UTC
Re: UI improvements - 2010-02-23 01:16:28 UTC
Re: Bitcoin Address Collisions - 2010-02-23 16:26:09 UTC
Command Line and JSON-RPC - 2010-02-23 22:15:41 UTC
Re: URI-scheme for bitcoin - 2010-02-24 05:57:43 UTC
Re: Command Line and JSON-RPC - 2010-02-24 06:17:23 UTC
New icon/logo - 2010-02-24 21:24:23 UTC
Re: New icon/logo - 2010-02-25 01:56:24 UTC
Re: wxWidgets 2.9.0 - 2010-02-27 21:22:53 UTC
Re: Money Transfer Regulations - 2010-03-03 04:28:56 UTC
Re: bitcoin auto-renice-ing - 2010-03-15 18:44:12 UTC
Idea for file hosting and proxy services - 2010-03-15 19:16:56 UTC
Re: On IRC bootstrapping - 2010-03-16 19:48:47 UTC
Re: Idea for file hosting service - 2010-03-16 20:17:34 UTC
Re: who is bitcoin.com - 2010-03-23 15:22:41 UTC
Re: Exchange Methods - 2010-03-23 17:35:34 UTC
Re: Idea for file hosting and proxy services - 2010-03-24 18:01:57 UTC
Re: Could the bitcoin network be destroyed by someone generating endless bitcoin add - 2010-05-16 21:01:44 UTC
Re: For a website taking payments with bitcoins, better: IP or bitcoin addresses? - 2010-05-16 21:37:36 UTC
Re: Exception: 9key_error error - 2010-05-16 22:53:59 UTC
Re: removing bitcoin addresses - 2010-05-16 23:34:40 UTC
Re: Is there a way to automate bitcoin payments for a website? - 2010-05-18 02:58:11 UTC
Re: Ummmm... where did my bitcoins go? - 2010-05-18 20:06:46 UTC
Re: We accept Bitcoins - 2010-05-20 21:43:42 UTC
JSON-RPC programming tips using labels - 2010-05-26 18:27:25 UTC
Re: Tracing a coin's lineage - 2010-05-26 18:51:04 UTC
Re: CLI bitcoin generation - 2010-05-26 20:09:34 UTC
Re: Share database blocks ? - 2010-05-26 20:34:34 UTC
Re: Website translations - 2010-05-26 21:16:34 UTC
Re: Odd amount of generated coins - 2010-05-26 21:34:32 UTC
Re: Hostnames instead of IP Addresses - 2010-06-02 18:18:15 UTC
Re: Dealing with SHA-256 Collisions - 2010-06-14 20:39:50 UTC
Re: Technical clarifications - 2010-06-14 22:21:55 UTC
Re: Can't Build r80 from SVN - 2010-06-14 22:40:14 UTC
Re: What is the incentive to collect transactions? - 2010-06-15 23:41:29 UTC
Re: new binary release? - 2010-06-17 17:07:56 UTC
Re: Transactions and Scripts: DUP HASH160 ... EQUALVERIFY CHECKSIG - 2010-06-17 18:46:08 UTC
Re: Get 5 free bitcoins from freebitcoins.appspot.com - 2010-06-18 23:08:34 UTC
Re: Bitcoin in Ubuntu 10.04 - 2010-06-21 17:20:21 UTC
Re: Dying bitcoins - 2010-06-21 17:48:26 UTC
0.3 almost ready -- please test the Mac version! - 2010-06-22 04:01:53 UTC
Re: How fast do the fastest computers generate bitcoins? - 2010-06-22 04:35:26 UTC
Re: 0.3 almost ready - 2010-06-22 17:02:07 UTC
Re: Bitcoin clients getting k-lined from the IRC bootstrapping channel - 2010-06-25 21:15:15 UTC
Beta? - 2010-06-26 17:02:43 UTC
Re: Bitcoin mobile. - 2010-06-26 20:58:26 UTC
Re: Building BitCoin Client completely Headless - 2010-06-26 21:06:06 UTC
Re: Bitcoin Faucet changes - 2010-06-26 21:39:52 UTC
Re: Beta? - 2010-06-27 12:43:50 UTC
Re: IPv6, headless client, and more - 2010-06-27 13:02:38 UTC
Re: Major Meltdown - 2010-06-27 19:06:09 UTC
Re: Feature Request: Limiting Connections - 2010-07-02 19:21:36 UTC
Re: 0.3 almost ready -- please test the Mac version! - 2010-07-04 21:52:28 UTC
Re: Slashdot Submission for 1.0 - 2010-07-05 21:31:14 UTC
Re: 0.3 almost ready -- please test the Mac version!! - 2010-07-06 19:43:18 UTC
Re: bitcoin 0.3 win64 - broken access to APPDATA if non-latin characters in username - 2010-07-08 18:24:19 UTC
Re: Anonymity - 2010-07-08 19:12:00 UTC
Re: BTC Vulnerability? (Massive Attack against BTC system. Is it really?) - 2010-07-09 03:28:46 UTC
Re: bitcoin 0.3 win64 - broken access to APPDATA if non-latin characters in username) - 2010-07-09 15:37:05 UTC
Re: Security - 2010-07-10 12:58:02 UTC
Re: No blocks downloaded... why? - 2010-07-14 16:22:03 UTC
Re: resource hog - 2010-07-14 16:29:39 UTC
Re: stopped prodicing coins - 2010-07-14 17:04:02 UTC
Re: Building Bitcoin 0.3 - 2010-07-14 17:34:50 UTC
Re: Stuck on 513 blocks - 2010-07-14 18:02:28 UTC
Re: Error on Ubuntu 10.04 - 2010-07-14 18:25:41 UTC
Re: Runaway CPU usage for 64bit BitCoin (Linux Client) - 2010-07-14 18:45:53 UTC
Re: Warning this block was not received by any other nodes - 2010-07-14 18:56:29 UTC
Re: Hash/sec Throttling for Democracy - 2010-07-14 20:25:06 UTC
Re: Scalability - 2010-07-14 21:10:52 UTC
Re: [Bitcoin 0.3.0] Runtime error - 2010-07-15 14:05:20 UTC
Re: Static Linux x86_64 bins for those having libcrypto troubles - 2010-07-15 14:33:04 UTC
Bitcoin 0.3.1 released - 2010-07-15 17:05:54 UTC
Re: 0.3.1 release candidate, please test - 2010-07-15 17:23:48 UTC
Re: Website and software translations - 2010-07-15 18:30:22 UTC
Re: Website and software translationss - 2010-07-15 18:37:13 UTC
Re: 'SetIcons(): icon bundle doesn't contain any suitable icon' - 2010-07-15 22:18:26 UTC
Re: Donations to freebitcoins.appspot.com needed! - 2010-07-16 02:02:07 UTC
Re: Assertion Failure - Ubuntu Lucid - 2010-07-16 14:52:04 UTC
Re: Fedora 13 libcrypto - 2010-07-16 14:55:23 UTC
Re: Resending transaction - 2010-07-16 15:01:33 UTC
Re: Source code documentation - 2010-07-16 15:37:00 UTC
Re: Hash() function not secure - 2010-07-16 16:13:53 UTC
Re: Request: expected bitcoins per day display - 2010-07-16 16:47:14 UTC
Re: bitcoin trademark? - 2010-07-16 17:47:05 UTC
Re: The dollar cost of bitmining energy - 2010-07-16 17:58:44 UTC
Re: Website integration for bitcoin - 2010-07-16 18:23:04 UTC
Sample account system using JSON-RPC needed - 2010-07-16 19:45:10 UTC
Re: Bitcoin 0.3.1 released - 2010-07-16 21:06:57 UTC
Re: A New Currency System for the World - 2010-07-16 22:20:09 UTC
Re: BUG Report: Rounding glitch - 2010-07-17 16:06:12 UTC
Re: Privacy versus Safety: handling change - 2010-07-17 16:27:39 UTC
Re: Nenolod, the guy that wants to prove Bitcoin doesn't work. - 2010-07-17 16:56:06 UTC
Re: Bitcoin snack machine (fast transaction problem) - 2010-07-17 22:29:13 UTC
2. Transactions
3. Timestamp Server
4. Proof-of-Work
5. Network
6. Incentive
7. Reclaiming Disk Space
8. Simplified Payment Verification
9. Combining and Splitting Value
11. Calculations
Bitcoin: A Peer-to-Peer Electronic Cash System
A purely peer-to-peer version of electronic cash would allow online payments to be sent directly from one party to another without going through a financial institution. Digital signatures provide part of the solution, but the main benefits are lost if a trusted third party is still required to prevent double-spending. We propose a solution to the double-spending problem using a peer-to-peer network. The network timestamps transactions by hashing them into an ongoing chain of hash-based proof-of-work, forming a record that cannot be changed without redoing the proof-of-work. The longest chain not only serves as proof of the sequence of events witnessed, but proof that it came from the largest pool of CPU power. As long as a majority of CPU power is controlled by nodes that are not cooperating to attack the network, they'll generate the longest chain and outpace attackers. The network itself requires minimal structure. Messages are broadcast on a best effort basis, and nodes can leave and rejoin the network at will, accepting the longest proof-of-work chain as proof of what happened while they were gone.
Commerce on the Internet has come to rely almost exclusively on financial institutions serving as trusted third parties to process electronic payments. While the system works well enough for most transactions, it still suffers from the inherent weaknesses of the trust based model. Completely non-reversible transactions are not really possible, since financial institutions cannot avoid mediating disputes. The cost of mediation increases transaction costs, limiting the minimum practical transaction size and cutting off the possibility for small casual transactions, and there is a broader cost in the loss of ability to make non-reversible payments for non-reversible services. With the possibility of reversal, the need for trust spreads. Merchants must be wary of their customers, hassling them for more information than they would otherwise need. A certain percentage of fraud is accepted as unavoidable. These costs and payment uncertainties can be avoided in person by using physical currency, but no mechanism exists to make payments over a communications channel without a trusted party.
What is needed is an electronic payment system based on cryptographic proof instead of trust, allowing any two willing parties to transact directly with each other without the need for a trusted third party. Transactions that are computationally impractical to reverse would protect sellers from fraud, and routine escrow mechanisms could easily be implemented to protect buyers. In this paper, we propose a solution to the double-spending problem using a peer-to-peer distributed timestamp server to generate computational proof of the chronological order of transactions. The system is secure as long as honest nodes collectively control more CPU power than any cooperating group of attacker nodes.
We define an electronic coin as a chain of digital signatures. Each owner transfers the coin to the next by digitally signing a hash of the previous transaction and the public key of the next owner and adding these to the end of the coin. A payee can verify the signatures to verify the chain of ownership.
The problem of course is the payee can't verify that one of the owners did not double-spend the coin. A common solution is to introduce a trusted central authority, or mint, that checks every transaction for double spending. After each transaction, the coin must be returned to the mint to issue a new coin, and only coins issued directly from the mint are trusted not to be double-spent. The problem with this solution is that the fate of the entire money system depends on the company running the mint, with every transaction having to go through them, just like a bank.
We need a way for the payee to know that the previous owners did not sign any earlier transactions. For our purposes, the earliest transaction is the one that counts, so we don't care about later attempts to double-spend. The only way to confirm the absence of a transaction is to be aware of all transactions. In the mint based model, the mint was aware of all transactions and decided which arrived first. To accomplish this without a trusted party, transactions must be publicly announced[1], and we need a system for participants to agree on a single history of the order in which they were received. The payee needs proof that at the time of each transaction, the majority of nodes agreed it was the first received.
The solution we propose begins with a timestamp server. A timestamp server works by taking a hash of a block of items to be timestamped and widely publishing the hash, such as in a newspaper or Usenet post[2-5]. The timestamp proves that the data must have existed at the time, obviously, in order to get into the hash. Each timestamp includes the previous timestamp in its hash, forming a chain, with each additional timestamp reinforcing the ones before it.
To implement a distributed timestamp server on a peer-to-peer basis, we will need to use a proof-of-work system similar to Adam Back's Hashcash[6], rather than newspaper or Usenet posts. The proof-of-work involves scanning for a value that when hashed, such as with SHA-256, the hash begins with a number of zero bits. The average work required is exponential in the number of zero bits required and can be verified by executing a single hash.
For our timestamp network, we implement the proof-of-work by incrementing a nonce in the block until a value is found that gives the block's hash the required zero bits. Once the CPU effort has been expended to make it satisfy the proof-of-work, the block cannot be changed without redoing the work. As later blocks are chained after it, the work to change the block would include redoing all the blocks after it.
The proof-of-work also solves the problem of determining representation in majority decision making. If the majority were based on one-IP-address-one-vote, it could be subverted by anyone able to allocate many IPs. Proof-of-work is essentially one-CPU-one-vote. The majority decision is represented by the longest chain, which has the greatest proof-of-work effort invested in it. If a majority of CPU power is controlled by honest nodes, the honest chain will grow the fastest and outpace any competing chains. To modify a past block, an attacker would have to redo the proof-of-work of the block and all blocks after it and then catch up with and surpass the work of the honest nodes. We will show later that the probability of a slower attacker catching up diminishes exponentially as subsequent blocks are added.
To compensate for increasing hardware speed and varying interest in running nodes over time, the proof-of-work difficulty is determined by a moving average targeting an average number of blocks per hour. If they're generated too fast, the difficulty increases.
The steps to run the network are as follows:
New transactions are broadcast to all nodes.
Each node collects new transactions into a block. 3.Each node works on finding a difficult proof-of-work for its block.
When a node finds a proof-of-work, it broadcasts the block to all nodes.
Nodes accept the block only if all transactions in it are valid and not already spent.
Nodes express their acceptance of the block by working on creating the next block in the chain, using the hash of the accepted block as the previous hash.
Nodes always consider the longest chain to be the correct one and will keep working on extending it. If two nodes broadcast different versions of the next block simultaneously, some nodes may receive one or the other first. In that case, they work on the first one they received, but save the other branch in case it becomes longer. The tie will be broken when the next proof-of-work is found and one branch becomes longer; the nodes that were working on the other branch will then switch to the longer one.
New transaction broadcasts do not necessarily need to reach all nodes. As long as they reach many nodes, they will get into a block before long. Block broadcasts are also tolerant of dropped messages. If a node does not receive a block, it will request it when it receives the next block and realizes it missed one.
By convention, the first transaction in a block is a special transaction that starts a new coin owned by the creator of the block. This adds an incentive for nodes to support the network, and provides a way to initially distribute coins into circulation, since there is no central authority to issue them. The steady addition of a constant of amount of new coins is analogous to gold miners expending resources to add gold to circulation. In our case, it is CPU time and electricity that is expended.
The incentive can also be funded with transaction fees. If the output value of a transaction is less than its input value, the difference is a transaction fee that is added to the incentive value of the block containing the transaction. Once a predetermined number of coins have entered circulation, the incentive can transition entirely to transaction fees and be completely inflation free.
The incentive may help encourage nodes to stay honest. If a greedy attacker is able to assemble more CPU power than all the honest nodes, he would have to choose between using it to defraud people by stealing back his payments, or using it to generate new coins. He ought to find it more profitable to play by the rules, such rules that favour him with more new coins than everyone else combined, than to undermine the system and the validity of his own wealth.
Once the latest transaction in a coin is buried under enough blocks, the spent transactions before it can be discarded to save disk space. To facilitate this without breaking the block's hash, transactions are hashed in a Merkle Tree [7][2][5], with only the root included in the block's hash. Old blocks can then be compacted by stubbing off branches of the tree. The interior hashes do not need to be stored.
A block header with no transactions would be about 80 bytes. If we suppose blocks are generated every 10 minutes, 80 bytes * 6 * 24 * 365 = 4.2MB per year. With computer systems typically selling with 2GB of RAM as of 2008, and Moore's Law predicting current growth of 1.2GB per year, storage should not be a problem even if the block headers must be kept in memory.
It is possible to verify payments without running a full network node. A user only needs to keep a copy of the block headers of the longest proof-of-work chain, which he can get by querying network nodes until he's convinced he has the longest chain, and obtain the Merkle branch linking the transaction to the block it's timestamped in. He can't check the transaction for himself, but by linking it to a place in the chain, he can see that a network node has accepted it, and blocks added after it further confirm the network has accepted it.
As such, the verification is reliable as long as honest nodes control the network, but is more vulnerable if the network is overpowered by an attacker. While network nodes can verify transactions for themselves, the simplified method can be fooled by an attacker's fabricated transactions for as long as the attacker can continue to overpower the network. One strategy to protect against this would be to accept alerts from network nodes when they detect an invalid block, prompting the user's software to download the full block and alerted transactions to confirm the inconsistency. Businesses that receive frequent payments will probably still want to run their own nodes for more independent security and quicker verification.
Although it would be possible to handle coins individually, it would be unwieldy to make a separate transaction for every cent in a transfer. To allow value to be split and combined, transactions contain multiple inputs and outputs. Normally there will be either a single input from a larger previous transaction or multiple inputs combining smaller amounts, and at most two outputs: one for the payment, and one returning the change, if any, back to the sender.
It should be noted that fan-out, where a transaction depends on several transactions, and those transactions depend on many more, is not a problem here. There is never the need to extract a complete standalone copy of a transaction's history.
The traditional banking model achieves a level of privacy by limiting access to information to the parties involved and the trusted third party. The necessity to announce all transactions publicly precludes this method, but privacy can still be maintained by breaking the flow of information in another place: by keeping public keys anonymous. The public can see that someone is sending an amount to someone else, but without information linking the transaction to anyone. This is similar to the level of information released by stock exchanges, where the time and size of individual trades, the "tape", is made public, but without telling who the parties were.
As an additional firewall, a new key pair should be used for each transaction to keep them from being linked to a common owner. Some linking is still unavoidable with multi-input transactions, which necessarily reveal that their inputs were owned by the same owner. The risk is that if the owner of a key is revealed, linking could reveal other transactions that belonged to the same owner.
We consider the scenario of an attacker trying to generate an alternate chain faster than the honest chain. Even if this is accomplished, it does not throw the system open to arbitrary changes, such as creating value out of thin air or taking money that never belonged to the attacker. Nodes are not going to accept an invalid transaction as payment, and honest nodes will never accept a block containing them. An attacker can only try to change one of his own transactions to take back money he recently spent.
The race between the honest chain and an attacker chain can be characterized as a Binomial Random Walk. The success event is the honest chain being extended by one block, increasing its lead by +1, and the failure event is the attacker's chain being extended by one block, reducing the gap by -1.
The probability of an attacker catching up from a given deficit is analogous to a Gambler's Ruin problem. Suppose a gambler with unlimited credit starts at a deficit and plays potentially an infinite number of trials to try to reach breakeven. We can calculate the probability he ever reaches breakeven, or that an attacker ever catches up with the honest chain, as follows[8]:
pqqz=== probability an honest node finds the next block probability the attacker finds the next block probability the attacker will ever catch up from z blocks behind
qz={1(q/p)zifp≤qifp>q}qz={1ifp≤q(q/p)zifp>q} \large q_z = \begin{Bmatrix} 1 & \textit{if}\; p \leq q\\ (q/p)^z & \textit{if}\; p > q \end{Bmatrix}
Given our assumption that p>q, the probability drops exponentially as the number of blocks the attacker has to catch up with increases. With the odds against him, if he doesn't make a lucky lunge forward early on, his chances become vanishingly small as he falls further behind.
We now consider how long the recipient of a new transaction needs to wait before being sufficiently certain the sender can't change the transaction. We assume the sender is an attacker who wants to make the recipient believe he paid him for a while, then switch it to pay back to himself after some time has passed. The receiver will be alerted when that happens, but the sender hopes it will be too late.
The receiver generates a new key pair and gives the public key to the sender shortly before signing. This prevents the sender from preparing a chain of blocks ahead of time by working on it continuously until he is lucky enough to get far enough ahead, then executing the transaction at that moment. Once the transaction is sent, the dishonest sender starts working in secret on a parallel chain containing an alternate version of his transaction.
The recipient waits until the transaction has been added to a block and z blocks have been linked after it. He doesn't know the exact amount of progress the attacker has made, but assuming the honest blocks took the average expected time per block, the attacker's potential progress will be a Poisson distribution with expected value:
λ=zqpλ=zqp \large \lambda = z \frac qp
To get the probability the attacker could still catch up now, we multiply the Poisson density for each amount of progress he could have made by the probability he could catch up from that point:
∑k=0∞λke−λk!⋅{(q/p)(z−k)1ifk≤zifk>z}∑k=0∞λke−λk!⋅{(q/p)(z−k)ifk≤z1ifk>z} \large \sum_{k=0}^{\infty} \frac{\lambda^k e^{-\lambda}}{k!} \cdot \begin{Bmatrix} (q/p)^{(z-k)} & \textit{if}\;k\leq z\\ 1 & \textit{if} \; k > z \end{Bmatrix}
Rearranging to avoid summing the infinite tail of the distribution…
1−∑k=0zλke−λk!(1−(q/p)(z−k))1−∑k=0zλke−λk!(1−(q/p)(z−k)) \large 1 – \sum_{k=0}^{z} \frac{\lambda^k e^{-\lambda}}{k!} \left ( 1-(q/p)^{(z-k)} \right )
Converting to C code…
#include <math.h>
double AttackerSuccessProbability(double q, int z)
double p = 1.0 - q;
double lambda = z * (q / p);
double sum = 1.0;
int i, k;
for (k = 0; k <= z; k++)
double poisson = exp(-lambda);
for (i = 1; i <= k; i++)
poisson *= lambda / i;
sum -= poisson * (1 - pow(q / p, z - k));
Running some results, we can see the probability drop off exponentially with z.
q=0.1
z=0    P=1.0000000
z=10   P=0.0000012
Solving for P less than 0.1%…
P < 0.001
q=0.10   z=5
q=0.20   z=11
q=0.45   z=340
We have proposed a system for electronic transactions without relying on trust. We started with the usual framework of coins made from digital signatures, which provides strong control of ownership, but is incomplete without a way to prevent double-spending. To solve this, we proposed a peer-to-peer network using proof-of-work to record a public history of transactions that quickly becomes computationally impractical for an attacker to change if honest nodes control a majority of CPU power. The network is robust in its unstructured simplicity. Nodes work all at once with little coordination. They do not need to be identified, since messages are not routed to any particular place and only need to be delivered on a best effort basis. Nodes can leave and rejoin the network at will, accepting the proof-of-work chain as proof of what happened while they were gone. They vote with their CPU power, expressing their acceptance of valid blocks by working on extending them and rejecting invalid blocks by refusing to work on them. Any needed rules and incentives can be enforced with this consensus mechanism.
[1] W. Dai, "b-money," http://www.weidai.com/bmoney.txt, 1998.
[2] H. Massias, X.S. Avila, and J.-J. Quisquater, "Design of a secure timestamping service with minimal trust requirements," In 20th Symposium on Information Theory in the Benelux, May 1999.
[3] S. Haber, W.S. Stornetta, "How to time-stamp a digital document," In Journal of Cryptology, vol 3, no 2, pages 99-111, 1991.
[4] D. Bayer, S. Haber, W.S. Stornetta, "Improving the efficiency and reliability of digital time-stamping," In Sequences II: Methods in Communication, Security and Computer Science, pages 329-334, 1993.
[5] S. Haber, W.S. Stornetta, "Secure names for bit-strings," In Proceedings of the 4th ACM Conference on Computer and Communications Security, pages 28-35, April 1997.
[6] A. Back, "Hashcash – a denial of service counter-measure," http://www.hashcash.org/papers/hashcash.pdf, 2002.
[7] R.C. Merkle, "Protocols for public key cryptosystems," In Proc. 1980 Symposium on Security and Privacy, IEEE Computer Society, pages 122-133, April 1980.
[8] W. Feller, "An introduction to probability theory and its applications," 1957.
PDF available in English, Chinese (Simplified), Chinese (Traditional), Hebrew, Italian, Japanese, Russian, Spanish, and Vietnamese