Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

Latest commit

 

History

History
85 lines (60 loc) · 2.76 KB

README.md

File metadata and controls

85 lines (60 loc) · 2.76 KB

Conga NFT Contract

Proof of concept containerised Fabric chaincode for use with fabric-builder-k8s

Based on the token-erc-721 example in fabric-samples

See fabric-builder-k8s samples for more recent examples in Go, Java, and Node.js

Dev container

Open in Remote - Containers

The badge above should launch this contract inside a prototype Fabric dev container

Once it has started, there should be a running microfab network, which you can use to deploy the contract to as follows

Configure the peer command environment

export FABRIC_LOGGING_SPEC=INFO
export CORE_PEER_TLS_ENABLED=false
export CORE_PEER_MSPCONFIGPATH=/var/opt/hyperledger/microfab/admin-org1
export FABRIC_CFG_PATH=/var/opt/hyperledger/microfab/peer-org1/config
export CORE_PEER_ADDRESS=$(yq .peer.address ${FABRIC_CFG_PATH}/core.yaml)
export CORE_PEER_LOCALMSPID=$(yq .peer.localMspId ${FABRIC_CFG_PATH}/core.yaml)

Create a chaincode-as-a-service package

~/fabric-samples/test-network/scripts/pkgcc.sh -l conga -a 0.0.0.0:9999

Note: ignore the error, which is due to a known issue

Install the chaincode package

peer lifecycle chaincode install conga.tgz

Export a PACKAGE_ID environment variable

export PACKAGE_ID=$(peer lifecycle chaincode calculatepackageid conga.tgz) && echo $PACKAGE_ID

Approve the chaincode

peer lifecycle \
  chaincode approveformyorg \
  --channelID     channel1 \
  --name          conga-nft \
  --version       1 \
  --package-id    ${PACKAGE_ID} \
  --sequence      1 \
  --orderer       orderer-api.127-0-0-1.nip.io:8080

Commit the chaincode

peer lifecycle \
  chaincode commit \
  --channelID     channel1 \
  --name          conga-nft \
  --version       1 \
  --sequence      1 \
  --orderer       orderer-api.127-0-0-1.nip.io:8080

Add the PACKAGE_ID environment variable to the .vscode/launch.json file

yq e '(.configurations[] | select(.name == "Debug chaincode") | .env.PACKAGE_ID) = strenv(PACKAGE_ID)' -i .vscode/launch.json

Start the chaincode in debug using vscode!

Check the chaincode works!

peer chaincode query -C channel1 -n conga-nft -c '{"Args":["org.hyperledger.fabric:GetMetadata"]}'