Hyperledger区块链中的块的链接

时间:2017-07-12 10:10:00

标签: blockchain hyperledger hyperledger-fabric

在比特币的情况下,区块链块与前一个块的哈希链接。如何在Hyperledger Fabric区块链中链接块?以及如何将它们可视化?

2 个答案:

答案 0 :(得分:1)

通过检查protobuf定义here,您可以找到Hyperledger Fabric中的结构块。其中块定义为:

message Block {
    BlockHeader header = 1;
    BlockData data = 2;
    BlockMetadata metadata = 3;
}

您将进一步深入了解BlockHeader

的定义
message BlockHeader {
    uint64 number = 1; // The position in the blockchain
    bytes previous_hash = 2; // The hash of the previous block header
    bytes data_hash = 3; // The hash of the BlockData, by MerkleTree
}

您将看到Hyperledger Fabric中的块与比特币和许多其他区块链解决方案非常相似的哈希链接。块N的散列(H)通过以下方案计算:

H(H) = hash([transactions] || H(N-1) || N)

E.g。块的内容,前一个块散列和块序列号。

很多方面在" Getting Started"文档。

答案 1 :(得分:0)

如果你正在使用IBM Bluemix这里是GO的简单教程

# Create the parent directories on your GOPATH
mkdir -p $GOPATH/src/github.com/hyperledger
cd $GOPATH/src/github.com/hyperledger

# Clone the appropriate release codebase into $GOPATH/src/github.com/hyperledger/fabric
# Note that the v0.5 release is a branch of the repository.  It is defined below after the -b argument
git clone -b v0.5-developer-preview https://github.com/hyperledger-archives/fabric.git

如果要安装IBM BLUEMIX v0.6 release,请将其用于git clone命令:

# The v0.6 release exists as a branch inside the Gerrit fabric repository
git clone -b v0.6 http://gerrit.hyperledger.org/r/fabric

如果您的GOPATH上没有正确安装布料,您在构建链码时会看到如下错误

除了您可以简单地参考文档以进行链接过程!