Giter Club home page Giter Club logo

hlf-deploy's Introduction

Hyperledger Fabric Deploy

Fabric network deployment of this project is based on docker swarm multi-machine deployment.

中文教程

Start Network

Start Orderer

ORDERER_HOSTNAME=orderer \
    ORDERER_DOMAIN=example.com \
    ORDERER_GENERAL_LOCALMSPID=OrdererMSP \
    FABRIC_LOGGING_SPEC=debug \
    NODE_HOSTNAME=master \
    NETWORK=hlf \
    PORT=7050 \
    NFS_ADDR=192.168.51.10 \
    NFS_PATH=/nfsvolume \
    docker stack up -c orderer.yaml orderer

Start peer

Use LevelDB

PEER_HOSTNAME=peer0 \
    PEER_DOMAIN=org1.example.com \
    FABRIC_LOGGING_SPEC=debug \
    CORE_PEER_LOCALMSPID=Org1MSP \
    NODE_HOSTNAME=node1 \
    NETWORK=hlf \
    PORT=7051 \
    NFS_ADDR=192.168.51.10 \
    NFS_PATH=/nfsvolume \
    docker stack up -c peer-leveldb.yaml peer0org1

Use CouchDB

PEER_HOSTNAME=peer0 \
    PEER_DOMAIN=org1.example.com \
    FABRIC_LOGGING_SPEC=debug \
    CORE_PEER_LOCALMSPID=Org1MSP \
    NODE_HOSTNAME=node1 \
    NETWORK=hlf \
    PORT=7051 \
    NFS_ADDR=192.168.51.10 \
    NFS_PATH=/nfsvolume \
    docker stack up -c peer-couchdb.yaml peer0org1

Start CA Server

PEER_DOMAIN=org1.example.com \
    NODE_HOSTNAME=node1 \
    USERNAME=admin \
    PASSWORD=adminpwd \
    NETWORK=hlf \
    PORT=7054 \
    NFS_ADDR=192.168.51.10 \
    NFS_PATH=/nfsvolume \
    CA_PRIVEATE_KEY=$(cd ${NFS_PATH}/crypto-config/peerOrganizations/${PEER_DOMAIN}/ca && ls *_sk) \
    docker stack up -c ca.yaml peer0org1ca

Deploy Network

Create Channel

hlf-deploy createChannel --configFile config.yaml \
    --channelTxFile channel.tx \
    --channelName testchannel \
    --ordererOrgName OrdererOrg \
    Org1 Org2

Update Anchor Peer

hlf-deploy uptateAnchorPeer --configFile config.yaml \
    --anchorPeerTxFile anchor.tx \
    --channelName testchannel \
    --ordererOrgName OrdererOrg \
    Org1

Join Channel

hlf-deploy joinChannel --configFile config.yaml \
    --channelName testchannel \
    Org1 Org2

Install Chaincode

hlf-deploy installChaincode --configFile config.yaml \
    --goPath ./chaincode \
    --chaincodePath example02 \
    --chaincodeName example \
    --chaincodeVersion v0.1.0 \
    Org1 Org2

Instantiate Chaincode

hlf-deploy instantiateChaincode --configFile config.yaml \
    --channelName testchannel \
    --orgName Org1 \
    --chaincodePolicy Org1MSP,Org2MSP \
    --chaincodePolicyNOutOf 1 \
    --chaincodePath example02 \
    --chaincodeName example \
    --chaincodeVersion v0.0.0 \
    a 100 b 200

Upgrade Chaincode

hlf-deploy upgradeChaincode --configFile config.yaml \
    --channelName testchannel \
    --orgName Org1 \
    --chaincodePolicy Org1MSP,Org2MSP \
    --chaincodePolicyNOutOf 2 \
    --chaincodePath example02 \
    --chaincodeName example \
    --chaincodeVersion v0.1.0 \
    a 200 b 100

Query Chaincode

hlf-deploy queryChaincode --configFile config.yaml \
    --channelName testchannel \
    --orgName Org1 \
    --chaincodeName example \
    query a

Invoke Chaincode

hlf-deploy invokeChaincode --configFile config.yaml \
    --channelName testchannel \
    --orgName Org1 \
    --endorsementOrgsName Org1,Org2 \
    --chaincodeName example \
    invoke a b 50

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.