Application development Configuration and build
You can use Go to develop applications and use the APIs available in the Hyperledger Fabric SDK Go to invoke the chain code to complete transactions in the blockchain network. At this stage we run the test project first.
Steps:
1. Sample application service-side code run
2. Download the certificate
3. Build the Certificate directory
4. Fabric SDK Configuration
5. Application Development
6. Application Configuration
7. Application Building
Step one: Sample App service-side code run
0. Root User Configuration
1, GO Environment installation
Resources download
Website address: https://golang.org/dl/
Download path: https://dl.google.com/go/go1.10.2.linux-amd64.tar.gz
Pressurized to the/usr/local/directory:
tar -xvf /root/Downloads/go1.10.2.linux-amd64.tar.gz -C /usr/local/
To configure an environment variable to open a configuration file:
vim ~/.bashrc
Fill in the following content:
export GOPATH=$HOME/goexport GOROOT=/usr/local/goexport PATH=$PATH:$GOROOT/bin:$GOPATH/bin
Permanent entry into force:
source ~/.bashrc
Check the installation results
go
2. Installation of Docker environment
# step 1: 安装必要的一些系统工具apt updateapt -y install apt-transport-https ca-certificates curl software-properties-common# step 2: 安装GPG证书curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -# Step 3: 写入软件源信息add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"# Step 4: 更新并安装 Docker-CEapt -y updateapt -y install docker-ce# Step 5: 检查安装结果docker version# Step 6: 安装composercurl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname - s)-$(uname -m) -o /usr/local/bin/docker-compose# Step 7: 修改权限chmod +x /usr/local/bin/docker-compose# Step 8: 检查安装结果docker-compose --version
3. Sample code Download
Service side: Api-server.rar
Front-end mirroring: Portal.rar
Attention
The directory structure after extracting the server files.
4, Go development tool installation
https://www.jetbrains.com/zh/go/specials/go/go.html?utm_source=baidu&utm_medium=cpc&utm_campaign= Cn-bai-pro-goland-ex-pc&utm_content=goland-ide&utm_term=go%20ide&gclid=cigqn4jqn9scfyflvaod1kyfaw &gclsrc=ds&dclid=cohqr4jqn9scfzswkgodo_khmq
5. Third-party Package installation
go get -u github.com/kardianos/govendorgo get -u github.com/astaxie/beegogo get -u github.com/beego/bee
6. Running Api-server
运行 bee run api-server
Image.png
Attention:
Project file and build file path problem. We use the Golang IDE to run the project. The build folder is placed under Gopath and the project file is placed in the GOPATH/SRC directory