bitmarkd

module
v0.11.0-rc.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2019 License: ISC

README

bitmarkd - Main program

Made by GoDoc Go Report Card CircleCI

Prerequisites

  • Install the go language package for your system
  • Configure environment variables for go system
  • Install the ZMQ4 and Argon2 libraries

FreeBSD

pkg install libzmq4 libargon2

MacOSX

(be sure that homebrew is installed correctly)

brew tap bitmark-inc/bitmark
brew install argon2
brew install zeromq43

Ubuntu

(tested on version 18.04)

Install following packages sudo apt install libargon2-0-dev uuid-dev libzmq3-dev

Debian

(tested on version 9)

First we need to add access to testing package's repo as well as to our current version, in this case stable.

root@debian-bitmarkd:/# cat /etc/apt/sources.list.d/stable.list 
deb     http://ftp.de.debian.org/debian/    stable main contrib non-free
deb-src http://ftp.de.debian.org/debian/    stable main contrib non-free
deb     http://security.debian.org/         stable/updates  main contrib non-free

root@debian-bitmarkd:/# cat /etc/apt/sources.list.d/testing.list 
deb     http://ftp.de.debian.org/debian/    testing main contrib non-free
deb-src http://ftp.de.debian.org/debian/    testing main contrib non-free
deb     http://security.debian.org/         testing/updates  main contrib non-free

Now install libargon2 using the following.

apt-get -t testing install libargon2-dev libargon2-1

For the other packages, you can decide if you want install from stable or testing, both versions works:

apt install uuid-dev libzmq3-dev

To manually compile, simply:

go get github.com/bitmark-inc/bitmarkd
go install -v github.com/bitmark-inc/bitmarkd/command/bitmarkd

Argon2 optimization

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

Set up

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)

Prebuilt Binary

Coding

  • 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:

    1. Before commit (pre-commt)

    Runs go lint for every modified file(s). It shows suggestions but not necessary to follow.

    1. Before push to remote (pre-push)

    Runs go test for whole directory except vendor one. It is mandatory to pass this check because generally, new modifications should not break existing logic/behaviour.

    Other optional actions are sonaqube and go tool vet. These two are optional to follow since static code analysis just provide some advice.

  • 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

Directories

Path Synopsis
Package account - types and functions for converting Bitmark accounts (the public key) and their signatures
Package account - types and functions for converting Bitmark accounts (the public key) and their signatures
Package announce - network announcements The DNS TXT record format is a set of space separated key=value pairs Key Value ======= ========= bitmark v3 a Public IP addresses as IPv4;[IPv6] c Peer-To-Peer port number (decimal) r RPC port number (decimal) f SHA3 fingerprint of the certificate used by RPC connection for TLS verification (hex) p Public key of the P2P connection for ZeroMQ encryption (hex)
Package announce - network announcements The DNS TXT record format is a set of space separated key=value pairs Key Value ======= ========= bitmark v3 a Public IP addresses as IPv4;[IPv6] c Peer-To-Peer port number (decimal) r RPC port number (decimal) f SHA3 fingerprint of the certificate used by RPC connection for TLS verification (hex) p Public key of the P2P connection for ZeroMQ encryption (hex)
Package asset - Cache for assets temporary store assets just received until they are: a.
Package asset - Cache for assets temporary store assets just received until they are: a.
Package avl - an AVL balanced tree with the addition of parent pointers to allow iteration through the nodes Note: an individual tree is not thread safe, so either access only in a single go routine or use mutex/rwmutex to restrict access.
Package avl - an AVL balanced tree with the addition of parent pointers to allow iteration through the nodes Note: an individual tree is not thread safe, so either access only in a single go routine or use mutex/rwmutex to restrict access.
Package background - Simple skeleton for background processes
Package background - Simple skeleton for background processes
Package block - process and store the incoming block
Package block - process and store the incoming block
Package blockdigest - implementation block header hashing using a memory intensive argon2-d algorithm
Package blockdigest - implementation block header hashing using a memory intensive argon2-d algorithm
Package blockheader - current block header data
Package blockheader - current block header data
Package blockrecord - the structure of the block header includes functions to pack/unpack []byte form
Package blockrecord - the structure of the block header includes functions to pack/unpack []byte form
Package chain - simple module to list the supported chains
Package chain - simple module to list the supported chains
command
bitmark-cli
to issue basic commands to a bitmarkd
to issue basic commands to a bitmarkd
bitmark-cli/rpccalls
Package rpccalls - low level RPC calls to bitmarkd
Package rpccalls - low level RPC calls to bitmarkd
bitmark-dumpdb
Bitmark bitmark-dumpdb
Bitmark bitmark-dumpdb
bitmark-info
Bitmark bitmark-info
Bitmark bitmark-info
bitmarkd
bitmarkd main program
bitmarkd main program
recorderd
Proof-of-work program for bitmark system This program subscribes to potential blocks stream on a bitmarkd and determines an argon2 hash value that meets the current network difficulty value.
Proof-of-work program for bitmark system This program subscribes to potential blocks stream on a bitmarkd and determines an argon2 hash value that meets the current network difficulty value.
Package configuration - parse a Lua configuration file most of base Lua is available such as reading files to set key data and getenv to extract environment supplied items.
Package configuration - parse a Lua configuration file most of base Lua is available such as reading files to set key data and getenv to extract environment supplied items.
Package constants - constants that could be tuned
Package constants - constants that could be tuned
Package counter - thread safe counter
Package counter - thread safe counter
Package currency - types and functions for converting currencies to/from enumeration values
Package currency - types and functions for converting currencies to/from enumeration values
bitcoin
Package bitcoin - to validate bitcoin addresses
Package bitcoin - to validate bitcoin addresses
litecoin
Package litecoin - to validate litecoin addresses
Package litecoin - to validate litecoin addresses
satoshi
Package satoshi - to convert satoshi values to integers
Package satoshi - to convert satoshi values to integers
Package difficulty - implement the difficulty value and its various encodings
Package difficulty - implement the difficulty value and its various encodings
Package fault - error instances Provides a single instance of errors to allow easy comparison without having to resort to partial string matches
Package fault - error instances Provides a single instance of errors to allow easy comparison without having to resort to partial string matches
Package genesis - live and test genesis blocks
Package genesis - live and test genesis blocks
Package merkle - merkle tree manipulation routines
Package merkle - merkle tree manipulation routines
Package messagebus - a queuing system for all message packets whether internally generated or received from peers
Package messagebus - a queuing system for all message packets whether internally generated or received from peers
Package mode - simple module to record the global running mode
Package mode - simple module to record the global running mode
Package ownership - handles low-level access to the ownership data in storage pool
Package ownership - handles low-level access to the ownership data in storage pool
Package pay - miscellaneous type for payment
Package pay - miscellaneous type for payment
Package payment - control of payment verification
Package payment - control of payment verification
Package peer - this module handles the peer to peer network server-side: * upstream sending of block, transactions * listener for RPC requests e.g.
Package peer - this module handles the peer to peer network server-side: * upstream sending of block, transactions * listener for RPC requests e.g.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
upstream
Package upstream - maintain REQ/REP connection to clients this allow for push of blocks, transactions...
Package upstream - maintain REQ/REP connection to clients this allow for push of blocks, transactions...
Package proof - prepare blocks for prooferd
Package proof - prepare blocks for prooferd
Package publish - this module handles publishing of events for add-on services e.g.
Package publish - this module handles publishing of events for add-on services e.g.
Package reservoir - storage for: 1.
Package reservoir - storage for: 1.
Package rpc - this is to setup and handle all of the incoming JSON RPC requests from clients requiring bitmarkd services standard golang RPC services can be used on the client side to access these services
Package rpc - this is to setup and handle all of the incoming JSON RPC requests from clients requiring bitmarkd services standard golang RPC services can be used on the client side to access these services
SPDX-License-Identifier: ISC SPDX-License-Identifier: ISC Package storage - maintain the on-disk data store maintain separate pools of a number of elements in key->value form This maintains a LevelDB database split into a series of tables.
SPDX-License-Identifier: ISC SPDX-License-Identifier: ISC Package storage - maintain the on-disk data store maintain separate pools of a number of elements in key->value form This maintains a LevelDB database split into a series of tables.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package transactionrecord - the structure of the transaction records includes functions to pack/unpack []byte form
Package transactionrecord - the structure of the transaction records includes functions to pack/unpack []byte form
Package util - miscellaneous small routines
Package util - miscellaneous small routines
Package zmqutil - various comm ZMq routines shared be all commands
Package zmqutil - various comm ZMq routines shared be all commands

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL