pod

command module
v0.0.2-0...-1c7e8a7 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2021 License: Unlicense Imports: 5 Imported by: 0

README

Logo ParallelCoin Pod

Fully integrated all-in-one cli client, full node, wallet server, miner and GUI wallet for ParallelCoin

github GoDoc Go Report Card Quality Gate Status Bugs Lines of Code Maintainability Rating CodeScene general

Warning
This is a snapshot of the more messy larger version at https://github.com/p9c/pod for my personal portfolio of work. This is partially working, alpha stage development currently.
*If you are looking for the legacy 1.2.0 version, go here https://github.com/marcetin/parallelcoin/tree/master/legacy

Installation

Straight to business, this is the part I am looking for, so it's here at the top.

Ubuntu

These instructions expect that you understand basic usage of the bash shell and terminal, and git usage. You should be able to edit a text file on the command line interface though you could use gedit or similar if you prefer.

First, you need a working Go 1.14+ installation for the platform you are using.

cd ~
sudo apt get install -y wget git build-essential
wget https://golang.org/dl/go1.14.13.linux-amd64.tar.gz
tar zxvf go1.14.13.linux-amd64.tar.gz

The build tools expect a working GOBIN which is also in PATH, so, open ~/.bashrc in a text editor and put in it:

export GOBIN=$HOME/bin
export GOPATH=$HOME
export GOROOT=$HOME/go
export PATH=$GOBIN:$PATH

then run

source ~/.bashrc

Clone this repository where you like:

cd /where/you/keep/your/things
git clone https://github.com/l0k18/pod.git
cd pod

Before you can build it, though, see gioui.org install instructions - note that on linux xsel or other clipboard apps are required for clipboard functionality. The instructions there cover Ubuntu.

Several important libraries are required to build on each platform. Linux needs some input related X libraries, wayland and their GL libraries, and similar but different for Mac, Windows, iOS and Android.

More detailed instructions will follow as we work through each platform build. For now we develop on FreeBSD and Ubuntu so for now, at this early stage with the GUI, please bear with us.

Next, go to the repo root and build it.

make -B stroy

stroy is a pure go replacement for make. Run it without any options to get a list of currently enabled build options.

If you don't have access to make (it can be tricky on windows), you can build stroy with this command:

go install -v github.com/l0k18/pod/stroy
stroy stroy

stroy replaces make as it is written in Go, and is customised to put values into the binaries that show what the binary was built from.

The second invocation rebuilds stroy with stroy itself, which plants the build information into the main package, which records the details of the source code that it was built with, eg:

app information: repo: github.com/l0k18/pod branch: refs/heads/l0k1 commit: 8b98e47b8a61a7e68a945ce65129f4dd49c6c086 built: 2021-01-12T06:34:34+01:00 tag: v0.4.25-testnet+...

The purpose of this is to improve debugging as this info is printed at the start of all components' startup, and allows the logs to inform developers what the user's build came from, when dealing with a bug report, to facilitate exact replication of the fault.

Running

As you will find when you run stroy without a build command name, there is several commands that will launch wallet, node, the GUI, reset the wallet, and so on.

Initial configuration:

For initial configuration, use the -D and -n flags combined with the init subcommand like so:

pod -D <data directory> -n <mainnet/testnet> init

This in one step creates a fresh new configuration file, all of the TLS certificates and default Certificate Authority to use the web sockets interface for especially the wallet async functionality, and prompts you on the CLI to enter a new wallet passphrase, gives seed you need to restore the wallet later, and fills the configuration with a set of starting mining addresses based on the wallet seed, for the defined network type.

**TODO:**s yes, we want to move these keys into the directory subfolder so it can be done without the node running and on demand with a new subcommand for exactly this purpose. New addresses require a wallet but should be kept away from a public RPC or other remote protocol endpoint. Only nodes need them while mining to use for creating coinbase payment outpoints.

Run Modes

If you just want to use it as an RPC for only node services at localhost:11047 (no wallet)

pod node

For wallet only at localhost:11048 (a full node must be configured, by default should be found at localhost:11047)

pod wallet

For combined RPC wallet at localhost:11046

pod shell

For the standalone multicast miner worker 'Kopach':

pod kopach

The list of commands and options can be seen using the following command:

pod help

Notable items and their short forms:

-D

Set the root folder of the data directory. Default is ~/.pod or the string 'pod' as the folder name in other systems.

-g

-g=false disables mining

Enable mining, using inbuilt for run modes that enable a p2p blockchain node

-G

Set the number of threads to mine with. Performance with the Plan 9 hardfork will entirely depend on the performance characteristics of the processor and its' long division units and how they are scheduled. The inbuilt miner (which will be deprecated) has significantly inferior performance. Concurrency is not parallelism, and the stand-alone miner is better. The inbuilt miner will be entirely removed by release.

-n

Set the network type, mainnet and testnet are the main important options. Note that this is the main configuration as well as pre-shared key, to run the multi- cast mining system, as the different networks have different start heights for hard forks.

Configuration

Configuration is designed to be largely automatic, however manual edits can be made, from <pod profile directory>/pod.json - notably critical elements for the cluster mining configurations is the 'MiningPass' item matches up between nodes you intend to communicate with each other.

Mining Farm Setup

For the time being all that is necessary is to copy the pod.json file, and that all nodes deployed are on the same subnets as the nodes. Note that it is possible to isolate subnets and join them using nodes via dual network (virtual) interfaces and that worker nodes trust implicitly all nodes that use the same pre shared key (thus the configuration file).

Before beta release there will be a FreeBSD based live image that is written to using a utility app with the correct key and network settings and will be basically turn-key if used as default configured. BSD is being used because it is lighter and ensures your hardware is doing nothing more than exactly crunching giant numbers for the chance to get a block reward.s

Configuration for adjunct services (block explorers, exchanges)

rpc.cert ca.cert and rpc.key files, which as they are can be used (not so securely) for connecting nodes in one's server set up. The system can be run by default in an 'insecure' configuration (they are wired to connect via localhost ports). Presumably for this kind of production application one would use a complete set of ports and custom CA file. What is provided by default is for development purposes and on a relatively unconnected end user setup.

Further improvements in security are planned.

For now it is advisable to isolate wallet services strongly and the main attack vector is covered. Easier to use GUI interface for offline transaction signing and similar features also are planned for later implementation.

GUI build info

The GUI subsystem can be disabled in the build using

go install -tags headless

To build it, there are some GL and X prerequisites for the Linux build

sudo apt-get install libgles2-mesa-dev \
     libxkbcommon-dev \
     libxkbcommon-x11-dev

More info about building for other platforms to follow. There should be a build for Android and iOS eventually, they have extra build environment requirements (android sdk and xcode/mac respectively). Specifics for Windows builds also to come.

Windows GUI build needs files:

Files are included in Pod's root folder

  • d3dcompiler_47.dll
  • libEGL.dll
  • libGLESv2.dll

Binaries for legacy (pre hardfork) now available for linux amd64

Get them from here: https://git.parallelcoin.io/dev/parallelcoin-binaries

Developer Notes

Goland's inbuilt terminal is very slow and has several bugs that my workflow exposes and I find very irritating, and out of the paned terminal apps I find Tilix the most usable, but it requires writing a regular expression to match and so the logger is written to output relative paths to the repository root.

The regexp that I use given my system base path is (exactly this with all newlines removed for dconf with using tilix at the dconf path /com/gexperts/Tilix/custom-hyperlinks)

[
    '[ ]((([a-zA-Z@0-9-_.]+/)+([a-zA-Z@0-9-_.]+)):([0-9]+))$,goland --line $5 $HOME/Public/pod/$2,false', 
    '([/](([a-zA-Z@0-9-_.]+/)+([a-zA-Z@0-9-_.]+)):([0-9]+)),goland --line $5 /$2,false'
]

These two seem to the work the best including allowing clicking on stack trace code location references. Change goland launcher and package root path as required. The logger code locations start with a space and absolute paths with a forward slash and you have to set the repository path manually.

Documentation

Overview

Package main is the root of the Parallelcoin Pod software suite

It slices, it dices

Directories

Path Synopsis
app
Package app is a multi-function universal binary that does all the things.
Package app is a multi-function universal binary that does all the things.
cmd
ctl
gui
kopach/control/hashrate
Package hashrate is a message type for Simplebuffers generated by miners to broadcast an IP address, a count and version number and current height of mining work just completed.
Package hashrate is a message type for Simplebuffers generated by miners to broadcast an IP address, a count and version number and current height of mining work just completed.
node
Package node is a full-node Parallelcoin implementation written in Go.
Package node is a full-node Parallelcoin implementation written in Go.
node/integration/rpctest
Package rpctest provides a pod-specific RPC testing harness crafting and executing integration tests by driving a `pod` instance via the `RPC` interface.
Package rpctest provides a pod-specific RPC testing harness crafting and executing integration tests by driving a `pod` instance via the `RPC` interface.
node/mempool
Package mempool provides a policy-enforced pool of unmined bitcoin transactions.
Package mempool provides a policy-enforced pool of unmined bitcoin transactions.
spv
tools/genesis
Bitcoin fork genesis block generator, based on https://bitcointalk.org/index.php?topic=181981.0 hosted at https://pastebin.com/nhuuV7y9
Bitcoin fork genesis block generator, based on https://bitcointalk.org/index.php?topic=181981.0 hosted at https://pastebin.com/nhuuV7y9
pkg
chain
Package blockchain implements bitcoin block handling and chain selection rules.
Package blockchain implements bitcoin block handling and chain selection rules.
chain/config
Package chaincfg defines chain configuration parameters.
Package chaincfg defines chain configuration parameters.
chain/fork
Package fork handles tracking the hard fork status and is used to determine which consensus rules apply on a block
Package fork handles tracking the hard fork status and is used to determine which consensus rules apply on a block
chain/fullblocktests
Package fullblocktests provides a set of block consensus validation tests.
Package fullblocktests provides a set of block consensus validation tests.
chain/hash
Package chainhash provides abstracted hash functionality.
Package chainhash provides abstracted hash functionality.
chain/index
Package indexers implements optional block chain indexes.
Package indexers implements optional block chain indexes.
chain/sync
Package netsync implements a concurrency safe block syncing protocol.
Package netsync implements a concurrency safe block syncing protocol.
chain/tx
Package wallettx provides ...
Package wallettx provides ...
chain/tx/author
Package txauthor provides transaction creation code for wallets.
Package txauthor provides transaction creation code for wallets.
chain/tx/mgr
Package wtxmgr provides an implementation of a transaction database handling spend tracking for a bitcoin wallet.
Package wtxmgr provides an implementation of a transaction database handling spend tracking for a bitcoin wallet.
chain/tx/rules
Package txrules provides transaction rules that should be followed by transaction authors for wide mempool acceptance and quick mining.
Package txrules provides transaction rules that should be followed by transaction authors for wide mempool acceptance and quick mining.
chain/tx/script
Package txscript implements the bitcoin transaction script language.
Package txscript implements the bitcoin transaction script language.
chain/tx/sizes
Package txsizes Copyright (c) 2016 The btcsuite developers
Package txsizes Copyright (c) 2016 The btcsuite developers
chain/tx/sort
Package txsort provides the transaction sorting according to BIP 69.
Package txsort provides the transaction sorting according to BIP 69.
chain/wire
Package wire implements the bitcoin wire protocol.
Package wire implements the bitcoin wire protocol.
coding/alo
Package alo implements a forward error correction scheme using Reed Solomon Erasure Coding.
Package alo implements a forward error correction scheme using Reed Solomon Erasure Coding.
coding/base58
Package base58 provides an API for working with modified base58 and Base58Check encodings.
Package base58 provides an API for working with modified base58 and Base58Check encodings.
coding/bech32
Package bech32 provides a Go implementation of the bech32 format specified in BIP 173.
Package bech32 provides a Go implementation of the bech32 format specified in BIP 173.
coding/elliptic
Package ec implements support for the elliptic curves needed for bitcoin.
Package ec implements support for the elliptic curves needed for bitcoin.
coding/fec
Package fec implements Reed Solomon 9/3 forward error correction, intended to be sent as 9 pieces where 3 uncorrupted parts allows assembly of the message
Package fec implements Reed Solomon 9/3 forward error correction, intended to be sent as 9 pieces where 3 uncorrupted parts allows assembly of the message
coding/gcs
Package gcs provides an API for building and using a Golomb-coded set filter.
Package gcs provides an API for building and using a Golomb-coded set filter.
comm/peer
Package peer provides a common base for creating and managing Bitcoin network peers.
Package peer provides a common base for creating and managing Bitcoin network peers.
comm/peer/addrmgr
Package addrmgr implements concurrency safe Bitcoin address manager.
Package addrmgr implements concurrency safe Bitcoin address manager.
comm/peer/connmgr
Package connmgr implements a generic Bitcoin network connection manager.
Package connmgr implements a generic Bitcoin network connection manager.
comm/transport
Package transport provides a listener and sender channel for unicast and multicast UDP IPv4 short message chat protocol with a pre shared key, forward error correction facilities with a nice friendly declaration syntax
Package transport provides a listener and sender channel for unicast and multicast UDP IPv4 short message chat protocol with a pre shared key, forward error correction facilities with a nice friendly declaration syntax
db
Package database provides a block and metadata storage database.
Package database provides a block and metadata storage database.
db/ffldb
Package ffldb implements a driver for the database package that uses leveldb or the backing metadata and flat files for block storage.
Package ffldb implements a driver for the database package that uses leveldb or the backing metadata and flat files for block storage.
db/walletdb
Package walletdb provides a namespaced database interface for btcwallet.
Package walletdb provides a namespaced database interface for btcwallet.
db/walletdb/bdb
Package bdb implements an instance of walletdb that uses boltdb for the backing datastore.
Package bdb implements an instance of walletdb that uses boltdb for the backing datastore.
db/walletdb/ci
Package walletdbtest provides exported tests that can be imported and consumed by walletdb driver tests to help ensure that drivers confirm to the database driver interface correctly.
Package walletdbtest provides exported tests that can be imported and consumed by walletdb driver tests to help ensure that drivers confirm to the database driver interface correctly.
gui
Package gui implements the plan 9 from crypto space Gio GUI theme
Package gui implements the plan 9 from crypto space Gio GUI theme
rpc/btcjson
Package btcjson provides primitives for working with the bitcoin JSON-RPC API.
Package btcjson provides primitives for working with the bitcoin JSON-RPC API.
rpc/client
Package rpcclient implements a websocket-enabled Bitcoin JSON-RPC client.
Package rpcclient implements a websocket-enabled Bitcoin JSON-RPC client.
util
Package util provides bitcoin-specific convenience functions and types.
Package util provides bitcoin-specific convenience functions and types.
util/hdkeychain
Package hdkeychain provides an API for bitcoin hierarchical deterministic extended keys (BIP0032).
Package hdkeychain provides an API for bitcoin hierarchical deterministic extended keys (BIP0032).
util/helpers
Package helpers provides convenience functions to simplify wallet code.
Package helpers provides convenience functions to simplify wallet code.
util/logi/Entry
Package Entry is a message type for logi log entries
Package Entry is a message type for logi log entries
util/logi/Pkg
Package Pkg is a message type for logi package filtering
Package Pkg is a message type for logi package filtering
util/logi/pipe/consume
Package consume turns off and on the Serve logging messages and provides a way to receive and process the log messages
Package consume turns off and on the Serve logging messages and provides a way to receive and process the log messages
util/logi/pipe/serve
Package serve receives logi.Entry messages on a channel and sends them when it has been told to Run by Consume, and pauses when it is told Pause
Package serve receives logi.Entry messages on a channel and sends them when it has been told to Run by Consume, and pauses when it is told Pause
util/treap
Package treap implements a treap data structure that is used to hold ordered key/value pairs using a combination of binary search tree and heap semantics.
Package treap implements a treap data structure that is used to hold ordered key/value pairs using a combination of binary search tree and heap semantics.
util/zero
Package zero Copyright (c) 2015 The btcsuite developers Package zero contains functions to clear data from byte slices and multi-precision integers.
Package zero Copyright (c) 2015 The btcsuite developers Package zero contains functions to clear data from byte slices and multi-precision integers.
wallet
Package wallet Copyright (c) 2015-2016 The btcsuite developers Package wallet provides ...
Package wallet Copyright (c) 2015-2016 The btcsuite developers Package wallet provides ...
wallet/addrmgr
Package waddrmgr provides a secure hierarchical deterministic wallet address manager.
Package waddrmgr provides a secure hierarchical deterministic wallet address manager.
wallet/votingpool
Package votingpool provides voting pool functionality for btcwallet.
Package votingpool provides voting pool functionality for btcwallet.

Jump to

Keyboard shortcuts

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