Fabric Standalone developer mode starts

Source: Internet
Author: User

Before you begin, you need to export a custom variable to facilitate subsequent operations:

Export fabric=/opt/gopath/src/github.com/hyperledger/fabric/devenv

1. Perform the following on the real machine to enter the virtual machine

CD $FABRICvagrant up // start a virtual machine SSH // Enter virtual machine

2. Perform the following actions in the virtual machine, start Memberserv and peer, and keep the terminal started, named T1

cd/opt/gopath/src/github.com/hyperledger/fabric/yamldocker-compose-f docker-compose-dev.yaml up

Attached Docker-compose-dev.yaml

MEMBERSRVC:  image:hyperledger/fabric-membersrvc  ports:    -"7054:7054"  command:membersrvcvp0:  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= False    -Core_security_enrollid=test_vp0    -CORE_SECURITY_ENROLLSECRET=MWYPMSRJUPBT  Links:    - MEMBERSRVC  command:sh-c "Sleep 5; Peer node start--peer-chaincodedev "

3. Open a new terminal, to start the Chaincode program, to keep the terminal open, named T2

SSH // Enter virtual machine CD/OPT/GOPATH/SRC/GITHUB.COM/HYPERLEDGER/FABRIC/EXAMPLES/CHAINCODE/GO/CHAINCODE_EXAMPLE02// go to the Chaincode directory where you want to deploy go build/ compile code, generate the CHAINCODE_EXAMPLE02 executable program core_chaincode_id_ NAME=MYCC01 core_peer_address=172.17. 0.3:7051 ./chaincode_example02// Register Chaincode and register a name for it Core_chaincode_id_name 

The return information is as follows:

02:06:56.192 [Shim] Debu:peer address:172.17.0.3:7051
02:06:56.197 [Shim] Debu:os. Args returns: [./chaincode_example02]
02:06:56.200 [Shim] debu:registering. Sending REGISTER
02:06:56.228 [Shim] Debu: []received message registered from Shim
02:06:56.229 [Shim] Debu: []handling chaincodemessage of type:registered (state:created)
02:06:56.229 [Shim] debu:received registered, ready for invocations

4. Open a new terminal for deploying the Chaincode program, named T3

SSH // Enter virtual machine core_peer_address=172.17. 0.3:7051'{"Args": ["Init"]}'// deployment Chaincode

Print at T2 Terminal:

02:07:10.906 [Shim] Debu: [mycc01]received message INIT from Shim
02:07:10.906 [Shim] Debu: [Mycc01]handling chaincodemessage of Type:init (state:established)
02:07:10.907 [Shim] debu:entered State init
02:07:10.907 [Shim] Debu: [mycc01]received INIT, initializing Chaincode
02:07:10.908 [Shim] Debu: [Mycc01]init succeeded. Sending completed
02:07:10.909 [Shim] Debu: [mycc01]move State message completed
02:07:10.909 [Shim] Debu: [Mycc01]handling chaincodemessage of type:completed (State:init)
02:07:10.909 [Shim] Debu: [mycc01]send State message completed
Print at T3 Terminal:

Deploy CHAINCODE:MYCC01

This returns the Chaincode ID, which is printed in production mode with the corresponding hash value of Chaincode

The corresponding invoke or query operation can then be performed.

Fabric Standalone developer mode starts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.