Modified GHOST Implementation - toyofuku/flp GitHub Wiki

Miscellanea And Concerns

Modified GHOST Implementation

The "Greedy Heaviest Observed Subtree" (GHOST) protocol is an innovation first introduced by Yonatan Sompolinsky and Aviv Zohar in December 2013. The motivation behind GHOST is that blockchains with fast confirmation times currently suffer from reduced security due to a high stale rate - because blocks take a certain time to propagate through the network, if miner A mines a block and then miner B happens to mine another block before miner A's block propagates to B, miner B's block will end up wasted and will not contribute to network security. Furthermore, there is a centralization issue: if miner A is a mining pool with 30% hashpower and B has 10% hashpower, A will have a risk of producing a stale block 70% of the time (since the other 30% of the time A produced the last block and so will get mining data immediately) whereas B will have a risk of producing a stale block 90% of the time. Thus, if the block interval is short enough for the stale rate to be high, A will be substantially more efficient simply by virtue of its size. With these two effects combined, blockchains which produce blocks quickly are very likely to lead to one mining pool having a large enough percentage of the network hashpower to have de facto control over the mining process.

GHOST(Greedy Heaviest Observed Subtree)プロトコルは、2013年12月Yonatan SompolinskyとAviv Zoharが考案したイノベーションである。GHOSTの背景にある動機は以下のとおり。

  1. ブロックチェーンでは確認(confirmation)が頻発するため、失効率(stale rate)が高くなり、セキュリティ低下に現在苦しんでいる。ブロックがネットワークで伝搬するにはある一定時間を要するため、マイナーAがマイニングしたブロックがマイナーBに伝搬する前にマイナーBが別のブロックをマイニングしようとすると、マイナーBのブロックは無駄に終わり、ネットワークのセキュリティに貢献しないだろう。

  2. 中央集中化の問題もある。マイナーAが30%のハッシュパワーをもつマイニングプールであり、マイナーBが10%のハッシュパワーをもつとすると、マイナーAが失効ブロックを産出するリスクは(マイナーAが最終ブロックを産出した時点での30%以外のハッシュパワーが即座にマイニングデータを得るとしたら)70%なのに対して、マイナーBが失効ブロックを産出するリスクは90%になる。ブロックのインターバルが短すぎて失効率が高くなる場合、マイナーAは単にそのサイズのおかげで大幅に効率がよくなるだろう。

この二つの効果が組み合わさると、ブロックを高速に産出するブロックチェーンは、ネットワークのハッシュパワーのかなり大きな割合を占めている特定のマイニングプールがリードすることになり、マイニングプロセス全体に対する事実上のコントロールをもってしまうだろう。

As described by Sompolinsky and Zohar, GHOST solves the first issue of network security loss by including stale blocks in the calculation of which chain is the "longest"; that is to say, not just the parent and further ancestors of a block, but also the stale descendants of the block's ancestor (in Ethereum jargon, "uncles") are added to the calculation of which block has the largest total proof of work backing it. To solve the second issue of centralization bias, we go beyond the protocol described by Sompolinsky and Zohar, and also provide block rewards to stales: a stale block receives 87.5% of its base reward, and the nephew that includes the stale block receives the remaining 12.5%. Transaction fees, however, are not awarded to uncles.

SompolinskyとZoharが考案したGHOSTでは、ネットワークセキュリティの喪失という第1の問題は「最長チェーン」を決める計算に失効ブロックを含めることで解決している。PoW(proof of work)の合計が最大になるブロックの計算において、あるブロックの親と祖先だけでなく、ブロックの祖先を後継する失効ブロック(Ethereum用語では「叔父(uncle)」)も加えるのだ。 中央集中という第2の問題を解決するために、SompolinskyとZoharが提唱したプロトコルの範囲を超えて、失効ブロックに対しても報酬を提供する。失効ブロックはその基本報酬の87.5%を受け取り、その失効ブロックを含む甥(nephew)が残りの12.5%を受け取る。しかしながら、トランザクション料金は叔父たち(uncles)には払われない。

Ethereum implements a simplified version of GHOST which only goes down seven levels. Specifically, it is defined as follows:

  • A block must specify a parent, and it must specify 0 or more uncles
  • An uncle included in block B must have the following properties:
    • It must be a direct child of the kth generation ancestor of B, where 2 <= k <= 7.
    • It cannot be an ancestor of B
    • An uncle must be a valid block header, but does not need to be a previously verified or even valid block
    • An uncle must be different from all uncles included in previous blocks and all other uncles included in the same block (non-double-inclusion)
  • For every uncle U in block B, the miner of B gets an additional 3.125% added to its coinbase reward and the miner of U gets 93.75% of a standard coinbase reward.

This limited version of GHOST, with uncles includable only up to 7 generations, was used for two reasons. First, unlimited GHOST would include too many complications into the calculation of which uncles for a given block are valid. Second, unlimited GHOST with compensation as used in Ethereum removes the incentive for a miner to mine on the main chain and not the chain of a public attacker.

EthereumではGHOSTの簡易バージョン(7世代までしか遡らない)を実装している。

  • ブロックには1個の親と0個以上の叔父たち(uncles)が指定されなければならない
  • ブロックBに指定された叔父(uncle)は以下の制約を満たさなければならない
    • Bのk世代前の先祖の直接の子でなければならない(2 <= k <= 7)
    • Bの先祖であってはならない
    • 正しい(valid)ブロックヘッダでなければならない。ただし、過去に検証されている必要はないし、正しいブロックである必要もない。
    • 過去のブロックにあるすべての叔父と異なっていなければならない。同じブロックにある他のすべての叔父と異なっていなければならない(二重登録の禁止)。
  • ブロックBにある叔父Uのそれぞれに対して、マイナーは追加報酬を得る。Bのマイナーはコインベース報酬の3.125%。Uのマイナーは標準コインベース報酬の93.75%。

このGHOSTの制限バージョンは、叔父を最大7世代までに限定している。これが使われた理由は二つある。

  1. 制限なしのGHOSTになると、与えられたブロックの叔父たちのうちどれが正しいかを検査する計算が複雑になりすぎる。
  2. Ethereumで使われているのと同じ補償を制限なしのGHOSTに適用すると、マイナーにとって(パブリック攻撃者のチェーンではなく)メインチェーンでマイニングするインセンティブがなくなる。