Reputation: 532
I am currently trying to learn Hyperledger Fabric , I managed to understand how to setup the network (Orderers, Peers, etc.) but now comes the part of the chaincode.
But, I found two different git repos for (what I understand) can be used to create chaincodes.
The first One being the fabric-contract-api-go, I followed their tutorials a while ago.
And the second one being the fabric-chaincode-go.
So my question is, what is the difference between these two packages, and which one should I use for writing chaincodes? Do you have resources or good examples? (other than the ones in the fabric-samples git)
I followed the fabric-contract-api tutorial and wrote a chaincode a while ago, but now I see people using the fabric-chaincode-go package, and I am a bit lost.
I am sorry, this question might sound stupid, but I don't have a Developer background. I have a SysAdmin background, and not used to GOLANG (but I am a fast learner, given to good resources).
Upvotes: 2
Views: 1433
Reputation: 1
Go to : https://readthedocs.org/projects/hlf/
scroll down to click on releases with version number
in opening webpage click => tutorial => Writing Your First Chaincode
u will open a page like this https://hlf.readthedocs.io/en/release-2.4/chaincode4ade.html#writing-your-first-chaincode
Now see which API is given for each release,
Hyper ledger versions
release-2.4 => Fabric Contract API
release-2.3 => FabricContractAPI description given only for GO, not nodejs or java.
for all below Hyperledger versions :Chaincode API
release-2.2 release-2.1 release-2.0 release- 1.4 release- 1.3 release- 1.2 release-I1.1 release- 1.0
Upvotes: -1
Reputation: 356
You can think of fabric-contract-api-go as a high-level api that builds on/requires the low-level api fabric-chaincode-go. It's possible to write golang chaincode using only the low-level api - in fact, this was the only option before Fabric 2.0, when the contract api was also added for golang. Previously, it only existed for node and java chaincode. If you have the option to use the contract api, doing so will e.g. save you some boiler plate code.
To see the difference, you can e.g. compare the fabcar example: in the 1.4 branch, it used the low-level api (shim). In the master branch however it uses the new contract-api.
Upvotes: 8