The version information of the qitmeer executable can be displayed by specifying the -V option.

Qitmeer Network
3 min readJul 26, 2021

The version information of the qitmeer executable can be displayed by specifying the -V option.

$ ./build/bin/qitmeer -V
qitmeer version 0.10.0+dev-8ad357a-dirty (Go version go1.16.5)

It can be seen in the above example that the version of qitmeer is 0.10.0+dev-8ad357a-dirty, and the executable is built with go version 1.16.5.

0.10.0 in the beginning of the version information is the application’s version number. It is in the format of Major.Minor.Patch, following the Semantic Versioning specification. Currently the values of the major version, minor version and patch are assigned in the source file version/version.go.

const (
Major uint = 0
Minor uint = 10
Patch uint = 0
)

Whenever we decide to change the version number, we manually edit the source file and modify the values.

Following 0.10.0 in the example is dev, which indicates that it is a development version. The variable indicating whether the executable is a development or release version is also defined in version/version.go.

var (
// ...
Build = "dev"
)

However, whenever we decide to build a release version, we run make release command in the qitmeer folder instead of directly editing version.go to assign the value of Build.

In Makefile, we have the following variables defined in the beginning.

GITVER := $(shell git rev-parse --short=7 HEAD )
GITDIRTY := $(shell git diff --quiet || echo '-dirty')
GITVERSION = "$(GITVER)$(GITDIRTY)"
DEV=dev
RELEASE=release
LDFLAG_DEV = -X github.com/Qitmeer/qitmeer/version.Build=$(DEV)-$(GITVERSION)
LDFLAG_RELEASE = -X github.com/Qitmeer/qitmeer/version.Build=$(RELEASE)-$(GITVERSION)
GOFLAGS_DEV = -ldflags "$(LDFLAG_DEV)"
GOFLAGS_RELEASE = -ldflags "$(LDFLAG_RELEASE)"

When release is specified as the make target, GOFLAGS_RELEASE is used in the go build command (not shown here, please refer to Makefile in detail), otherwise GOFLAGS_DEV is used. In both cases, the Build variable in version.go is by specifying -ldflags "-X ..." in go build command, which is a common way of setting version information for Go applications.

It can be seen in the above Makefile code that following dev or release in the Build variable is the 7-digit git commit ID (the GITVER variable), along with a dirty flag in case at the build time there's some local modification of the qitmeer source code not commited.

About Qitmeer

Qitmeer is the next-generation public chain based on BlockDAG which is dedicated to serving the ecosystem of Islamic Finance, ethical finance, and socially responsible investment, thereby enhancing financial inclusion and creating social impact.

In contrast to the competition model, BlockDAG’s collaboration model in the mining achieves a desirable balance of typical blockchain metrics among the security, openness, fairness, and scalability.

Qitmeer adopts a classic POW consensus and UTXO data model and designs a unique asset issuing mechanism which requires the reserve of native currency, which is in line with core ethical financial values.

Contact Us

Website / Qitmeer talk / GitHub / Twitter / Facebook / Telegram / Instagram / LinkedIn

--

--

Qitmeer Network

Qitmeer Network is the next generation payment network infrastructure based on BlockDAG technology.