我是Hyperledger Fabric的新手,正在尝试进入Golang的智能合约开发。到目前为止,我读过的所有教程和来源都说,智能合约必须始终实现chaincode接口:
type Chaincode interface {
Init (stub ChaincodeStubInterface) pb.Response Invoke (stub ChaincodeStubInterface) pb.Response
}但是似乎用于实现token-UTXO:https://github.com/hyperledger/fabric-samples/tree/main/token-utxo的Hyperledger Fabric功能是一个智能合约,它没有从链码接口实现方法init或invoke。请参阅https://github.com/hyperledger/fabric-samples/tree/main/token-utxo/chaincode-go/chaincode
谁能解释一下,这个链码是如何在不实现它们的情况下工作的呢?
谢谢。
发布于 2021-05-02 19:37:56
较新的Fabric示例(如UTXO合约)利用较新的合约API。较新的约定API层实现了init和invoke函数,同时允许使用更高级别的抽象编写用户约定,其中应用程序的链代码函数可以直接在约定中实现。
有关更多详细信息,请参阅contract API documentation。
https://stackoverflow.com/questions/67313253
复制相似问题