本文介绍了Hyperledger Fabric令牌UTXO不实现Chaincode接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Hyperledger Fabric的新手,正在尝试进入Golang中的智能合约开发.到目前为止,我阅读的所有教程和资源都说智能合约必须始终实现chaincode接口:

I'm new to Hyperledger Fabric, and trying to get into smart contract developing in Golang. Until now, all tutorials and sources I read said that a smart contract must always implement the chaincode interface:

type Chaincode interface {

Init (stub ChaincodeStubInterface) pb.Response Invoke (stub ChaincodeStubInterface) pb.Response

}

但似乎用于实现令牌-UTXO的Hyperledger Fabric功能: https://github.com/hyperledger/fabric-samples/tree/main/token-utxo 是一种智能合约,它没有从chaincode接口实现 init invoke 的方法.参见 https://github.com/hyperledger/fabric-samples/tree/main/token-utxo/chaincode-go/chaincode

But it seems that the Hyperledger Fabric functionality for implementing token-UTXO: https://github.com/hyperledger/fabric-samples/tree/main/token-utxoIs a smart contract which doesn't implement the methods init or invoke from the chaincode interface. See https://github.com/hyperledger/fabric-samples/tree/main/token-utxo/chaincode-go/chaincode

任何人都可以解释一下,如果不实施这些链码,它怎么可能起作用?

Can anyone explain how is it possible that this chaincode works without implementing them?

谢谢.

推荐答案

较新的Fabric示例(例如UTXO合同)利用了较新的合同API.较新的合同API层实现了init和invoke函数,同时允许使用更高级别的抽象来编写用户合同,其中可以在合同中直接实现应用程序的链码功能.

The newer Fabric samples such as the UTXO contract leverage the newer contract API. The newer contract API layer implements the init and invoke functions, while allowing user contracts to be written with a higher-level abstraction where the application's chaincode functions can be directly implemented in the contract.

有关更多详细信息,请参见合约API文档.

For more details, see the contract API documentation.

这篇关于Hyperledger Fabric令牌UTXO不实现Chaincode接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 20:54