Konubinix' opinionated web of thoughts

How to Play With Fabric

Fleeting

How to play with fabric

DOCKER_IMAGE=bnc-hlf
DOCKER_NETWORK=bnc_network

if [[ -z "$(docker network ls -q -f name=$DOCKER_NETWORK)" ]]
then
        docker network create --driver=bridge $DOCKER_NETWORK
fi

docker run -it --rm --name bnc-hlf --network $DOCKER_NETWORK \
           -v /tmp/hyperledger-fabric-network:/tmp/hyperledger-fabric-network \
           -v volume_chaincode:/root/chaincode \
           -v volume_scripts:/root/scripts \
           -v /var/run/docker.sock:/var/run/docker.sock \
           bxforce/bnc-hlf:nightly $@

bnc run

peer1 > “0.0.0.0:7051->7051/tcp, 0.0.0.0:9443->9443/tcp”

  docker network create --driver=bridge bnc_network

  docker run -it --rm --name bnc-hlf --network bnc_network \
             -v /tmp/hyperledger-fabric-network:/tmp/hyperledger-fabric-network \
             -v volume_chaincode:/root/chaincode \
             -v volume_scripts:/root/scripts \
             -v /var/run/docker.sock:/var/run/docker.sock bxforce/bnc-hlf:nightly run

  # notice: rm /tmp/wallet when clean
  docker run -d --name transact --network bnc_network -v /tmp/hyperledger-fabric-network:/tmp/hyperledger-fabric-network -v /var/run/docker.sock:/var/run/docker.sock --entrypoint node bxforce/bnc-hlf:nightly transact.js invoke

  # test
  docker exec -it cli.org1.bnc.com /bin/bash -c "peer chaincode invoke -o orderer1.bnc.com:7050 \
-C mychannel \
-n mycc \
--peerAddresses peer1.org1.bnc.com:7051 \
-c '{\"Args\":[\"Init\",\"a\",\"100\",\"b\",\"100\"]}' \
--waitForEvent --tls \
--tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.bnc.com/peers/peer1.org1.bnc.com/tls/ca.crt \
--cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/bnc.com/orderers/orderer1.bnc.com/msp/tlscacerts/tlsca.bnc.com-cert.pem
"

from inside the cli container

getinfo -o orderer1.bnc.com:7050 -c mychannel --tls --certfile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.bnc.com/peers/peer1.org1.bnc.com/tls/ca.crt --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/bnc.com/orderers/orderer1.bnc.com/msp/tlscacerts/tlsca.bnc.com-cert.pem

An exemple of such a code https://github.com/bxforce/bnc-hlf/blob/fix-dockerization/tests/transact.js

docker run --rm  --name transact --network bnc_network -v /tmp/wallet:/tmp/wallet -v /home/sam/Prog/xdev/bnc-hlf/tests/transact.js:/transact.js -v /tmp/hyperledger-fabric-network:/tmp/hyperledger-fabric-network -v /var/run/docker.sock:/var/run/docker.sock --entrypoint node bxforce/bnc-hlf:nightly transact.js invoke