bitmarkd

module
v0.15.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: ISC

README

bitmarkd - Main program

Made by GoDoc Go Report Card CircleCI

Prerequisites

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

Operating system specific setup commands

FreeBSD

pkg install libzmq4 libargon2 git

MacOSX

(be sure that homebrew is installed correctly)

brew install argon2
brew install zeromq
brew install git

Ubuntu

(tested on version 18.04)

Install following packages

sudo apt install libargon2-0-dev uuid-dev libzmq3-dev git

Debian

(tested on version 9)

First we need to add access to testing package's repository 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:

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

For the other packages, install from stable or testing, both versions work:

apt install uuid-dev libzmq3-dev
apt install git

Compilation commands for all operating systems

To compile use use the git command to clone the repository and the go command to compile all commands. The process requires that the Go installation be 1.12 or later as the build process uses Go Modules.

git clone https://github.com/bitmark-inc/bitmarkd
cd bitmarkd
go install -v ./...

Set up for running a node

Note: ensure that the ${HOME}/go/bin directory is on the path before continuing. The commands below assume that a checked out and compiled version of the system exists in the ${HOME}/bitmarkd directory.

Setup and run bitmarkd

Create the configuration directory, copy sample configuration, edit it to set up IP addresses, ports and local bitcoin testnet connection. The sample configuration has some embedded instructions for quick setup and only a few items near the beginning of the file need to be set for basic use.

mkdir -p ~/.config/bitmarkd
cp ~/bitmarkd/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 "${HOME}/.config/bitmarkd/"
bitmarkd --config-file="${HOME}/.config/bitmarkd/bitmarkd.conf" gen-rpc-cert "${HOME}/.config/bitmarkd/"
bitmarkd --config-file="${HOME}/.config/bitmarkd/bitmarkd.conf" gen-proof-identity "${HOME}/.config/bitmarkd/"

Start the program.

bitmarkd --config-file="${HOME}/.config/bitmarkd/bitmarkd.conf" start

Setup and run recorderd (the mining program)

This is similar to the bitmarkd steps above. For mining on the local bitmarkd the sample configuration should work without changes.

mkdir -p ~/.config/recorderd
cp ~/bitmarkd/command/recorderd/recorderd.conf.sample  ~/.config/recorderd/recorderd.conf
${EDITOR} ~/.config/recorderd/recorderd.conf

To see the recorderd sub-commands:

recorderd --config-file="${HOME}/.config/recorderd/recorderd.conf" help

Generate key files and certificates.

recorderd --config-file="${HOME}/.config/recorderd/recorderd.conf" generate-identity "${HOME}/.config/recorderd/

Start the program.

recorderd --config-file="${HOME}/.config/recorderd/recorderd.conf" start

Setup and run bitmark-cli (command line program to send transactions)

Initialise the bitmark-cli for live and test networks creating a new account on each network. This setup is presuming that live or test bitmarkd will be running on the same machine so thatthe loopback address can be used.

mkdir -p ~/.config/bitmark-cli
bitmark-cli -n bitmark -i mylive setup -c 127.0.0.1:2130  -d 'my first live account' -n
bitmark-cli -n testing -i mytest setup -c 127.0.0.1:12130  -d 'my first testing account' -n

To see the cli sub-commands: or details on a specific command e.g., "setup"

bitmark-cli help
bitmark-cli help setup

Note: If you wish to add more connections or change the default connection created above then it is necessary to edit the JSON configuration files to modify the connections list.

Prebuilt Binary

  • FreeBSD

Install bitmarkd bitmark-cli and recorderd

pkg install bitmark

Alternatively select one or more individual packages

pkg install bitmark-daemon
pkg install bitmark-recorder
pkg install bitmark-cli

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-commit)

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

    1. Before push to remote (pre-push)

    Runs go test for whole directory. It is mandatory to pass this check because generally, new modifications must 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 with 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
Package announce - network announcements
id
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
rpc
Package asset - Cache for assets
Package asset - Cache for assets
Package avl - an AVL balanced tree with the addition of parent pointers to allow iteration through the nodes
Package avl - an AVL balanced tree with the addition of parent pointers to allow iteration through the nodes
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
Package blockdigest - implementation block header hashing
Package blockdump - extract a range of blocks and their transactions
Package blockdump - extract a range of blocks and their transactions
Package blockheader - current block header data
Package blockheader - current block header data
Package blockrecord - the structure of the block header
Package blockrecord - the structure of the block header
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
Proof-of-work program for bitmark system
Package configuration - parse a Lua configuration file
Package configuration - parse a Lua configuration file
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
Package fault - error instances
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
Package peer - this module handles the peer to peer network
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.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
rpc
Package rpc - this is to setup and handle all of the incoming JSON RPC requests from clients requiring bitmarkd services
Package rpc - this is to setup and handle all of the incoming JSON RPC requests from clients requiring bitmarkd services
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package storage - maintain the on-disk data store
Package storage - maintain the on-disk data store
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package transactionrecord - the structure of the transaction records
Package transactionrecord - the structure of the transaction records
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