conga-nft-contract

command module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

README

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"]}'

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL