Zoobc-core is the main node application to run the zoobc blockchain. This repository consist of the main node application and the
command line interface
tools to help with development, which is located in thecmd/
directory.
Table of Contents:
- golang, currently using go.1.14
- go-swagger optional. Used as tools to document the rpc endpoint.
- protoc, optional as we are pushing the generated go file to the repo. Version compatible: this
- protoc-gen-go, optional as we are pushing the generated go file to the repo. Instruction: here
- golangci-lint lint tools we used to keep the code clean and well structured.
- tdm-gcc (windows-only), if you are running on windows you'll need to install this to build the binary.
- grpc-gateway (optional), for reverse proxy server.
A video tutorial on how to get started on macOS is here: https://www.youtube.com/watch?v=6lXgiyG5gBM Videos for Windows and Linux are in the making
- clone the repository.
- Dep user: run
dep ensure -v --vendor-only
to install the dependencies read from Gopkg.toml only. - Go mod user:
go mod download
to generate vendor directory which is should download the packages fromGopkg.toml
or read from project recursively - run
git submodule update --init --recursive --remote
to update / fetch submodule. - run
make test
to run the test and linter.
-
ZOOBC CORE
note: For cross compilation please install and activate docker. For:
- host:
go build -o zoobc
- darwin:
make VERSION=v1.10.1 core-darwin
- linux (386 & amd64):
make VERSION=v1.10.1 core-linux
- windows (32 & 64bit):
make VERSION=v1.10.1 core-windows
- common os (darwin, linux, windows) :
make VERSION=v1.10.1 core-common-os
With genesis replacement, you can add argument
genesis=true
and what your target is {develop(default),staging,alhpa,local}, like:make build genesis=true gen-target=develop gen-output=dist
for the local target you need createlocal.preRegisteredNodes.json
.
- host:
-
ZOOBC CMD
For:
- host:
go build -o zoobc
- darwin:
make VERSION=v1.10.1 cmd-darwin
- linux (386 & amd64):
make VERSION=v1.10.1 cmd-linux
- windows (32 & 64bit):
make VERSION=v1.10.1 cmd-windows
- common os (darwin, linux, windows) :
make VERSION=v1.10.1 cmd-common-os
- host:
./zoobc
debug
(bool): enters debug mode with capabilities likeprometheus monitoring
(uses port defined bymonitoringPort
in the config file).config-postfix
(string): defines which config file with defined postfix to use. It will use the config file in./resource/config{postfix}
.toml.config-path
(string): defines the directory that will hold the resources and configs. by default it will use./resource
. This will be useful particularly for robust resource placements, for example while used in Zoobc-Testing-Framework.cpu-profile
(bool): enable realtime profiling for the running instance, via http server. See http pprof for documentation on how to use this tool- Command line tools
for more detail check this out cmd session
cd cmd go run main.go --help go run main.go tx generate -t registerNode
-
- run all tests without cache
go test ./... -count=1
- run all test with coverage report
go test ./... -coverprofile=cover.out && go tool cover -html=cover.out
- run all tests without cache
-
- install linter tools
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.20.0
- run
golangci-lint run
to check any linting error in the changes. - remember to run tests, and lint before submitting PR.
- install linter tools
ZooBC installation script based on bashscript for help user to install ZooBC node in one easy way. It will download the latest binary that contains:
zcmd
: command line tools helper for developer and that needed for check and parse wallet certificate and stuff at first time running the installation script.zoobc
: zoobc core binary Both will downloaded by the script and for more detail you can check here.
- install
- pull newest
schema
and run./compile-go.sh
to recompile the go file and produce swagger definition from it.
please refer to contribute.md and code of conduct.