Cao Yi

Reading Through the Bitcoin White Paper, 通读比特币白皮书

⇦上一章 - 返回目录📖 - 下一章⇨


按:本章的关键是Merkle树。

7. 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.

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.

解读如下:

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.

为了让这(节省磁盘空间)容易一些,并且不破坏区块的哈希,区块中的哈希使用默克尔(Merkle)树,只有根哈希包含在区块哈希中。

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.

一个不带交易信息的区块头大约占80字节。

If we suppose blocks are generated every 10 minutes, 80 bytes * 6 * 24 * 365 = 4.2MB per year.

如果我们假定每10分钟生成一个区块,一年生成的数据是 80 bytes * 6 * 24 * 365 = 4.2MB

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.

2008年在售的电脑基本上都有2GB的内存,按照摩尔定律预测每年增长1.2GB,即使区块头需要存放在内存中,存储也不是问题。


参考资料:


⇦上一章 - 返回目录📖 - 下一章⇨