Hyperledger fabric hyperledger结构的链码存在安全问题(智能合约)

Hyperledger fabric hyperledger结构的链码存在安全问题(智能合约),hyperledger-fabric,hyperledger,blockchain,smartcontracts,Hyperledger Fabric,Hyperledger,Blockchain,Smartcontracts,我在阅读Hyperledger Fabric的文档时发现了一个非常令人困惑的方面。我不知道这是否真的是一个安全问题,或者我是否误解了什么 从这些文档中,我了解到,当智能合约在不同的对等方上实例化时,它的接口需要相同。这是否意味着我可以在智能合约功能中拥有不同的业务逻辑,同时在将其部署到不同的对等方时拥有相同的接口 如果我是对的,这不意味着设计中存在一个大的安全问题吗?如有助于更好地理解该概念,我们将不胜感激 链码接口定义严格,不能更改,接口为: // Chaincode interface mu

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

从这些文档中,我了解到,当智能合约在不同的对等方上实例化时,它的接口需要相同。这是否意味着我可以在智能合约功能中拥有不同的业务逻辑,同时在将其部署到不同的对等方时拥有相同的接口


如果我是对的,这不意味着设计中存在一个大的安全问题吗?如有助于更好地理解该概念,我们将不胜感激

链码接口定义严格,不能更改,接口为:

// 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方法执行。现在,在chaincode安装/实例化过程中,计算了chaincode的哈希值,并将其保存在绑定到chaincode的生命周期命名空间中。因此,如果另一个对等方将具有不同的二进制代码并尝试使用它,则对等方将无法执行它。

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方法执行。现在,在chaincode安装/实例化过程中,计算了chaincode的哈希值,并将其保存在绑定到chaincode的生命周期命名空间中。因此,如果另一个对等方将使用不同的二进制代码并尝试使用它,则对等方将无法执行它。

感谢您的澄清。但是,它如何决定哪一个对等方的二进制代码是有效的呢?就是您在Channel上用来实例化链码的代码。谢谢您的澄清。但它如何决定哪一个对等方的二进制代码是有效的呢?就是您用来在通道上实例化链码的那个