Reputation: 761
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
}
But it seems that the Hyperledger Fabric functionality for implementing token-UTXO: https://github.com/hyperledger/fabric-samples/tree/main/token-utxo
Is 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?
Thank you.
Upvotes: 0
Views: 256
Reputation: 2573
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.
For more details, see the contract API documentation.
Upvotes: 0