Command line and cmc tools to build Changan chain multi-node clusters and deploy smart contracts

Configuration Environment

git

Download address: https://git-scm.com/downloads

For installation steps, please refer to: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git

golang

The version is 1.16-1.19

First check the go version

go version

If the version level is not enough, you need to upgrade the go version

Download address: https://golang.google.cn/dl/

This is the version I downloaded.
insert image description here
To find the storage path of the previous go version, you can use the command whereis go to display the storage path of go.

[root@ibt59 ~]# whereis go
go: /usr/bin/go

Backup the old version and unpack the new version

# 将旧版本备份
cd /usr/bin
mv go go.1.13.3

# 将新版本go压缩包解开当前目录
tar zxf go1.19.8.linux-amd64.tar.gz

# 目录下会释放出go目录
ls -l go
[root@ibt59 bin]# ls -l go
总用量 52
drwxr-xr-x  2 root root  4096 330 05:18 api
drwxr-xr-x  2 root root    29 330 05:19 bin
-rw-r--r--  1 root root    52 330 05:15 codereview.cfg
-rw-r--r--  1 root root  1339 330 05:15 CONTRIBUTING.md
drwxr-xr-x  2 root root    85 330 05:18 doc
drwxr-xr-x  3 root root    18 330 05:18 lib
-rw-r--r--  1 root root  1479 330 05:15 LICENSE
drwxr-xr-x 11 root root   152 330 05:18 misc
-rw-r--r--  1 root root  1303 330 05:15 PATENTS
drwxr-xr-x  6 root root    76 330 05:20 pkg
-rw-r--r--  1 root root  1455 330 05:15 README.md
-rw-r--r--  1 root root   419 330 05:15 SECURITY.md
drwxr-xr-x 48 root root  4096 330 05:18 src
drwxr-xr-x 26 root root 12288 330 05:18 test
-rw-r--r--  1 root root     8 330 05:15 VERSION

check go version

[root@ibt59 bin]# ./go version
go version go1.19.8 linux/amd64

Configuration Environment

Open the /etc/profile file, use the edit mode, and set the goroot address and path address

export GOROOT=/usr/bin/go
export PATH=$PATH:$GOROOT/bin
[root@ibt59 bin]# vim /etc/profile 
[root@ibt59 bin]# source /etc/profile
[root@ibt59 bin]# go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/root/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/bin/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/bin/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19.8"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1188625679=/tmp/go-build -gno-record-gcc-switches"
[root@ibt59 bin]# cd
[root@ibt59 ~]# go version
go version go1.19.8 linux/amd64

gcc

Check gcc version

gcc --version

If the displayed result is < 7.3, perform the following steps to upgrade

upgrade gcc

sudo yum install centos-release-scl
sudo yum install devtoolset-7-gcc*
scl enable devtoolset-7 bash
注意:第三条指令scl enable devtoolset-7

Bash only upgrades gcc in the current session. If you want to automatically upgrade gcc every time you log in, you can put scl enable devtoolset-7 bash in the ~/.bash_profile file.

[root@ibt59 ~]# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright © 2015 Free Software Foundation, Inc.
本程序是自由软件;请参看源代码的版权声明。本软件没有任何担保;
包括没有适销性和某一专用目的下的适用性担保。
[root@ibt59 ~]# sudo yum install centos-release-scl
已加载插件:fastestmirror, langpacks, priorities
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                                                                   | 3.6 kB  00:00:00     
epel                                                                                                                                                   | 4.7 kB  00:00:00     
extras                                                                                                                                                 | 2.9 kB  00:00:00     
updates                                                                                                                                                | 2.9 kB  00:00:00     
(1/2): epel/x86_64/updateinfo                                                                                                                          | 1.0 MB  00:00:02     
(2/2): epel/x86_64/primary_db                                                                                                                          | 7.0 MB  00:00:12     
正在解决依赖关系
--> 正在检查事务
---> 软件包 centos-release-scl.noarch.0.2-3.el7.centos 将被 安装
--> 正在处理依赖关系 centos-release-scl-rh,它被软件包 centos-release-scl-2-3.el7.centos.noarch 需要
--> 正在检查事务
---> 软件包 centos-release-scl-rh.noarch.0.2-3.el7.centos 将被 安装
--> 解决依赖关系完成

依赖关系解决

==============================================================================================================================================================================
 Package                                            架构                                版本                                        源                                   大小
==============================================================================================================================================================================
正在安装:
 centos-release-scl                                 noarch                              2-3.el7.centos                              extras                               12 k
为依赖而安装:
 centos-release-scl-rh                              noarch                              2-3.el7.centos                              extras                               12 k

事务概要
==============================================================================================================================================================================
安装  1 软件包 (+1 依赖软件包)

总下载量:24 k
安装大小:39 k
Is this ok [y/d/N]: y
Downloading packages:
(1/2): centos-release-scl-rh-2-3.el7.centos.noarch.rpm                                                                                                 |  12 kB  00:00:00     
(2/2): centos-release-scl-2-3.el7.centos.noarch.rpm                                                                                                    |  12 kB  00:00:00     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                           88 kB/s |  24 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : centos-release-scl-rh-2-3.el7.centos.noarch                                                                                                               1/2 
  正在安装    : centos-release-scl-2-3.el7.centos.noarch                                                                                                                  2/2 
  验证中      : centos-release-scl-2-3.el7.centos.noarch                                                                                                                  1/2 
  验证中      : centos-release-scl-rh-2-3.el7.centos.noarch                                                                                                               2/2 

已安装:
  centos-release-scl.noarch 0:2-3.el7.centos                                                                                                                                  

作为依赖被安装:
  centos-release-scl-rh.noarch 0:2-3.el7.centos                                                                                                                               

完毕!
[root@ibt59 ~]# sudo yum install devtoolset-7-gcc*
已加载插件:fastestmirror, langpacks, priorities
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * centos-sclo-rh: mirrors.bfsu.edu.cn
 * centos-sclo-sclo: mirrors.bfsu.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
centos-sclo-rh                                                                                                                                         | 3.0 kB  00:00:00     
centos-sclo-sclo                                                                                                                                       | 3.0 kB  00:00:00     
(1/2): centos-sclo-sclo/x86_64/primary_db                                                                                                              | 300 kB  00:00:00     
(2/2): centos-sclo-rh/x86_64/primary_db                                                                                                                | 3.4 MB  00:00:00     
正在解决依赖关系
--> 正在检查事务
---> 软件包 devtoolset-7-gcc.x86_64.0.7.3.1-5.16.el7 将被 安装
--> 正在处理依赖关系 devtoolset-7-binutils >= 2.22.52.0.1,它被软件包 devtoolset-7-gcc-7.3.1-5.16.el7.x86_64 需要
--> 正在处理依赖关系 devtoolset-7-runtime,它被软件包 devtoolset-7-gcc-7.3.1-5.16.el7.x86_64 需要
---> 软件包 devtoolset-7-gcc-c++.x86_64.0.7.3.1-5.16.el7 将被 安装
--> 正在处理依赖关系 devtoolset-7-libstdc++-devel = 7.3.1-5.16.el7,它被软件包 devtoolset-7-gcc-c++-7.3.1-5.16.el7.x86_64 需要
---> 软件包 devtoolset-7-gcc-gdb-plugin.x86_64.0.7.3.1-5.16.el7 将被 安装
---> 软件包 devtoolset-7-gcc-gfortran.x86_64.0.7.3.1-5.16.el7 将被 安装
--> 正在处理依赖关系 devtoolset-7-libquadmath-devel = 7.3.1-5.16.el7,它被软件包 devtoolset-7-gcc-gfortran-7.3.1-5.16.el7.x86_64 需要
--> 正在处理依赖关系 libgfortran4 >= 7.1.1-2,它被软件包 devtoolset-7-gcc-gfortran-7.3.1-5.16.el7.x86_64 需要
---> 软件包 devtoolset-7-gcc-plugin-devel.x86_64.0.7.3.1-5.16.el7 将被 安装
--> 正在处理依赖关系 libmpc-devel >= 0.8.1,它被软件包 devtoolset-7-gcc-plugin-devel-7.3.1-5.16.el7.x86_64 需要
--> 正在处理依赖关系 mpfr-devel >= 2.2.1,它被软件包 devtoolset-7-gcc-plugin-devel-7.3.1-5.16.el7.x86_64 需要
--> 正在检查事务
---> 软件包 devtoolset-7-binutils.x86_64.0.2.28-11.el7 将被 安装
---> 软件包 devtoolset-7-libquadmath-devel.x86_64.0.7.3.1-5.16.el7 将被 安装
---> 软件包 devtoolset-7-libstdc++-devel.x86_64.0.7.3.1-5.16.el7 将被 安装
---> 软件包 devtoolset-7-runtime.x86_64.0.7.1-4.el7 将被 安装
---> 软件包 libgfortran4.x86_64.0.8.3.1-2.1.1.el7 将被 安装
---> 软件包 libmpc-devel.x86_64.0.1.0.1-3.el7 将被 安装
---> 软件包 mpfr-devel.x86_64.0.3.1.1-4.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

==============================================================================================================================================================================
 Package                                                架构                           版本                                      源                                      大小
==============================================================================================================================================================================
正在安装:
 devtoolset-7-gcc                                       x86_64                         7.3.1-5.16.el7                            centos-sclo-rh                          29 M
 devtoolset-7-gcc-c++                                   x86_64                         7.3.1-5.16.el7                            centos-sclo-rh                          11 M
 devtoolset-7-gcc-gdb-plugin                            x86_64                         7.3.1-5.16.el7                            centos-sclo-rh                         124 k
 devtoolset-7-gcc-gfortran                              x86_64                         7.3.1-5.16.el7                            centos-sclo-rh                          11 M
 devtoolset-7-gcc-plugin-devel                          x86_64                         7.3.1-5.16.el7                            centos-sclo-rh                         1.3 M
为依赖而安装:
 devtoolset-7-binutils                                  x86_64                         2.28-11.el7                               centos-sclo-rh                         5.3 M
 devtoolset-7-libquadmath-devel                         x86_64                         7.3.1-5.16.el7                            centos-sclo-rh                         154 k
 devtoolset-7-libstdc++-devel                           x86_64                         7.3.1-5.16.el7                            centos-sclo-rh                         2.5 M
 devtoolset-7-runtime                                   x86_64                         7.1-4.el7                                 centos-sclo-rh                          20 k
 libgfortran4                                           x86_64                         8.3.1-2.1.1.el7                           base                                   686 k
 libmpc-devel                                           x86_64                         1.0.1-3.el7                               base                                    32 k
 mpfr-devel                                             x86_64                         3.1.1-4.el7                               base                                    68 k

事务概要
==============================================================================================================================================================================
安装  5 软件包 (+7 依赖软件包)

总下载量:62 M
安装大小:175 M
Is this ok [y/d/N]: y
Downloading packages:
警告:/var/cache/yum/x86_64/7/centos-sclo-rh/packages/devtoolset-7-binutils-2.28-11.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID f2ee9d55: NOKEY
devtoolset-7-binutils-2.28-11.el7.x86_64.rpm 的公钥尚未安装
(1/12): devtoolset-7-binutils-2.28-11.el7.x86_64.rpm                                                                                                   | 5.3 MB  00:00:00     
(2/12): devtoolset-7-gcc-c++-7.3.1-5.16.el7.x86_64.rpm                                                                                                 |  11 MB  00:00:00     
(3/12): devtoolset-7-gcc-7.3.1-5.16.el7.x86_64.rpm                                                                                                     |  29 MB  00:00:00     
(4/12): devtoolset-7-gcc-gdb-plugin-7.3.1-5.16.el7.x86_64.rpm                                                                                          | 124 kB  00:00:00     
(5/12): devtoolset-7-gcc-plugin-devel-7.3.1-5.16.el7.x86_64.rpm                                                                                        | 1.3 MB  00:00:00     
(6/12): devtoolset-7-libquadmath-devel-7.3.1-5.16.el7.x86_64.rpm                                                                                       | 154 kB  00:00:00     
(7/12): devtoolset-7-libstdc++-devel-7.3.1-5.16.el7.x86_64.rpm                                                                                         | 2.5 MB  00:00:00     
(8/12): devtoolset-7-gcc-gfortran-7.3.1-5.16.el7.x86_64.rpm                                                                                            |  11 MB  00:00:00     
(9/12): devtoolset-7-runtime-7.1-4.el7.x86_64.rpm                                                                                                      |  20 kB  00:00:00     
(10/12): libmpc-devel-1.0.1-3.el7.x86_64.rpm                                                                                                           |  32 kB  00:00:00     
(11/12): mpfr-devel-3.1.1-4.el7.x86_64.rpm                                                                                                             |  68 kB  00:00:00     
(12/12): libgfortran4-8.3.1-2.1.1.el7.x86_64.rpm                                                                                                       | 686 kB  00:00:01     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                           25 MB/s |  62 MB  00:00:02     
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo 检索密钥
导入 GPG key 0xF2EE9D55:
 用户ID     : "CentOS SoftwareCollections SIG (https://wiki.centos.org/SpecialInterestGroup/SCLo) <[email protected]>"
 指纹       : c4db d535 b1fb ba14 f8ba 64a8 4eb8 4e71 f2ee 9d55
 软件包     : centos-release-scl-rh-2-3.el7.centos.noarch (@extras)
 来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
是否继续?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : devtoolset-7-runtime-7.1-4.el7.x86_64                                                                                                                    1/12 
  正在安装    : mpfr-devel-3.1.1-4.el7.x86_64                                                                                                                            2/12 
  正在安装    : libmpc-devel-1.0.1-3.el7.x86_64                                                                                                                          3/12 
  正在安装    : devtoolset-7-binutils-2.28-11.el7.x86_64                                                                                                                 4/12 
  正在安装    : devtoolset-7-libstdc++-devel-7.3.1-5.16.el7.x86_64                                                                                                       5/12 
  正在安装    : libgfortran4-8.3.1-2.1.1.el7.x86_64                                                                                                                      6/12 
  正在安装    : devtoolset-7-gcc-7.3.1-5.16.el7.x86_64                                                                                                                   7/12 
  正在安装    : devtoolset-7-libquadmath-devel-7.3.1-5.16.el7.x86_64                                                                                                     8/12 
  正在安装    : devtoolset-7-gcc-gfortran-7.3.1-5.16.el7.x86_64                                                                                                          9/12 
  正在安装    : devtoolset-7-gcc-plugin-devel-7.3.1-5.16.el7.x86_64                                                                                                     10/12 
  正在安装    : devtoolset-7-gcc-gdb-plugin-7.3.1-5.16.el7.x86_64                                                                                                       11/12 
  正在安装    : devtoolset-7-gcc-c++-7.3.1-5.16.el7.x86_64                                                                                                              12/12 
  验证中      : libmpc-devel-1.0.1-3.el7.x86_64                                                                                                                          1/12 
  验证中      : devtoolset-7-gcc-gfortran-7.3.1-5.16.el7.x86_64                                                                                                          2/12 
  验证中      : devtoolset-7-gcc-plugin-devel-7.3.1-5.16.el7.x86_64                                                                                                      3/12 
  验证中      : devtoolset-7-gcc-gdb-plugin-7.3.1-5.16.el7.x86_64                                                                                                        4/12 
  验证中      : devtoolset-7-libquadmath-devel-7.3.1-5.16.el7.x86_64                                                                                                     5/12 
  验证中      : devtoolset-7-gcc-7.3.1-5.16.el7.x86_64                                                                                                                   6/12 
  验证中      : libgfortran4-8.3.1-2.1.1.el7.x86_64                                                                                                                      7/12 
  验证中      : devtoolset-7-binutils-2.28-11.el7.x86_64                                                                                                                 8/12 
  验证中      : devtoolset-7-libstdc++-devel-7.3.1-5.16.el7.x86_64                                                                                                       9/12 
  验证中      : devtoolset-7-gcc-c++-7.3.1-5.16.el7.x86_64                                                                                                              10/12 
  验证中      : mpfr-devel-3.1.1-4.el7.x86_64                                                                                                                           11/12 
  验证中      : devtoolset-7-runtime-7.1-4.el7.x86_64                                                                                                                   12/12 

已安装:
  devtoolset-7-gcc.x86_64 0:7.3.1-5.16.el7               devtoolset-7-gcc-c++.x86_64 0:7.3.1-5.16.el7               devtoolset-7-gcc-gdb-plugin.x86_64 0:7.3.1-5.16.el7     
  devtoolset-7-gcc-gfortran.x86_64 0:7.3.1-5.16.el7      devtoolset-7-gcc-plugin-devel.x86_64 0:7.3.1-5.16.el7     

作为依赖被安装:
  devtoolset-7-binutils.x86_64 0:2.28-11.el7        devtoolset-7-libquadmath-devel.x86_64 0:7.3.1-5.16.el7        devtoolset-7-libstdc++-devel.x86_64 0:7.3.1-5.16.el7       
  devtoolset-7-runtime.x86_64 0:7.1-4.el7           libgfortran4.x86_64 0:8.3.1-2.1.1.el7                         libmpc-devel.x86_64 0:1.0.1-3.el7                          
  mpfr-devel.x86_64 0:3.1.1-4.el7                  

完毕!
[root@ibt59 ~]# scl enable devtoolset-7 bash
[root@ibt59 ~]# gcc --version
gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Environment build

build using script

Source code download

Download the source code from the official website of Changan Chain: https://git.chainmaker.org.cn/chainmaker/chainmaker-go

It is currently a private warehouse, and account registration is required first

Download chainmaker-go source code to local

$ git clone -b v2.3.1 --depth=1 https://git.chainmaker.org.cn/chainmaker/chainmaker-go.git

Download the source code of the certificate generation tool to the local

$ git clone -b v2.3.0  --depth=1 https://git.chainmaker.org.cn/chainmaker/chainmaker-cryptogen.git

source code compilation

编译证书生成工具

$ cd chainmaker-cryptogen
$ make
[root@ibt59 ~]# cd
[root@ibt59 ~]# ls
anaconda-ks.cfg  go1.19.8.linux-amd64.tar.gz  initial-setup-ks.cfg  mysql80-community-release-el7-5.noarch.rpm  tqxtsd8  公共  模板  视频  图片  文档  下载  音乐  桌面
[root@ibt59 ~]# mkdir lj
[root@ibt59 ~]# ls
anaconda-ks.cfg  go1.19.8.linux-amd64.tar.gz  initial-setup-ks.cfg  lj  mysql80-community-release-el7-5.noarch.rpm  tqxtsd8  公共  模板  视频  图片  文档  下载  音乐  桌面
[root@ibt59 ~]# cd lj
[root@ibt59 lj]# mkdir chainmaker
[root@ibt59 lj]# cd chainmaker
[root@ibt59 chainmaker]# git clone -b v2.3.1 --depth=1 https://git.chainmaker.org.cn/chainmaker/chainmaker-go.git
正克隆到 'chainmaker-go'...
Username for 'https://git.chainmaker.org.cn': YITAHUTU79
Password for 'https://[email protected]': 
fatal: Authentication failed for 'https://git.chainmaker.org.cn/chainmaker/chainmaker-go.git/'
[root@ibt59 chainmaker]# git clone -b v2.3.1 --depth=1 https://git.chainmaker.org.cn/chainmaker/chainmaker-go.git
正克隆到 'chainmaker-go'...
Username for 'https://git.chainmaker.org.cn': yitahutu79
Password for 'https://[email protected]': 
fatal: Authentication failed for 'https://git.chainmaker.org.cn/chainmaker/chainmaker-go.git/'
[root@ibt59 chainmaker]# git clone -b v2.3.1 --depth=1 https://git.chainmaker.org.cn/chainmaker/chainmaker-go.git
正克隆到 'chainmaker-go'...
Username for 'https://git.chainmaker.org.cn': Jie LI^Hi^H^H^H^H^C
[root@ibt59 chainmaker]# git clone -b v2.3.1 --depth=1 https://git.chainmaker.org.cn/chainmaker/chainmaker-go.git
正克隆到 'chainmaker-go'...
Username for 'https://git.chainmaker.org.cn': Jie Li
Password for 'https://Jie [email protected]': 
fatal: Authentication failed for 'https://git.chainmaker.org.cn/chainmaker/chainmaker-go.git/'
[root@ibt59 chainmaker]# git clone -b v2.3.1 --depth=1 https://git.chainmaker.org.cn/chainmaker/chainmaker-go.git
正克隆到 'chainmaker-go'...
Username for 'https://git.chainmaker.org.cn': yitahutu79
Password for 'https://[email protected]': 
remote: Enumerating objects: 1622, done.
remote: Counting objects: 100% (1622/1622), done.
remote: Compressing objects: 100% (1242/1242), done.
remote: Total 1622 (delta 379), reused 1106 (delta 219), pack-reused 0
接收对象中: 100% (1622/1622), 19.36 MiB | 2.01 MiB/s, done.
处理 delta 中: 100% (379/379), done.
Note: checking out 'cbff51b74fdbc75b4b54cd6c0804ff40e31dbfd5'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

[root@ibt59 chainmaker]#  git clone -b v2.3.0  --depth=1 https://git.chainmaker.org.cn/chainmaker/chainmaker-cryptogen.git
正克隆到 'chainmaker-cryptogen'...
remote: Enumerating objects: 37, done.
remote: Counting objects: 100% (37/37), done.
remote: Compressing objects: 100% (30/30), done.
remote: Total 37 (delta 9), reused 32 (delta 7), pack-reused 0
Unpacking objects: 100% (37/37), done.
[root@ibt59 chainmaker]# ls
chainmaker-cryptogen  chainmaker-go
[root@ibt59 chainmaker]# cd chainmaker-cryptogen
[root@ibt59 chainmaker-cryptogen]# make
go: chainmaker.org/chainmaker/common/[email protected]: Get "https://proxy.golang.org/chainmaker.org/chainmaker/common/v2/@v/v2.3.0.mod": dial tcp [2404:6800:4012:4::2011]:443: i/o timeout
go: downloading chainmaker.org/chainmaker/common/v2 v2.3.0
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/spf13/viper v1.7.1
go: downloading github.com/spf13/cobra v1.1.1
go: downloading github.com/mr-tron/base58 v1.2.0
go: chainmaker.org/chainmaker/common/[email protected]: Get "https://proxy.golang.org/chainmaker.org/chainmaker/common/v2/@v/v2.3.0.mod": dial tcp [2404:6800:4012:4::2011]:443: i/o timeout
make: *** [chainmaker-cryptogen] 错误 1
[root@ibt59 chainmaker-cryptogen]# 
[root@ibt59 chainmaker-cryptogen]# 
[root@ibt59 chainmaker-cryptogen]# 
[root@ibt59 chainmaker-cryptogen]# 
[root@ibt59 chainmaker-cryptogen]# 
[root@ibt59 chainmaker-cryptogen]# 
[root@ibt59 chainmaker-cryptogen]# 
[root@ibt59 chainmaker-cryptogen]# make
go: chainmaker.org/chainmaker/common/[email protected]: Get "https://proxy.golang.org/chainmaker.org/chainmaker/common/v2/@v/v2.3.0.mod": dial tcp [2404:6800:4012:4::2011]:443: i/o timeout
go: downloading chainmaker.org/chainmaker/common/v2 v2.3.0
go: downloading github.com/spf13/cobra v1.1.1
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/spf13/viper v1.7.1
go: downloading github.com/mr-tron/base58 v1.2.0
go: chainmaker.org/chainmaker/common/[email protected]: Get "https://proxy.golang.org/chainmaker.org/chainmaker/common/v2/@v/v2.3.0.mod": dial tcp [2404:6800:4012:4::2011]:443: i/o timeout
make: *** [chainmaker-cryptogen] 错误 1
[root@ibt59 chainmaker-cryptogen]#  go env -w GOPROXY=https://goproxy.cn
[root@ibt59 chainmaker-cryptogen]# make
go: downloading github.com/spf13/cobra v1.1.1
go: downloading chainmaker.org/chainmaker/common/v2 v2.3.0
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/spf13/viper v1.7.1
go: downloading github.com/mr-tron/base58 v1.2.0
go: downloading github.com/inconshreveable/mousetrap v1.0.0
go: downloading github.com/spf13/pflag v1.0.5
go: downloading github.com/fsnotify/fsnotify v1.4.9
go: downloading github.com/hashicorp/hcl v1.0.0
go: downloading github.com/magiconair/properties v1.8.1
go: downloading github.com/mitchellh/mapstructure v1.1.2
go: downloading github.com/pelletier/go-toml v1.2.0
go: downloading github.com/spf13/afero v1.5.1
go: downloading github.com/spf13/cast v1.3.0
go: downloading github.com/spf13/jwalterweatherman v1.0.0
go: downloading github.com/subosito/gotenv v1.2.0
go: downloading gopkg.in/ini.v1 v1.51.0
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading github.com/stretchr/testify v1.7.0
go: downloading github.com/miekg/pkcs11 v1.0.3
go: downloading github.com/tjfoc/gmsm v1.4.1
go: downloading golang.org/x/crypto v0.0.0-20210817164053-32db794688a5
go: downloading github.com/btcsuite/btcd v0.21.0-beta
go: downloading github.com/multiformats/go-multiaddr v0.3.1
go: downloading github.com/google/uuid v1.1.2
go: downloading golang.org/x/sys v0.0.0-20220222200937-f2425489ef4c
go: downloading github.com/BurntSushi/toml v0.3.1
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading golang.org/x/text v0.3.6
go: downloading github.com/smartystreets/goconvey v1.6.4
go: downloading gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
go: downloading github.com/gogo/protobuf v1.3.2
go: downloading github.com/libp2p/go-libp2p-core v0.6.1
go: downloading github.com/libp2p/go-openssl v0.0.7
go: downloading github.com/minio/sha256-simd v0.1.1
go: downloading github.com/multiformats/go-multihash v0.0.14
go: downloading github.com/hashicorp/golang-lru v0.5.4
go: downloading github.com/ipfs/go-cid v0.0.7
go: downloading github.com/multiformats/go-varint v0.0.6
go: downloading github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e
go: downloading github.com/jtolds/gls v4.20.0+incompatible
go: downloading github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d
go: downloading github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572
go: downloading github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1
go: downloading github.com/spaolacci/murmur3 v1.1.0
go: downloading github.com/kr/text v0.1.0
go: downloading github.com/multiformats/go-multibase v0.0.3
go: downloading github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1
go: downloading github.com/multiformats/go-base36 v0.1.0
go: downloading github.com/multiformats/go-base32 v0.0.3
chainmaker-cryptogen/
chainmaker-cryptogen/bin/
chainmaker-cryptogen/bin/chainmaker-cryptogen
chainmaker-cryptogen/config/
chainmaker-cryptogen/config/crypto_config_template.yml

Configuration file generation

Soft link the compiled chainmaker-cryptogen to the chainmaker-go/tools directory

#进入工具目录
$ cd chainmaker-go/tools

#软连接chainmaker-cryptogen到tools目录下
$ ln -s ../../chainmaker-cryptogen/ .
[root@ibt59 chainmaker-cryptogen]# ls
bin  config  LICENSE  Makefile  NOTICE  README.md  release  src
[root@ibt59 chainmaker-cryptogen]# cd ..
[root@ibt59 chainmaker]# ls
chainmaker-cryptogen  chainmaker-go
[root@ibt59 chainmaker]# cd chainmaker-go/tools
[root@ibt59 tools]# ls
cmc  scanner  simple-leveldb
[root@ibt59 tools]# ln -s ../../chainmaker-cryptogen/ .
[root@ibt59 tools]# ls
chainmaker-cryptogen  cmc  scanner  simple-leveldb

PermissionedWithCert

The original identity mode, the certificate mode

Enter the chainmaker-go/scripts directory, execute the prepare.sh script to generate a single-chain 4-node cluster configuration, and save it in the path chainmaker-go/build

The prepare.sh script supports the generation of solo mode node certificates and configurations, as well as certificates and configurations of 4/7/10/13/16 nodes

# 进入脚本目录
$ cd ../scripts

# 查看脚本帮助
$ ./prepare.sh -h
Usage:  
  prepare.sh node_cnt(1/4/7/10/13/16) chain_cnt(1-4) p2p_port(default:11301) rpc_port(default:12301)
    eg1: prepare.sh 4 1
    eg2: prepare.sh 4 1 11301 12301

# 生成单链4节点集群的证书和配置
$ ./prepare.sh 4 1
begin check params...
begin generate certs, cnt: 4
input consensus type (0-SOLO,1-TBFT(default),3-HOTSTUFF,4-RAFT,5-DPOS):
input log level (DEBUG|INFO(default)|WARN|ERROR):
enable docker vm (YES|NO(default))
begin generate node1 config...
begin generate node2 config...
begin generate node3 config...
begin generate node4 config...

# 查看生成好的节点证书和配置
$ tree -L 3 ../build/
../build/
├── config
│   ├── node1
│   │   ├── certs
│   │   ├── chainconfig
│   │   ├── chainmaker.yml
│   │   └── log.yml
│   ├── node2
│   │   ├── certs
│   │   ├── chainconfig
│   │   ├── chainmaker.yml
│   │   └── log.yml
│   ├── node3
│   │   ├── certs
│   │   ├── chainconfig
│   │   ├── chainmaker.yml
│   │   └── log.yml
│   └── node4
│       ├── certs
│       ├── chainconfig
│       ├── chainmaker.yml
│       └── log.yml
├── crypto-config
│   ├── wx-org1.chainmaker.org
│   │   ├── ca
│   │   ├── node
│   │   └── user
│   ├── wx-org2.chainmaker.org
│   │   ├── ca
│   │   ├── node
│   │   └── user
│   ├── wx-org3.chainmaker.org
│   │   ├── ca
│   │   ├── node
│   │   └── user
│   └── wx-org4.chainmaker.org
│       ├── ca
│       ├── node
│       └── user
└── crypto_config.yml

Regarding the automatically generated port description:

The configuration generated by the prepare.sh script is deployed on a single server by default, so the automatically generated port numbers are incremented sequentially from a starting port number, and the starting port number can be modified through command line parameters.

There are mainly two ports, p2p port (for node interconnection) and rpc port (for client-node communication), p2p start port is 11301, rpc start port is 12301.

If the configuration of 4 nodes is generated, the p2p ports are: 11301, 11302, 11303, 11304, and the rpc ports are: 12301, 12302, 12303, 12304

[root@ibt59 tools]# cd ..
[root@ibt59 chainmaker-go]# ls
config  config-pk  config-sql  DOCKER  go.mod  go.sum  LICENSE  main  Makefile  module  monitor  NOTICE  README.md  scripts  test  tools
[root@ibt59 chainmaker-go]# cd scripts
[root@ibt59 scripts]# ls
bin               cluster_quick_start.sh  docker           prepare_pk.sh   prepare.sh                    service  ut_cover.sh
build_release.sh  cluster_quick_stop.sh   gomod_update.sh  prepare_pwk.sh  range_cluster_quick_start.sh  test
[root@ibt59 scripts]# ./prepare.sh -h
Usage:  
    prepare.sh node_cnt(1/4/7/10/13/16) chain_cnt(1-4)
               p2p_port(default:11301) rpc_port(default:12301)
               vm_go_runtime_port(default:32351) vm_go_engine_port(default:22351)
               -c consense-type: 1-TBFT,3-MAXBFT,4-RAFT 
               -l log-level: DEBUG,INFO,WARN,ERROR
               -v docker-vm-enable: true,false
                  --vtp  vm go transport protocol: tcp,uds
                  --vlog vm go log level: DEBUG,INFO,WARN,ERROR
               -h show help
    eg1: prepare.sh 4 1
    eg2: prepare.sh 4 1 11301 12301
    eg2: prepare.sh 4 1 11301 12301 32351 22351
    eg2: prepare.sh 4 1 11301 12301 32351 22351 -c 1 -l INFO -v true  --vtp=tcp --vlog=INFO
    eg2: prepare.sh 4 1 11301 12301 32351 22351 -c 1 -l INFO -v false --vtp=tcp --vlog=INFO
[root@ibt59 scripts]# ./prepare.sh 4 1
begin check params...
param P2P_PORT 11301
param RPC_PORT 12301
param VM_GO_RUNTIME_PORT 32351
param VM_GO_ENGINE_PORT 22351
input consensus type (1-TBFT(default),3-MAXBFT,4-RAFT): 
param CONSENSUS_TYPE 1
input log level (DEBUG|INFO(default)|WARN|ERROR): 
param LOG_LEVEL INFO
enable vm go (YES|NO(default))
param ENABLE_VM_GO false

config node total 4
begin generate node1 config...
begin node1 chain1 cert config...
begin node1 trust config...
begin generate node2 config...
begin node2 chain1 cert config...
begin node2 trust config...
begin generate node3 config...
begin node3 chain1 cert config...
begin node3 trust config...
begin generate node4 config...
begin node4 chain1 cert config...
begin node4 trust config...
[root@ibt59 scripts]#  tree -L 3 ../build/
bash: tree: 未找到命令...
[root@ibt59 scripts]# yum install tree
已加载插件:fastestmirror, langpacks, priorities
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * centos-sclo-rh: mirrors.bfsu.edu.cn
 * centos-sclo-sclo: mirrors.bfsu.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 tree.x86_64.0.1.6.0-10.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

==============================================================================================================================================================================
 Package                                架构                                     版本                                            源                                      大小
==============================================================================================================================================================================
正在安装:
 tree                                   x86_64                                   1.6.0-10.el7                                    base                                    46 k

事务概要
==============================================================================================================================================================================
安装  1 软件包

总下载量:46 k
安装大小:87 k
Is this ok [y/d/N]: y
Downloading packages:
tree-1.6.0-10.el7.x86_64.rpm                                                                                                                           |  46 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : tree-1.6.0-10.el7.x86_64                                                                                                                                  1/1 
  验证中      : tree-1.6.0-10.el7.x86_64                                                                                                                                  1/1 

已安装:
  tree.x86_64 0:1.6.0-10.el7                                                                                                                                                  

完毕!
[root@ibt59 scripts]#  tree -L 3 ../build/
../build/
├── config
│   ├── node1
│   │   ├── certs
│   │   ├── chainconfig
│   │   ├── chainmaker.yml
│   │   └── log.yml
│   ├── node2
│   │   ├── certs
│   │   ├── chainconfig
│   │   ├── chainmaker.yml
│   │   └── log.yml
│   ├── node3
│   │   ├── certs
│   │   ├── chainconfig
│   │   ├── chainmaker.yml
│   │   └── log.yml
│   └── node4
│       ├── certs
│       ├── chainconfig
│       ├── chainmaker.yml
│       └── log.yml
├── crypto-config
│   ├── wx-org1.chainmaker.org
│   │   ├── ca
│   │   ├── node
│   │   └── user
│   ├── wx-org2.chainmaker.org
│   │   ├── ca
│   │   ├── node
│   │   └── user
│   ├── wx-org3.chainmaker.org
│   │   ├── ca
│   │   ├── node
│   │   └── user
│   └── wx-org4.chainmaker.org
│       ├── ca
│       ├── node
│       └── user
├── crypto_config.yml
└── pkcs11_keys.yml

30 directories, 10 files

Compilation and installation package production

After generating the certificate (prepare.sh script), execute the build_release.sh script, the chainmaker-go module will be compiled, packaged and installed, and stored in the path chainmaker-go/build/release

$ ./build_release.sh
$ tree ../build/release/
../build/release/
├── chainmaker-v2.0.0-wx-org1.chainmaker.org-20210406194833-x86_64.tar.gz
├── chainmaker-v2.0.0-wx-org2.chainmaker.org-20210406194833-x86_64.tar.gz
├── chainmaker-v2.0.0-wx-org3.chainmaker.org-20210406194833-x86_64.tar.gz
├── chainmaker-v2.0.0-wx-org4.chainmaker.org-20210406194833-x86_64.tar.gz
└── crypto-config-20210406194833.tar.gz

Start the cluster of nodes

Executing the cluster_quick_start.sh script will decompress each installation package, call the start.sh script in the bin directory, and start the chainmaker node

$ ./cluster_quick_start.sh normal

After the startup is successful, back up *.tar.gz, so as not to overwrite the file when it is decompressed again at the next startup

$ mkdir -p ../build/bak
$ mv ../build/release/*.tar.gz ../build/bak

If you need to shut down the cluster, use the script:

$ ./cluster_quick_stop.sh

Check that the node is started and used normally

Check if the process exists

$ ps -ef|grep chainmaker | grep -v grep
25261  2146  4 19:55 pts/20   00:00:01 ./chainmaker start -c ../config/wx-org1.chainmaker.org/chainmaker.yml
25286  2146  4 19:55 pts/20   00:00:01 ./chainmaker start -c ../config/wx-org2.chainmaker.org/chainmaker.yml
25309  2146  4 19:55 pts/20   00:00:01 ./chainmaker start -c ../config/wx-org3.chainmaker.org/chainmaker.yml
25335  2146  4 19:55 pts/20   00:00:01 ./chainmaker start -c ../config/wx-org4.chainmaker.org/chainmaker.yml

Check if the port is listening

$ netstat -lptn | grep 1230
tcp6       0      0 :::12301                :::*                    LISTEN      25261/./chainmaker  
tcp6       0      0 :::12302                :::*                    LISTEN      25286/./chainmaker  
tcp6       0      0 :::12303                :::*                    LISTEN      25309/./chainmaker  
tcp6       0      0 :::12304                :::*                    LISTEN      25335/./chainmaker 

Check if the node has ERROR logs

$ cat ../build/release/*/bin/panic.log
$ cat ../build/release/*/log/system.log
$ cat ../build/release/*/log/system.log |grep "ERROR\|put block\|all necessary"
//若看到all necessary peers connected则表示节点已经准备就绪。

Use the CMC command line tool to deploy and call the contract

In order to verify whether the function of the built chain is normal, it can be verified through the cmc command line tool.

compile & configure

The compilation and operation of the cmc tool are as follows:

Create a working directory $WORKDIR such as ~/chainmaker to start the test chain and use a script to build it in the working directory

# 编译cmc
$ cd $WORKDIR/chainmaker-go/tools/cmc
$ go build
# 配置测试数据
$ cp -rf ../../build/crypto-config ../../tools/cmc/testdata/ # 使用chainmaker-cryptogen生成的测试链的证书
# 查看help
$ cd ../../chainmaker-go/tools/cmc
$ ./cmc --help
[root@ibt59 scripts]# cd ..
[root@ibt59 chainmaker-go]# cd tools
[root@ibt59 tools]# ls
chainmaker-cryptogen  cmc  scanner  simple-leveldb
[root@ibt59 tools]# cd cmc
[root@ibt59 cmc]# ls
address  bulletproofs  client   gas   key               main.go   parallel  pubkey  README.md  testdata  types  version
archive  cert          console  hibe  loop-transfer.sh  paillier  payload   query   tee        txpool    util
[root@ibt59 cmc]# go build
[root@ibt59 cmc]# cp -rf ../../build/crypto-config ../../tools/cmc/testdata/
[root@ibt59 cmc]# cd ../../chainmaker-go/tools/cmc
bash: cd: ../../chainmaker-go/tools/cmc: 没有那个文件或目录
[root@ibt59 cmc]# ./cmc --help
Command line interface for interacting with ChainMaker daemon.
For detailed logs, please see ./sdk.log

Usage:
  cmc [command]

Available Commands:
  address      address parse command
  archive      archive blockchain data
  bulletproofs ChainMaker bulletproofs command
  cert         ChainMaker cert command
  client       client command
  console      Open a console to interact with ChainMaker daemon
  gas          gas management
  help         Help about any command
  hibe         ChainMaker hibe command
  key          ChainMaker key command
  paillier     ChainMaker paillier command
  parallel     Parallel
  payload      Payload command
  pubkey       pk management command.
  query        query on-chain blockchain data
  tee          trust execute environment command.
  txpool       txpool command
  version      Show ChainMaker Client version

Flags:
  -h, --help   help for cmc

Use "cmc [command] --help" for more information about a command.

Deploy the example contract

Create a wasm contract

$ ./cmc client contract user create \
--contract-name=fact \
--runtime-type=WASMER \
--byte-code-path=./testdata/claim-wasm-demo/rust-fact-2.0.0.wasm \
--version=1.0 \
--sdk-conf-path=./testdata/sdk_config.yml \
--admin-key-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/admin1/admin1.sign.key,./testdata/crypto-config/wx-org2.chainmaker.org/user/admin1/admin1.sign.key,./testdata/crypto-config/wx-org3.chainmaker.org/user/admin1/admin1.sign.key \
--admin-crt-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/admin1/admin1.sign.crt,./testdata/crypto-config/wx-org2.chainmaker.org/user/admin1/admin1.sign.crt,./testdata/crypto-config/wx-org3.chainmaker.org/user/admin1/admin1.sign.crt \
--sync-result=true \
--params="{}"
[root@ibt59 cmc]# ./cmc client contract user create \
> --contract-name=fact \
> --runtime-type=WASMER \
> --byte-code-path=./testdata/claim-wasm-demo/rust-fact-2.0.0.wasm \
> --version=1.0 \
> --sdk-conf-path=./testdata/sdk_config.yml \
> --admin-key-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/admin1/admin1.sign.key,./testdata/crypto-config/wx-org2.chainmaker.org/user/admin1/admin1.sign.key,./testdata/crypto-config/wx-org3.chainmaker.org/user/admin1/admin1.sign.key \
> --admin-crt-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/admin1/admin1.sign.crt,./testdata/crypto-config/wx-org2.chainmaker.org/user/admin1/admin1.sign.crt,./testdata/crypto-config/wx-org3.chainmaker.org/user/admin1/admin1.sign.crt \
> --sync-result=true \
> --params="{}"
{
    
    
  "contract_result": {
    
    
    "gas_used": 1376,
    "result": {
    
    
      "address": "c867f29fbc90b619206c7aef0ba4a2efb30ab9f6",
      "creator": {
    
    
        "member_id": "client1.sign.wx-org1.chainmaker.org",
        "member_info": "3SJj2iW53n1cpQVL5O/RcjzSFOYMWQ0dsmUnyKiY4Jw=",
        "member_type": 1,
        "org_id": "wx-org1.chainmaker.org",
        "role": "CLIENT",
        "uid": "995de669319d572b58fedf0c218cd632bcb431a2363a5f24ae909976fc50e201"
      },
      "name": "fact",
      "runtime_type": 2,
      "version": "1.0"
    }
  },
  "tx_block_height": 2,
  "tx_id": "1756fe3a3c90f4deca4ca0186fd0fd36b5bdcf3fc0f447269dc0c23158755aa8",
  "tx_timestamp": 1681811036
}

Call wasm contract

$ ./cmc client contract user invoke \
--contract-name=fact \
--method=save \
--sdk-conf-path=./testdata/sdk_config.yml \
--params="{
    
    \"file_name\":\"name007\",\"file_hash\":\"ab3456df5799b87c77e7f88\",\"time\":\"6543234\"}" \
--sync-result=true
[root@ibt59 cmc]# ./cmc client contract user invoke \
> --contract-name=fact \
> --method=save \
> --sdk-conf-path=./testdata/sdk_config.yml \
> --params="{
    
    \"file_name\":\"name007\",\"file_hash\":\"ab3456df5799b87c77e7f88\",\"time\":\"6543234\"}" \
> --sync-result=true
{
    
    
  "contract_result": {
    
    
    "contract_event": [
      {
    
    
        "contract_name": "fact",
        "contract_version": "1.0",
        "event_data": [
          "ab3456df5799b87c77e7f88",
          "name007",
          "6543234"
        ],
        "topic": "topic_vx",
        "tx_id": "1756fe3e20b0ea74ca9e07f70dcebe3afed6aa85b17742e5b3998457d41a018b"
      }
    ],
    "gas_used": 238411
  },
  "tx_block_height": 3,
  "tx_id": "1756fe3e20b0ea74ca9e07f70dcebe3afed6aa85b17742e5b3998457d41a018b",
  "tx_timestamp": 1681811053
}

Query contract

$ ./cmc client contract user get \
--contract-name=fact \
--method=find_by_file_hash \
--sdk-conf-path=./testdata/sdk_config.yml \
--params="{
    
    \"file_hash\":\"ab3456df5799b87c77e7f88\"}"
[root@ibt59 cmc]# ./cmc client contract user get \
> --contract-name=fact \
> --method=find_by_file_hash \
> --sdk-conf-path=./testdata/sdk_config.yml \
> --params="{
    
    \"file_hash\":\"ab3456df5799b87c77e7f88\"}"
{
    
    
  "contract_result": {
    
    
    "gas_used": 368985,
    "result": "eyJmaWxlX2hhc2giOiJhYjM0NTZkZjU3OTliODdjNzdlN2Y4OCIsImZpbGVfbmFtZSI6Im5hbWUwMDciLCJ0aW1lIjo2NTQzMjM0fQ=="
  },
  "message": "SUCCESS",
  "tx_id": "1756fe493b198313cac64d0191af283ff5cf2cbe09f946be9cc8a5ae1bb65abb"
}

Changan chain deployment directory description

This directory is used: chainmaker-go/scripts/cluster_quick_start.sh directory structure description after startup.

 taifu@chainmaker:chainmaker-go/build$ tree
.
├── backup # 下次重新prepare.sh时,此次的备份。
├── config # 使用 prepare.sh 生成的节点配置信息
│   ├── node1 # 节点1-4
│   ├── node2
│   ├── node3
│   └── node4
├── crypto-config # 使用 prepare.sh 生成的组织证书信息
│   ├── wx-org1.chainmaker.org # 组织名称1-4
│   │   ├── ca # 该组织的根证书 ca
│   │   ├── node # 由该组织的根证书签发的节点证书 common/consensus
│   │   └── user # 由该组织的根证书签发的用户证书 admin/client/light
│   ├── wx-org2.chainmaker.org
│   │   ├── ca
│   │   ├── node
│   │   └── user
│   ├── wx-org3.chainmaker.org
│   │   ├── ca
│   │   ├── node
│   │   └── user
│   └── wx-org4.chainmaker.org
│       ├── ca
│       ├── node
│       └── user
├── crypto_config.yml # 使用 prepare.sh 生成以上证书的配置文件(扩展组织、证书可使用到)
├── pkcs11_keys.yml # 使用 prepare.sh 生成的硬件加密机相关配置
└── release # 使用 build_release.sh 生成的打包好的部署文件夹
    ├── crypto-config-20220720141039.tar.gz # 证书集 即上面的crypto-config文件夹的压缩包
    ├── chainmaker-v2.3.0-wx-org2.chainmaker.org # 使用 cluster_quick_start.sh 启动链后,解压缩后的部署文件
    │   ├── bin  # 操作管理脚本目录
    │   ├── config # 配置文件目录
    │   ├── data # 数据目录
    │   ├── lib # 依赖目录
    │   └── log # 日志目录
    ├── chainmaker-v2.3.0-wx-org2.chainmaker.org-20220720141039-x86_64.tar.gz # 使用 build_release.sh 生成的打包好的部署文件
    ├── chainmaker-v2.3.0-wx-org3.chainmaker.org
    │   ├── bin
    │   ├── config
    │   ├── data
    │   ├── lib
    │   └── log
    ├── chainmaker-v2.3.0-wx-org3.chainmaker.org-20220720141039-x86_64.tar.gz
    ├── chainmaker-v2.3.0-wx-org4.chainmaker.org
    │   ├── bin
    │   ├── config
    │   ├── data
    │   ├── lib
    │   └── log
    │── chainmaker-v2.3.0-wx-org4.chainmaker.org-20220720141039-x86_64.tar.gz
    |
    |
    | # 以下为部署节点文件详情
    ├── chainmaker-v2.3.0-wx-org1.chainmaker.org # 解压缩后的部署文件
    │   ├── bin  # 操作管理脚本目录
    │   │   ├── chainmaker # 二进制文件
    │   │   ├── chainmaker.service # 基于 linux 系统的 systemd 自拉起服务
    │   │   ├── docker-vm-standalone-start.sh # 独立启动 docker 虚拟机引擎脚本
    │   │   ├── docker-vm-standalone-stop.sh # 独立停止 docker 虚拟机引擎脚本
    │   │   ├── init.sh # 基于 linux 系统的 systemd 自拉起服务部署脚本
    │   │   ├── panic.log # 异常日志输出及控制台输出日志文件
    │   │   ├── restart.sh # 重启节点脚本
    │   │   ├── run.sh # 基于 linux 系统的 systemd 自拉起服务管理脚本
    │   │   ├── start.sh # 启动节点脚本
    │   │   └── stop.sh # 停止节点脚本
    │   ├── config # 配置文件目录
    │   │   └── wx-org1.chainmaker.org
    │   │       ├── certs # 证书
    │   │       │   ├── ca
    │   │       │   │   ├── wx-org1.chainmaker.org
    │   │       │   │   │   └── ca.crt
    │   │       │   ├── node 
    │   │       │   │   |── common1 # 同步节点证书(通过chainmaker.yml配置为节点证书,表示只可同步)
    │   │       │   │   └── consensus1 # 共识节点证书(通过chainmaker.yml配置为节点证书不代表就可以参与共识,共识管理是在链配置bc.yml中)
    │   │       │   │       ├── consensus1.nodeid # xxx.sign.crt生成的节点id
    │   │       │   │       ├── consensus1.sign.crt # 签名证书
    │   │       │   │       ├── consensus1.sign.key # 签名key
    │   │       │   │       ├── consensus1.tls.crt # tls连接证书
    │   │       │   │       └── consensus1.tls.key # tls连接key
    │   │       │   └── user # 用户证书
    │   │       │       ├── admin1 # 管理员
    │   │       │       │   ├── admin1.sign.crt
    │   │       │       │   ├── admin1.sign.key
    │   │       │       │   ├── admin1.tls.crt
    │   │       │       │   └── admin1.tls.key
    │   │       │       ├── client1 # 普通客户端
    │   │       │       │   ├── client1.addr
    │   │       │       │   ├── client1.sign.crt
    │   │       │       │   ├── client1.sign.key
    │   │       │       │   ├── client1.tls.crt
    │   │       │       │   └── client1.tls.key
    │   │       │       └── light1 # 轻节点,只可同步当前组织的数据(区块、交易)
    │   │       │           ├── light1.sign.crt
    │   │       │           ├── light1.sign.key
    │   │       │           ├── light1.tls.crt
    │   │       │           └── light1.tls.key
    │   │       ├── chainconfig # 链配置
    │   │       │   │── bc1.yml # 第一条链配置
    │   │       │   └── bc2.yml # 第二条链配置
    │   │       ├── chainmaker.yml # 节点配置
    │   │       └── log.yml # 日志配置
    │   ├── data # 数据目录
    │   │   └── wx-org1.chainmaker.org
    │   │       ├── block # 区块数据/索引(必须)
    │   │       │   └── chain1
    │   │       │       └── store_block
    │   │       │           ├── 000001.log
    │   │       │           ├── CURRENT
    │   │       │           ├── LOCK
    │   │       │           ├── LOG
    │   │       │           └── MANIFEST-000000
    │   │       ├── history # 历史数据
    │   │       │   └── chain1
    │   │       │       └── store_history
    │   │       │           ├── 000001.log
    │   │       │           ├── CURRENT
    │   │       │           ├── LOCK
    │   │       │           ├── LOG
    │   │       │           └── MANIFEST-000000
    │   │       ├── ledgerData1 # 中间数据(必须)
    │   │       │   └── chain1 # 链ID
    │   │       │       ├── bfdb # 区块实际存储数据(文件存储方式)
    │   │       │       │   └── 00000000000000000001.fdb.END
    │   │       │       ├── localdb # 中间状态数据
    │   │       │       │   ├── 000001.log
    │   │       │       │   ├── CURRENT
    │   │       │       │   ├── LOCK
    │   │       │       │   ├── LOG
    │   │       │       │   └── MANIFEST-000000
    │   │       │       └── wal_QmSQeH1SV65YkafQG6y7uqabF4Xwzn5VoXniFBXrzy4Eqn # 异常恢复临时数据
    │   │       │           └── 00001_1.wal
    │   │       ├── result # 结果集数据
    │   │       │   └── chain1
    │   │       │       └── store_result
    │   │       │           ├── 000001.log
    │   │       │           ├── CURRENT
    │   │       │           ├── LOCK
    │   │       │           ├── LOG
    │   │       │           └── MANIFEST-000000
    │   │       └── state # 状态数据(必须)
    │   │           └── chain1
    │   │               └── store_state
    │   │                   ├── 000001.log
    │   │                   ├── CURRENT
    │   │                   ├── LOCK
    │   │                   ├── LOG
    │   │                   └── MANIFEST-000000
    │   ├── lib # 依赖目录
    │   │   ├── libwasmer.so # wasmer(rust)运行引擎
    │   │   └── wxdec # wxvm(c++)运行引擎
    │   └── log # 日志目录
    │       ├── system.log # 当前1小时的日志
    │       └── system.log.2022072014 # 历史日志
    └── chainmaker-v2.3.0-wx-org1.chainmaker.org-20220720141039-x86_64.tar.gz # 使用 build_release.sh 生成的打包好的部署文件

References

Changan chain official document: https://docs.chainmaker.org.cn/quickstart/%E9%80%9A%E8%BF%87%E5%91%BD%E4%BB%A4%E8%A1%8C% E4%BD%93%E9%AA%8C%E9%93%BE.html

Guess you like

Origin blog.csdn.net/qq_40713201/article/details/130276454