hyperledger fabric 链码(智能合约)的安全问题
Security issue with hyperledger fabric's chain code (smart contract)
我在阅读 Hyperledger Fabric 的文档时发现了一个非常令人困惑的方面。不知道是不是真的安全问题,还是我理解错了什么。
根据文档的this section,我的理解是智能合约的interface
在不同节点上实例化时需要相同。这是否意味着我可以在智能合约功能中拥有不同的业务逻辑,同时在将其部署到不同的对等方时具有相同的界面?
如果我是对的,这是否意味着设计中存在重大安全问题?任何有助于更好地理解该概念的帮助将不胜感激。
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
方法执行。现在,在链码 install/instantiation 期间计算链码的哈希值并保存在绑定到链码的生命周期命名空间中。因此,如果另一个节点有不同的二进制代码并尝试使用它,节点将无法执行它。
我在阅读 Hyperledger Fabric 的文档时发现了一个非常令人困惑的方面。不知道是不是真的安全问题,还是我理解错了什么。
根据文档的this section,我的理解是智能合约的interface
在不同节点上实例化时需要相同。这是否意味着我可以在智能合约功能中拥有不同的业务逻辑,同时在将其部署到不同的对等方时具有相同的界面?
如果我是对的,这是否意味着设计中存在重大安全问题?任何有助于更好地理解该概念的帮助将不胜感激。
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
方法执行。现在,在链码 install/instantiation 期间计算链码的哈希值并保存在绑定到链码的生命周期命名空间中。因此,如果另一个节点有不同的二进制代码并尝试使用它,节点将无法执行它。