美文网首页
精读比特币-9

精读比特币-9

作者: yannit | 来源:发表于2018-06-07 08:33 被阅读10次

    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.

    一旦一个币种最新的交易被足够多的节点收入,它之前的已花费交易就可以被丢弃来节省磁盘空间。

    在不破坏区块哈希的情况下实现这项功能,所有的交易都被哈希到一棵默克尔树上,只有这课树的根节点被放到了区块的哈希值中。

    修剪掉树枝后,旧的区块就可以被压缩。(除根节点意外的)其他内部哈希不需要保留。

    一个不含有交易记录的区块头大约80字节。如果假定每10分钟产生一个区块,一年将会产生80 bytes * 6 * 24 * 365 = 4.2MB. 2008年出售的电脑都拥有2GB的内存,根据摩尔定律,内存每年会增加1.2GB, 即使把区块链头部保存在内存中,存储也不会有问题。

    相关文章

      网友评论

          本文标题:精读比特币-9

          本文链接:https://www.haomeiwen.com/subject/ljgusftx.html