hyperledger fabric链代码的安全问题(智能合约)

问题描述 投票:1回答:1

我正在阅读Hyperledger Fabric的文档,发现了一个非常令人困惑的方面。我不知道这是不是一个安全问题,或者我是否误解了一些问题。

从文档的this section,我理解的是智能合约的interface在不同的同行实例化时需要相同。这是否意味着我可以在智能合约功能中拥有不同的业务逻辑,同时在将其部署到不同的同行时具有相同的接口?

如果我是正确的,这不意味着设计中存在大的安全问题吗?任何理解这个概念的帮助都会受到赞赏。

hyperledger-fabric hyperledger blockchain smartcontracts
1个回答
4
投票

Chaincode接口严格定义且无法更改,界面为:

// Chaincode interface must be implemented by all chaincodes. The fabric runs
// the transactions by calling these functions as specified.
type Chaincode interface {
    // Init is called during Instantiate transaction after the chaincode container
    // has been established for the first time, allowing the chaincode to
    // initialize its internal data
    Init(stub ChaincodeStubInterface) pb.Response

    // Invoke is called to update or query the ledger in a proposal transaction.
    // Updated state variables are not committed to the ledger until the
    // transaction is committed.
    Invoke(stub ChaincodeStubInterface) pb.Response
}

您有一种方法可以处理逻辑的初始化方面,而休息将通过Invoke方法执行。现在,在链代码安装/实例化期间计算出链代码的哈希值,并在绑定到链代码的生命周期命名空间内持久化。因此,如果另一个对等体将具有不同的二进制代码并将尝试使用它,则对等体将无法执行它。

© www.soinside.com 2019 - 2024. All rights reserved.