- Install Docker for Mac
- Pull images from DockerHub
docker pull hyperledger/fabric-peer:latest
docker pull hyperledger/fabric-membersrvc:latest
- Running the Peer and CA Create a docker-compose.yml file as below.
membersrvc:
image: hyperledger/fabric-membersrvc
ports:
- "7054:7054"
command: membersrvc
vp0:
image: hyperledger/fabric-peer
ports:
- "7050:7050"
- "7051:7051"
- "7053:7053"
environment:
- CORE_PEER_ADDRESSAUTODETECT=true
- CORE_VM_ENDPOINT=unix:///var/run/docker.sock
- CORE_LOGGING_LEVEL=DEBUG
- CORE_PEER_ID=vp0
- CORE_PEER_PKI_ECA_PADDR=membersrvc:7054
- CORE_PEER_PKI_TCA_PADDR=membersrvc:7054
- CORE_PEER_PKI_TLSCA_PADDR=membersrvc:7054
- CORE_SECURITY_ENABLED=true
- CORE_SECURITY_ENROLLID=test_vp0
- CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT
links:
- membersrvc
# The following is to run the peer in Developer mode - also set sample DEPLOY_MODE = dev
command: sh -c "sleep 5; peer node start --peer-chaincodedev"
Then, run below command in the same folder of docker-compose.yml to create the fabric-peer and fabric-membersrvc images
docker-compose up
- Build and Run the Chaincode
Install Fabric:
mkdir -p $GOPATH/src/github.com/hyperledger
cd $GOPATH/src/github.com/hyperledger
# The v0.6 release exists as a branch inside the Gerrit fabric repository
git clone -b v0.6 http://gerrit.hyperledger.org/r/fabric
Put the chaincode files uner "chaincode" folder
cd $GOPATH/src/chaincode
go build
Run the following command to start and register the chaincode with the validating peer, then a VM is instantiated. Please note, since we run the peer in Developer mode. Chaincode name can not be blank in development mode.That means we have to register a chaincode name like below, instead of deploying chaincode by its path.
CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS=0.0.0.0:7051 ./chaincode_example02
The chaincode console will display the message “Received REGISTERED, ready for invocations”, which indicates that the chaincode is ready to receive requests.
To stop a Docker container.
To stop a Docker container.
docker stop container Container_ID
The CA looks for an
You must first enroll a user from the user list in the membership service.
membersrvc.yaml
configuration file in $GOPATH/src/github.com/hyperledger/fabric/membersrvc.You must first enroll a user from the user list in the membership service.
Find an available user to enroll on one of your peers. This will most likely require you to grab a user from the membersrvc.yaml file for your network.
How to add peers(In yaml file in VM2) to existing membership services (in VM1). The VM1 has 2 peers and membership services up, but I want to have 2 more peers in another VM(Virtual Machine) and want them to connect with the blockchain setup in VM1??
ReplyDelete