Code Monkey home page Code Monkey logo

conga-nft-contract's Introduction

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

conga-nft-contract's People

Contributors

jt-nti avatar salimbene avatar ryjones avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.