fabric-samples icon indicating copy to clipboard operation
fabric-samples copied to clipboard

feat: Add Go implementation of full-stack-asset-transfer-guide smart contract (#1376)

Open nXtCyberNet opened this issue 8 months ago • 1 comments

Title: feat: add Go smart contract for full-stack-asset-transfer-guide

Closes: #1376

Summary This PR adds a Go implementation of the full-stack-asset-transfer-guide smart contract, equivalent to the existing TypeScript contract in asset-transfer-typescript. It allows developers who prefer Go to follow the guide without switching languages.

Changes Added a new directory asset-transfer-go containing the Go chaincode implementation.

Implemented asset lifecycle operations:

  • CreateAsset
  • ReadAsset
  • UpdateAsset
  • DeleteAsset
  • AssetExists
  • TransferAsset
  • GetAllAssets

Additional components:

  • main.go entry point to bootstrap the chaincode
  • go.mod / go.sum with required Fabric dependencies
  • Dockerfile and docker-entrypoint.sh for Chaincode-as-a-Service (CaaS) deployment
  • asset-transfer-chaincode-vars.yml for compatibility with workshop automation

Testing Tested locally in WSL Ubuntu against a live Microfab network.

  • Deployed chaincode in CaaS mode using weft chaincode package caas and the Fabric lifecycle (install → approve → commit)
  • Executed asset operations through the trader-go client on mychannel (org1MSP)
  • Verified chaincode events (CreateAsset, UpdateAsset, TransferAsset)

All 7 client commands (getAllAssets, transact, create, read, delete, transfer, listen) executed successfully.

Notes Uses standard Fabric Go chaincode patterns via github.com/hyperledger/fabric-contract-api-go. The asset data model mirrors the TypeScript implementation with minor adjustments for Go conventions.

nXtCyberNet avatar Mar 11 '26 06:03 nXtCyberNet

Hi @bestbeforetoday, could I get a review? As far as I understand, the CI failures were due to flakiness.

nXtCyberNet avatar Jul 29 '26 12:07 nXtCyberNet