Blockchain digital currency fabric development environment construction

Source: Internet
Author: User
Tags safe mode ssh git client git clone

Blockchain Enthusiast (qq:53016353)

I use the Vagrant method in Windows (other environment do not look down, I do not dare to guarantee) build, pro-Test no problem.

Preparatory work:


Git Client
Go-1.6 or later
Vagrant-1.7.4 or later
VirtualBox-5.0 or later


These must be used, Git is mainly used to synchronize the source code, go is to build the Go language compiler environment, because the source code is written in the go language. Click on the document Description link download, installation method and environment variable settings can Baidu, a lot of references, basically are more reliable. The latter two are more simple, download the installation on the line. In addition, because later to use the SSH command, I downloaded a Cygwin64 Terminal, install the selection package when the search OpenSSH, and then select this package, after installation, also need to configure the environment variables, specific Baidu.




Build steps:


The first step:


First make sure that you set up the build environment for the go language before you installed it.
Then, on the git command line, enter:


git config--get core.autocrlfgit
Config--global Core.autocrlf false


Not to delve into why, follow the documentation to the line.


Step Two:


Pull down the fabric source from GitHub


CD $GOPATH/SRC
git clone


$GOPATH This directory can be arbitrarily set under Windows, it is recommended to follow his words. The git clone command for the source document might be for a Linux ID, without his command.


Step Three:


Configuring virtual machines with vagrant


Vagrant up


Vagrant up for the first time is very long, sometimes broken, so it is recommended to FQ, and to global acceleration, the pro-test speed is really to stabilize some. The document said that after running this command you can drink coffee, to a few minutes, I am not satisfied.
After the vagrant is installed, most of the work is done, and then there are some things to deploy.
After that, the vagrant up starts up like this:




Deployment steps:


Open SSH:


Vagrant SSH


This time if not installed before the SSH, will be an error.




Security verification (optional):


This is optional, mainly used as member identity authentication, the specific role embodied in the following command plus username.


Make MEMBERSRVC && MEMBERSRVC




Run Verify peer:
Open another command-line window, run


Vagrant SSH


And then


Make peer
Peer node start--peer-chaincodedev


In this way, the peer node is up.




Compile Chaincode:


Open a separate command-line window to run:


Vagrant SSH


Then choose an example from the source code Chaincode model compilation


Go Build


Register and run Chaincode:


CORE_CHAINCODE_ID_NAME=MYCC core_peer_address=0.0.0.0:7051./chaincode_example02


MYCC is the name of Chaincode, can be arbitrarily determined, as long as in the subsequent process of corresponding use of the line.




CLI Debug:
I didn't use the rest way, with the CLI.


User registration:


Peer Network Login


Username to choose from inside the Membersrvc.yaml, for example Jim, then will ask to enter the password, the following password input on the line. The registration will then succeed.




The peer window can see the registration information:




Chaincode Deployment transactions:


Peer Chaincode deploy-n mycc-c ' {"Function": "Init", "Args": ["a", "+", "B", "200"]} '
If you are using Safe mode:
Core_security_enabled=true core_security_privacy=true Peer Chaincode deploy-u jim-n mycc-c ' {"Function": "Init", "Args" : ["A", "+", "B", "200"]} '


Chaincode of the call transaction:


Peer Chaincode invoke-l golang-n mycc-c ' {"Function": "Invoke", "Args": ["a", "B", "10"]} '
If you are using Safe mode:
Core_security_enabled=true core_security_privacy=true Peer Chaincode invoke-u jim-l golang-n mycc-c ' {"Function": "Inv Oke "," Args ": [" a "," B "," 10 "]} '


Chaincode's Enquiry transaction:


Peer Chaincode query-l golang-n mycc-c ' {"Function": "Query", "Args": ["B"]} '
Safe Mode:
Core_security_enabled=true core_security_privacy=true Peer Chaincode query-u jim-l golang-n mycc-c ' {"Function": "Quer Y "," Args ": [" B "]} '




Peer window




Chaincode window




Deploy, invoke, and query three trades can be seen in these several windows.


To delete a temporary file in Safe mode:


Vagrant SSH


First write this, and then the design logic of Hyperledger, I think clearly and continue to report to the people

Related Article

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.