Prerequisites
- Install the go language package for your system
- Configure environment variables for go system
- Install the ZMQ4 and Argon2 libraries
pkg install libzmq4 libargon2
(be sure that homebrew is installed correctly)
brew tap bitmark-inc/bitmark
brew install argon2
brew install zeromq43
(tested on distribution 18.04)
Install following packages
sudo apt install libargon2-0-dev uuid-dev libzmq3-dev
To compile simply:
go get github.com/bitmark-inc/bitmarkd
go install -v github.com/bitmark-inc/bitmarkd/command/bitmarkd
Argon2 can achieve better performance if AVX instructions is available. But the potential optimization is not enabled if Argon2 is installed by package managers.
To leverage AVX instructions, extra flag has to be specified during the compilation process.
make OPTTARGET=native
If AVX is not available, make sure Argon2 has no reference to AVX otherwise bitmarkd will crash.
make OPTTARGET=generic
Create the configuration directory, copy sample configuration, edit it to set up IPs, ports and local bitcoin testnet connection.
mkdir -p ~/.config/bitmarkd
cp command/bitmarkd/bitmarkd.conf.sample ~/.config/bitmarkd/bitmarkd.conf
${EDITOR} ~/.config/bitmarkd/bitmarkd.conf
To see the bitmarkd sub-commands:
bitmarkd --config-file="${HOME}/.config/bitmarkd/bitmarkd.conf" help
Generate key files and certificates.
bitmarkd --config-file="${HOME}/.config/bitmarkd/bitmarkd.conf" gen-peer-identity
bitmarkd --config-file="${HOME}/.config/bitmarkd/bitmarkd.conf" gen-rpc-cert
bitmarkd --config-file="${HOME}/.config/bitmarkd/bitmarkd.conf" gen-proof-identity
Start the program.
bitmarkd --config-file="${HOME}/.config/bitmarkd/bitmarkd.conf" start
Note that a similar process is needed for the prooferd (mining subsystem)
-
Flatpak
Please refer to wiki
-
Docker
Please refer to bitmark-node
-
setup git hooks
Link git hooks directory, run command
./scripts/setup-hook.sh
at root of bitmarkd directory. Currently it provides checks for two stages:- Before commit (
pre-commt
)
Runs
go lint
for every modified file(s). It shows suggestions but not necessary to follow.- Before push to remote (
pre-push
)
Runs
go test
for whole directory exceptvendor
one. It is mandatory to pass this check because generally, new modifications should not break existing logic/behaviour.Other optional actions are
sonaqube
andgo tool vet
. These two are optional to follow since static code analysis just provide some advice. - Before commit (
-
all variables are camel case i.e. no underscores
-
labels are all lowercase with '_' between words
-
imports and one single block
-
all break/continue must have label
-
avoid break in switch and select