ビットコイン:ピアツーピア電子キャッシュシステム

Bitcoin: A Peer-to-Peer Electronic Cash System

Par Satoshi Nakamoto · 2008

Abstract

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.

Abstract

純粋なpeer-to-peerの電子キャッシュにより、金融機関を介さずに一方の当事者からもう一方へ直接オンライン決済を行うことが可能になる。デジタル署名はその解決策の一部を提供するが、二重支払いを防ぐために信頼できる第三者が依然として必要であれば、主な利点は失われてしまう。我々はpeer-to-peerネットワークを用いた二重支払い問題への解決策を提案する。このネットワークは、トランザクションをhashベースのproof-of-workの連鎖にhash化することでタイムスタンプを付与し、proof-of-workをやり直さない限り変更できない記録を形成する。最長のチェーンは、目撃されたイベントの順序の証明としてのみならず、それが最大のCPUパワーのプールから生まれたことの証明としても機能する。CPUパワーの過半数がネットワークへの攻撃に協力していないノードによって制御されている限り、それらのノードが最長のチェーンを生成し、攻撃者を凌駕する。ネットワーク自体は最小限の構造しか必要としない。メッセージはベストエフォートで配信され、ノードは自由にネットワークから離脱・再参加でき、不在中に何が起こったかの証明として最長のproof-of-workチェーンを受け入れる。

Introduction

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.

Introduction

インターネット上の商取引は、電子決済を処理する信頼できる第三者として機能する金融機関にほぼ全面的に依存するようになった。このシステムはほとんどのトランザクションに対して十分に機能しているが、信頼ベースモデルに固有の弱点を依然として抱えている。金融機関は紛争の仲裁を避けることができないため、完全に不可逆なトランザクションは実質的に不可能である。仲裁コストはトランザクションコストを増大させ、実用的な最小トランザクションサイズを制限し、小規模なカジュアルトランザクションの可能性を断つ。さらに、不可逆なサービスに対して不可逆な支払いができないことによる、より広範なコストも存在する。取消しの可能性がある限り、信頼の必要性が広がる。商人は顧客を警戒し、本来不要な情報まで求めなければならない。一定割合の詐欺は不可避として受け入れられている。これらのコストと支払いの不確実性は、物理的な通貨を使用すれば対面で回避できるが、信頼できる当事者なしに通信チャネルを通じて支払いを行うメカニズムは存在しない。

必要とされているのは、信頼ではなく暗号学的証明に基づく電子決済システムであり、信頼できる第三者を必要とせずに任意の二者が直接取引できるようにするものである。計算上取消しが実質的に不可能なトランザクションは売り手を詐欺から保護し、日常的なエスクローメカニズムで買い手を容易に保護できる。本論文では、peer-to-peer分散タイムスタンプサーバーを用いてトランザクションの時系列順序の計算的証明を生成することで、二重支払い問題への解決策を提案する。このシステムは、正直なノードが協力する攻撃者ノードの集団よりも多くのCPUパワーを集合的に制御している限り安全である。

Transactions

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.

Bitcoin transaction chain showing the signature-linked ownership transfer model

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.

Transactions

我々は電子コインをデジタル署名のチェーンとして定義する。各所有者は、前のトランザクションのhashと次の所有者の公開鍵にデジタル署名し、これらをコインの末尾に追加することで、次の所有者にコインを転送する。受取人は署名を検証することで所有権のチェーンを検証できる。

Bitcoin transaction chain showing the signature-linked ownership transfer model

もちろん問題は、受取人が所有者の一人がコインを二重支払いしていないことを検証できないことである。一般的な解決策は、すべてのトランザクションの二重支払いをチェックする信頼できる中央機関、つまり造幣局を導入することである。各トランザクションの後、コインは新しいコインを発行するために造幣局に返却されなければならず、造幣局から直接発行されたコインのみが二重支払いされていないと信頼される。この解決策の問題は、銀行と同様に、すべてのトランザクションがそこを経由しなければならず、貨幣システム全体の運命が造幣局を運営する企業に依存することである。

我々は、受取人が以前の所有者がそれ以前のトランザクションに署名していないことを知る方法を必要とする。我々の目的においては、最も早いトランザクションが有効であり、それ以降の二重支払いの試みは問題としない。トランザクションが存在しないことを確認する唯一の方法は、すべてのトランザクションを認識することである。造幣局ベースのモデルでは、造幣局がすべてのトランザクションを認識し、どれが最初に到着したかを決定していた。信頼できる当事者なしにこれを達成するためには、トランザクションは公開で通知されなければならず[^1]、参加者がトランザクションの受信順序の単一の履歴に合意するシステムが必要である。受取人は、各トランザクションの時点で、ノードの過半数がそれを最初に受信したものとして合意したことの証明を必要とする。

Timestamp Server

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] [^3] [^4] [^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.

Bitcoin timestamp server hash-chain diagram linking blocks and items

Timestamp Server

我々が提案する解決策はタイムスタンプサーバーから始まる。タイムスタンプサーバーは、タイムスタンプを付与するアイテムのブロックのhashを取得し、新聞やUsenetへの投稿のようにそのhashを広く公開することで機能する[^2] [^3] [^4] [^5]。タイムスタンプは、hashに含まれるためにそのデータがその時点で存在していたことを明らかに証明する。各タイムスタンプはそのhash内に前のタイムスタンプを含み、チェーンを形成し、追加のタイムスタンプごとにそれ以前のものを強化する。

Bitcoin timestamp server hash-chain diagram linking blocks and items

Proof-of-Work

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.

Bitcoin proof-of-work block chain diagram with previous hash transaction set and nonce

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.

Proof-of-Work

peer-to-peerベースで分散タイムスタンプサーバーを実装するには、新聞やUsenetの投稿ではなく、Adam BackのHashcash [^6]に類似したproof-of-workシステムを使用する必要がある。proof-of-workは、hash化した際に(例えばSHA-256で)hashが一定数のゼロビットで始まる値を探索することを含む。必要な平均作業量はゼロビット数に対して指数関数的であり、単一のhashを実行することで検証できる。

我々のタイムスタンプネットワークでは、ブロック内のnonceをインクリメントし、ブロックのhashに必要なゼロビットを与える値が見つかるまで繰り返すことでproof-of-workを実装する。proof-of-workを満たすためにCPUの労力が費やされると、その作業をやり直さない限りブロックを変更することはできない。後続のブロックがその後にチェーンされるため、ブロックを変更するための作業にはそれ以降のすべてのブロックをやり直すことが含まれる。

Bitcoin proof-of-work block chain diagram with previous hash transaction set and nonce

proof-of-workは、多数決における代表性の決定問題も解決する。もし多数決が1つのIPアドレスにつき1票に基づいていたならば、多数のIPを割り当てられる者によって覆される可能性がある。proof-of-workは本質的に1つのCPUにつき1票である。多数決は最長のチェーン、すなわち最大のproof-of-work労力が投入されたチェーンによって表される。CPUパワーの過半数が正直なノードによって制御されていれば、正直なチェーンが最も速く成長し、競合するいかなるチェーンも凌駕する。過去のブロックを改変するには、攻撃者はそのブロックとそれ以降のすべてのブロックのproof-of-workをやり直し、さらに正直なノードの作業に追いつき追い越さなければならない。遅い攻撃者が追いつく確率は、後続のブロックが追加されるにつれて指数関数的に減少することを後に示す。

ハードウェア速度の向上と、時間の経過に伴うノード運用への関心の変動を補うため、proof-of-workの難易度は1時間あたりの平均ブロック数を目標とする移動平均によって決定される。生成速度が速すぎる場合、難易度は上昇する。

Network

The steps to run the network are as follows:

  1. New transactions are broadcast to all nodes.
  2. Each node collects new transactions into a block.
  3. Each node works on finding a difficult proof-of-work for its block.
  4. When a node finds a proof-of-work, it broadcasts the block to all nodes.
  5. Nodes accept the block only if all transactions in it are valid and not already spent.
  6. 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.

Network

ネットワークを運用する手順は以下の通りである:

  1. 新しいトランザクションがすべてのノードにブロードキャストされる。
  2. 各ノードが新しいトランザクションをブロックに収集する。
  3. 各ノードがそのブロックに対する困難なproof-of-workの発見に取り組む。
  4. ノードがproof-of-workを発見すると、そのブロックをすべてのノードにブロードキャストする。
  5. ノードは、ブロック内のすべてのトランザクションが有効であり、まだ使用されていない場合にのみ、そのブロックを承認する。
  6. ノードは、承認されたブロックのhashを前のhashとして使用し、チェーンの次のブロックの作成に取り組むことで、そのブロックの承認を表明する。

ノードは常に最長のチェーンを正しいものとみなし、その延長に取り組み続ける。2つのノードが異なるバージョンの次のブロックを同時にブロードキャストした場合、一部のノードはどちらか一方を先に受信する可能性がある。その場合、ノードは最初に受信した方に取り組むが、もう一方のブランチがより長くなった場合に備えて保存しておく。次のproof-of-workが発見され、一方のブランチがより長くなった時点で決着がつき、もう一方のブランチで作業していたノードはより長い方に切り替える。

新しいトランザクションのブロードキャストは、必ずしもすべてのノードに到達する必要はない。多くのノードに到達すれば、やがてブロックに取り込まれる。ブロックのブロードキャストもメッセージの欠落に対して寛容である。ノードがブロックを受信しなかった場合、次のブロックを受信した際に欠落に気づき、そのブロックを要求する。

Incentive

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.

Incentive

慣例により、ブロック内の最初のトランザクションは、ブロックの作成者が所有する新しいコインを生成する特別なトランザクションである。これはノードがネットワークを支援するインセンティブを追加し、発行する中央機関が存在しないため、コインを流通させる初期分配の方法を提供する。一定量の新しいコインの着実な追加は、金鉱夫が資源を費やして金を流通に追加することに類似している。我々の場合、費やされるのはCPU時間と電力である。

インセンティブはトランザクション手数料でも賄うことができる。トランザクションの出力値がその入力値よりも小さい場合、差額はそのトランザクションを含むブロックのインセンティブ値に加算されるトランザクション手数料となる。所定の数のコインが流通に入った後、インセンティブは完全にトランザクション手数料に移行し、完全にインフレーションフリーとなることができる。

インセンティブはノードが正直であり続けることを促す助けとなりうる。貪欲な攻撃者がすべての正直なノードよりも多くのCPUパワーを集めることができた場合、その力を使って自身の支払いを取り戻す詐欺を行うか、新しいコインの生成に使用するかを選択しなければならない。ルールに従って行動する方がより収益性が高いと判断するはずであり、そのようなルールは他の全員を合わせたよりも多くの新しいコインを彼に有利に与えるのであって、システムと自身の富の正当性を損なうよりもましである。

Reclaiming Disk Space

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.

Bitcoin Merkle Tree diagram showing transaction hashing and block pruning by stubbing off branches

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.

Reclaiming Disk Space

コイン内の最新のトランザクションが十分な数のブロックの下に埋まれば、それ以前の使用済みトランザクションはディスクスペースを節約するために破棄できる。ブロックのhashを壊さずにこれを実現するため、トランザクションはMerkle Tree [^7] [^2] [^5]にhash化され、ルートのみがブロックのhashに含まれる。古いブロックはツリーの枝を切り落とすことでコンパクトにできる。内部のhashは保存する必要がない。

Bitcoin Merkle Tree diagram showing transaction hashing and block pruning by stubbing off branches

トランザクションを含まないブロックヘッダーは約80バイトとなる。ブロックが10分ごとに生成されると仮定すると、80バイト * 6 * 24 * 365 = 年間4.2MBとなる。2008年時点でコンピュータシステムが一般的に2GBのRAMを搭載して販売されており、ムーアの法則が年間1.2GBの現在の成長を予測していることを考えると、ブロックヘッダーをメモリに保持しなければならないとしてもストレージは問題とはならない。

Simplified Payment Verification

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.

Bitcoin simplified payment verification showing the longest proof-of-work chain with Merkle branch linking to a transaction

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.

Simplified Payment Verification

完全なネットワークノードを稼働させずに支払いを検証することが可能である。ユーザーは最長のproof-of-workチェーンのブロックヘッダー">ブロックヘッダーのコピーのみを保持すればよく、最長のチェーンを持っていると確信するまでネットワークノードに問い合わせることで取得でき、トランザクションをそれがタイムスタンプされたブロックにリンクするMerkleブランチを取得できる。ユーザー自身がトランザクションを確認することはできないが、チェーン内の場所にリンクすることで、ネットワークノードがそれを承認したことを確認でき、その後に追加されたブロックがネットワークがそれを承認したことをさらに裏付ける。

Bitcoin simplified payment verification showing the longest proof-of-work chain with Merkle branch linking to a transaction

そのため、正直なノードがネットワークを制御している限り検証は信頼できるが、ネットワークが攻撃者に圧倒された場合はより脆弱になる。ネットワークノードはトランザクションを自ら検証できるが、この簡易的な方法は、攻撃者がネットワークを圧倒し続けられる限り、攻撃者が捏造したトランザクションに欺かれる可能性がある。これに対する防御戦略の一つは、ネットワークノードが無効なブロックを検出した際にアラートを受け入れ、ユーザーのソフトウェアに完全なブロックとアラートされたトランザクションをダウンロードさせ、不整合を確認することである。頻繁に支払いを受ける企業は、より独立したセキュリティと迅速な検証のために、おそらく自社のノードを運用することを望むだろう。

Combining and Splitting Value

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.

Bitcoin transaction combining and splitting value with multiple inputs and outputs

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.

Combining and Splitting Value

コインを個別に扱うことは可能であるが、送金の1セントごとに別々のトランザクションを作成するのは扱いにくい。価値の分割と結合を可能にするため、トランザクションには複数の入力と出力が含まれる。通常、より大きな前のトランザクションからの単一の入力か、より小さな金額を結合する複数の入力があり、出力は最大で2つ:支払い用の1つと、もしあればお釣りを送信者に返す1つである。

Bitcoin transaction combining and splitting value with multiple inputs and outputs

あるトランザクションが複数のトランザクションに依存し、それらのトランザクションがさらに多くのトランザクションに依存するファンアウトは、ここでは問題にならないことに注意すべきである。トランザクションの完全な独立したコピーを抽出する必要は決してない。

Privacy

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.

Bitcoin privacy model comparison showing traditional model with trusted third party versus new model with anonymous public keys

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.

Privacy

従来の銀行モデルは、関係当事者と信頼できる第三者に情報へのアクセスを制限することで一定レベルのプライバシーを実現している。すべてのトランザクションを公開で通知する必要性はこの方法を不可能にするが、別の場所で情報の流れを断ち切ることでプライバシーを維持することは可能である:公開鍵を匿名に保つことによってである。誰かが他の誰かに金額を送金していることは公開で見ることができるが、そのトランザクションを個人に結びつける情報はない。これは、証券取引所が公開する情報レベルに類似しており、個々の取引の時間と規模、すなわち「ティッカーテープ」は公開されるが、当事者が誰であるかは明かされない。

Bitcoin privacy model comparison showing traditional model with trusted third party versus new model with anonymous public keys

追加のファイアウォールとして、各トランザクションに新しいキーペアを使用し、共通の所有者にリンクされることを防ぐべきである。複数入力のトランザクションでは、一部のリンクは依然として不可避であり、それらの入力が同一の所有者のものであったことが必然的に明らかになる。リスクは、鍵の所有者が明らかになった場合、リンクによって同一の所有者に属する他のトランザクションが明らかになる可能性があることである。

Calculations

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]:

p = probability an honest node finds the next block
q = probability the attacker finds the next block
qz = probability the attacker will ever catch up from z blocks behind

\[ qz = \begin{cases} 1 & \text{if } p \leq q \\ \left(\frac{q}{p}\right) z & \text{if } p > q \end{cases} \]

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:

\[ \lambda = z\frac{q}{p} \]

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:

\[ \sum_{k=0}^{\infty} \frac{\lambda^k e^{-\lambda}}{k!} \cdot \left\{ \begin{array}{cl} \left(\frac{q}{p}\right)^{(z-k)} & \text{if } k \leq z \\ 1 & \text{if } k > z \end{array} \right. \]

Rearranging to avoid summing the infinite tail of the distribution...

\[ 1 - \sum_{k=0}^{z} \frac{\lambda^k e^{-\lambda}}{k!} \left(1-\left(\frac{q}{p}\right)^{(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));
    }
    return sum;
}

Running some results, we can see the probability drop off exponentially with z.

q=0.1
z=0 P=1.0000000
z=1 P=0.2045873
z=2 P=0.0509779
z=3 P=0.0131722
z=4 P=0.0034552
z=5 P=0.0009137
z=6 P=0.0002428
z=7 P=0.0000647
z=8 P=0.0000173
z=9 P=0.0000046
z=10 P=0.0000012

q=0.3
z=0 P=1.0000000
z=5 P=0.1773523
z=10 P=0.0416605
z=15 P=0.0101008
z=20 P=0.0024804
z=25 P=0.0006132
z=30 P=0.0001522
z=35 P=0.0000379
z=40 P=0.0000095
z=45 P=0.0000024
z=50 P=0.0000006

Solving for P less than 0.1%...

P  0.001
q=0.10 z=5
q=0.15 z=8
q=0.20 z=11
q=0.25 z=15
q=0.30 z=24
q=0.35 z=41
q=0.40 z=89
q=0.45 z=340

Calculations

攻撃者が正直なチェーンよりも速く代替チェーンを生成しようとするシナリオを考える。これが達成されたとしても、無から価値を創造したり、攻撃者に属さない金銭を奪うなど、システムが恣意的な変更に開かれるわけではない。ノードは無効なトランザクションを支払いとして受け入れず、正直なノードはそれを含むブロックを決して受け入れない。攻撃者は、自分自身のトランザクションの1つを変更して最近使った金銭を取り戻すことしか試みることができない。

正直なチェーンと攻撃者のチェーンの競争は二項ランダムウォークとして特徴づけることができる。成功事象は正直なチェーンが1ブロック延長されリードが+1増加すること、失敗事象は攻撃者のチェーンが1ブロック延長され差が-1縮小することである。

攻撃者が所定の不足分から追いつく確率は、ギャンブラーの破産問題に類似している。無限の信用を持つギャンブラーが不足分から出発し、損益分岐点に達しようと無限の試行を行うと仮定する。損益分岐点に達する確率、つまり攻撃者が正直なチェーンに追いつく確率は以下のように計算できる[^8]:

p = probability an honest node finds the next block
q = probability the attacker finds the next block
q = probability the attacker will ever catch up from z blocks behind
``````

\[
qz =
\begin{cases}
1 & \text{if } p \leq q \\
\left(\frac{q}{p}\right) z & \text{if } p > q
\end{cases}
\]

p  qという我々の仮定の下では、攻撃者が追いつかなければならないブロック数が増加するにつれて確率は指数関数的に低下する。不利な状況において、早い段階で幸運にも前進できなければ、遅れるにつれてその可能性は極めて小さくなる。

次に、新しいトランザクションの受取人が、送信者がトランザクションを変更できないと十分に確信するまでにどのくらい待つ必要があるかを考える。送信者は、受取人にしばらくの間支払ったと信じさせた後、一定時間の経過後に自分自身への支払いに切り替えたい攻撃者であると仮定する。受信者はそれが起こった時にアラートを受けるが、送信者はそれが手遅れであることを望んでいる。

受信者は新しいキーペアを生成し、署名の直前に送信者に公開鍵を渡す。これにより、送信者が十分先行できるほどの幸運を得るまで継続的にブロックのチェーンを事前に準備し、そのタイミングでトランザクションを実行することを防ぐ。トランザクションが送信されると、不正な送信者は自分のトランザクションの代替バージョンを含む並行チェーンを秘密裏に作成する作業を開始する。

受取人はトランザクションがブロックに追加され、その後にzブロックがリンクされるまで待つ。攻撃者が正確にどの程度進んでいるかは分からないが、正直なブロックがブロックあたりの平均予想時間を要したと仮定すると、攻撃者の潜在的な進捗は期待値が次のPoisson分布となる:

\[
\lambda = z\frac{q}{p}
\]

攻撃者が今なお追いつける確率を求めるために、攻撃者が到達しうる各進捗量のPoisson密度に、その地点から追いつける確率を乗じる:

\[
\sum_{k=0}^{\infty} \frac{\lambda^k e^{-\lambda}}{k!} \cdot \left\{
\begin{array}{cl}
\left(\frac{q}{p}\right)^{(z-k)} & \text{if } k \leq z \\
1 & \text{if } k > z
\end{array}
\right.
\]

分布の無限の裾を合計することを避けるために整理すると...

\[
1 - \sum_{k=0}^{z} \frac{\lambda^k e^{-\lambda}}{k!} \left(1-\left(\frac{q}{p}\right)^{(z-k)}\right)
\]

C言語コードに変換すると...

```c
#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));
    }
    return sum;
}

いくつかの結果を実行すると、確率がzに対して指数関数的に低下することが分かる。

q=0.1
z=0 P=1.0000000
z=1 P=0.2045873
z=2 P=0.0509779
z=3 P=0.0131722
z=4 P=0.0034552
z=5 P=0.0009137
z=6 P=0.0002428
z=7 P=0.0000647
z=8 P=0.0000173
z=9 P=0.0000046
z=10 P=0.0000012

q=0.3
z=0 P=1.0000000
z=5 P=0.1773523
z=10 P=0.0416605
z=15 P=0.0101008
z=20 P=0.0024804
z=25 P=0.0006132
z=30 P=0.0001522
z=35 P=0.0000379
z=40 P=0.0000095
z=45 P=0.0000024
z=50 P=0.0000006

Pが0.1%未満となるzを求めると...

P  0.001
q=0.10 z=5
q=0.15 z=8
q=0.20 z=11
q=0.25 z=15
q=0.30 z=24
q=0.35 z=41
q=0.40 z=89
q=0.45 z=340

Conclusion

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.

Conclusion

我々は信頼に依存しない電子取引のシステムを提案した。デジタル署名から作られるコインの通常のフレームワークから出発した。これは所有権の強力な管理を提供するが、二重支払いを防ぐ方法がなければ不完全である。これを解決するために、proof-of-workを用いてトランザクションの公開履歴を記録するpeer-to-peerネットワークを提案した。正直なノードがCPUパワーの過半数を制御していれば、攻撃者がそれを変更することは計算上急速に非現実的となる。ネットワークはその非構造的な単純さにおいて頑健である。ノードはほとんど協調なしに一斉に作業する。メッセージは特定の場所にルーティングされるのではなくベストエフォートで配信されるだけでよいため、ノードは識別される必要がない。ノードは自由にネットワークから離脱・再参加でき、不在中に何が起こったかの証明としてproof-of-workチェーンを受け入れる。ノードはCPUパワーで投票し、有効なブロックの延長に取り組むことでその承認を表明し、無効なブロックに対しては作業を拒否することで拒絶する。必要なルールとインセンティブはすべてこの合意メカニズムによって施行できる。

References


  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.

References


  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.