図1

1. ブロックチェーンとは?【東大AI研究者のノート】技術者でないあなたもブロックチェーン技術が与える社会インパクトを正しく理解する

自己紹介

はじめまして.普段は東京大学松尾研究室ってところでAIの研究やっているたむこうです.今回,ブロックチェーン技術周りや社会的インパクトの考察書などを調べたので,

「ブロックチェーンは話題になっていて,ブロックチェーンはすごい技術!大発見!とか言われているけど,実際の仕組みや技術はわからない.どう使うのがいいのか?or実はブロックチェーンって使い道ないんじゃないの?

という人たちが,

「ブロックチェーンの技術を理解することで,ブロックチェーンが社会へ与えるインパクトを正しく理解できるようになる」

ということを目的に,ブロックチェーンについてまとめました.

以下のような5部構成になっていましす.
1. ブロックチェーンとは?
2. PoWの課題と解決
3. Ethereumの仕組み
4. ICOと規制
5. ブロックチェーンの有効性

私のツイッターは以下です,フォローしていただけると嬉しいです.
- 本垢と(投資用垢)

ブロックチェーンとは?

ブロックチェーンとは,一言でいうとP2Pネットワークにすべての取引履歴データを分散保存する技術です.

引用元: https://www.sbbit.jp/article/image/34324/580_bit201712051634589774.png

この説明はよくニュースなどでも見るとは思います.ではこの技術が,どのように実現されているのでしょうか?

1. Timestamp Server

ブロックチェーンを提案した原論文には,blockchainという言葉は出てこず,Timestamp Serverという概念が導入されています.

もともと,データの記録において,時系列を正しく記録することは,取引や所有権などを記録する上で重要でした.
例えば,バレンタインデーのソーシャルゲームのイベントボーナスを考えてみましょう.ソーシャルゲーム黎明期では,デバイスのローカル時刻を参照することでイベントボーナスを行なってましたが,そうした場合,デバイスのローカル時刻を変更してしまえば,不正にイベントボーナスを受け取ることが可能になってしまいます.そのため,現在のソーシャルメディアでは,サーバー側の時刻を参照する中央集権的な仕組みが用いられています.

中央集権的な仕組みでは,

- 中央機関の不可やコストが高いこと
- 中央機関に対する無根拠な信頼が要求されること
- 中央機関に富や力が偏ってしまうこと
- 中央機関の透明性が低いこと
- 中央機関に対する不正アクセスやシステムダウンのリスク
- プライバシーが中央機関に筒抜けであること

などといった問題がありました.そこでP2Pネットワークによる分散処理による時系列データの記録を行う方法,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-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: A Peer-to-Peer Electronic Cash System

図解すると次の通りです.

情報を格納するブロック(block)を,不可逆性を持つハッシュ関数を再帰的に用いることによって連結(chain)し,データの不可逆的な記録(blockchain)を構成します.
情報を格納するblockには,
- Prev Hash: 1つ前のブロックのハッシュ
- Nonce: ナンス. ハッシュ値を計算する際のワンタイムパスワード
- Root Hash: トランザクションなどの情報をマークルツリーという手法を用いてハッシュ化して固定長の情報にしたもの

の3つが格納されています.このように,P2Pネットワークにおいてblockchainを構成することによって,たとえ一つのブロックが改ざんされたとしても,他のコンピュータ(Node)との整合性によって真の情報を確認し保持することが可能となります.
ただし,例えばP2Pネットワークにおける過半数のNodeが書き換えられてしまった場合,ブロックチェーンの持つ情報が改ざんされてしまうという問題がありました.それを解決する技術が次で説明するProof-of-Workです.

2. Proof-of-Work

上述したように,P2Pネットワークにおける過半数のNodeが書き換えられ,ブロックチェーンが改ざんされてしまっては困ります.そこで,暗号理論に基づいた不正の防止策が講じられています.Bitcoin: A Peer-to-Peer Electronic Cash Systemにおいて提案されている手法は,Proof-of-Workという手法です.Proof-of-Workの概念をとても簡単にいうと,新しいblockを作成する際に,条件を満たすblockを作成することに多大な労力を要求し,blockchainを構成するP2Pネットワークの計算労力の過半数を支配しなければ情報を改竄することができないという仕組みです.

以下原論文の説明

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.
引用元: Bitcoin: A Peer-to-Peer Electronic Cash System

この際,ハッシュ関数のもつ不可逆性(非対称性)が重要です.例えばハッシュ関数h(x)において,y > h(x)となるxを見つけることは難しいが, y > h(x) が真であるかどうかは簡単に確認することができます.ブロックチェーンアプリケーション開発の教科書では,数独の例が挙げられています.数独は解くことが難しいが,答え合わせは簡単です.このような非対称性を利用して,条件を満たすブロックを作成することは難しいが,ブロックが条件を満たしているかどうかの確認は簡単に行うことができ,ブロックチェーンの整合性を確認することは簡単でも改竄することは難しいという仕組みを実現しています.

以上,ブロックチェーン技術の基礎となるTimestamp ServerとProof-of-Workを開設しました.次は,Proof-of-WorkがBitcoinにおいて具体的に使われている方法や,抱えている欠点などを整理します.


この記事が気に入ったらサポートをしてみませんか?