node

package
v0.0.0-...-a838072 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2019 License: Unlicense, ISC Imports: 31 Imported by: 0

README

The Parallelcoin Node ISC License GoDoc

Next generation full node for Parallelcoin, forked from btcd

Hard Fork 1: Plan 9 from Crypto Space

9 algorithms can be used when mining:

  • Blake14lr (decred)
  • Skein (myriadcoin) Cryptonote7v2
  • Lyra2REv2 (sia)
  • Keccac (maxcoin, smartcash)
  • Scrypt (litecoin)
  • SHA256D (bitcoin)
  • GOST Stribog *
  • Skein
  • X11 (dash)
Stochastic Binomial Filter Difficulty Adjustment

After the upcoming hardfork, Parallelcoin will have the following features in its difficulty adjustment regime:

  • Exponential curve with power of 3 to respond gently the natural drift while moving the difficulty fast in below 10% of target and 10x target, to deal with recovering after a large increase in network hashpower

  • 293 second blocks (7 seconds less than 5 minutes), 1439 block averaging window (about 4.8 days) that is varied by interpreting byte 0 of the sha256d hash of newest block hash as a signed 8 bit integer to further disturb any inherent rhythm (like dithering).

  • Difficulty adjustments are based on a window ending at the previous block of each algorithm, meaning sharp rises from one algorithm do not immediately affect the other algorithms, allowing a smoother recovery from a sudden drop in hashrate, soaking up energetic movements more robustly and resiliently, and reducing vulnerability to time distortion attacks.

  • Deterministic noise is added to the difficulty adjustment in a similar way as is done with digital audio and images to improve the effective resolution of the signal by reducing unwanted artifacts caused by the sampling process. Miners are random generators, and a block time is like a tuning filter, so the same principles apply.

  • Rewards will be computed according to a much smoother, satoshi-precision exponential decay curve that will produce a flat annual 5% supply expansion. Increasing the precision of the denomination is planned for the next release cycle, at 0.00000001 as the minimum denomination, there may be issues as userbase increases.

  • Fair Hardfork - Rewards will slowly rise from the initial hard fork at an inverse exponential rate to bring the block reward from 0.02 up to 2 in 2000 blocks, as the adjustment to network capacity takes time, so rewards will closely match the time interval they relate to until it starts faster from the minimum target stabilises in response to what miners create.

Wallet

The pod has no RPC wallet functionality, only core chain functions. It is fully compliant with the original parallelcoind for these functions. For the wallet server, mod, which works also with the CLI controller podctl, it will be possible to send commands to both mod (wallet) and pod full node using the command line.

A Webview/Golang based GUI wallet will come a little later, following the release, and will be able to run on all platforms with with browser or supported built-in web application platforms, Blink and Webkit engines.

* At the time of release there will not be any GPU nor ASIC miners for the GOST Stribog (just stribog 256 bit hash, not combined) and Highwayhash.

Installation

For the main full node server:

go get git.parallelcoin.io/dev/pod

You probably will also want CLI client (can also speak to other bitcoin protocol RPC endpoints also):

go get git.parallelcoin.io/dev/pod/cmd/podctl

Requirements

Go 1.11 or newer.

Installation

Windows not available yet

When it is, it will be available here:

https://git.parallelcoin.io/dev/pod/releases

Linux/BSD/MacOSX/POSIX - Build from Source
$ go version
$ go env GOROOT GOPATH

NOTE: The GOROOT and GOPATH above must not be the same path. It is recommended that GOPATH is set to a directory in your home directory such as ~/goprojects to avoid write permission issues. It is also recommended to add $GOPATH/bin to your PATH at this point.

  • Run the following commands to obtain pod, all dependencies, and install it:
$ go get git.parallelcoin.io/dev/pod
  • pod (and utilities) will now be installed in $GOPATH/bin. If you did not already add the bin directory to your system path during Go installation, we recommend you do so now.

Updating

Windows

Install a newer MSI

Linux/BSD/MacOSX/POSIX - Build from Source
  • Run the following commands to update pod, all dependencies, and install it:
$ cd $GOPATH/src/git.parallelcoin.io/dev/pod
$ git pull && glide install
$ go install . ./cmd/...

Getting Started

pod has several configuration options available to tweak how it runs, but all of the basic operations described in the intro section work with zero configuration.

Windows (Installed from MSI)

Launch pod from your Start menu.

Linux/BSD/POSIX/Source
$ ./pod

Discord

Come and chat at our (discord server](https://discord.gg/nJKts94)

Issue Tracker

The integrated github issue tracker is used for this project.

Documentation

The documentation is a work-in-progress. It is located in the docs folder.

License

pod is licensed under the copyfree ISC License.

Documentation

Overview

Package node is a full-node Parallelcoin implementation written in Go.

The default options are sane for most users. This means pod will work 'out of the box' for most users. However, there are also a wide variety of flags that can be used to control it.

The following section provides a usage overview which enumerates the flags. An interesting point to note is that the long form of all of these options (except -C) can be specified in a configuration file that is automatically parsed when pod starts up. By default, the configuration file is located at ~/.pod/pod.conf on POSIX-style operating systems and %LOCALAPPDATA%\pod\pod.conf on Windows. The -C (--configfile) flag, as shown below, can be used to override this location.

NAME:

pod node - start parallelcoin full node

USAGE:

pod node [global options] command [command options] [arguments...]

VERSION:

v0.0.1

COMMANDS:

dropaddrindex  drop the address search index
droptxindex    drop the address search index
dropcfindex    drop the address search index

GLOBAL OPTIONS:

--help, -h  show help

Index

Constants

View Source
const (
	DefaultConfigFilename        = "conf.json"
	DefaultDataDirname           = "node"
	DefaultLogLevel              = "info"
	DefaultLogDirname            = "node"
	DefaultLogFilename           = "log"
	DefaultAddress               = "127.0.0.1"
	DefaultPort                  = "11047"
	DefaultRPCPort               = "11048"
	DefalutRPCAddr               = "127.0.0.1"
	DefaultRPCServer             = "127.0.0.1:11048"
	DefaultListener              = "127.0.0.1:11047"
	DefaultRPCListener           = "127.0.0.1"
	DefaultMaxPeers              = 23
	DefaultBanDuration           = time.Hour * 24
	DefaultBanThreshold          = 100
	DefaultConnectTimeout        = time.Second * 30
	DefaultMaxRPCClients         = 10
	DefaultMaxRPCWebsockets      = 25
	DefaultMaxRPCConcurrentReqs  = 20
	DefaultDbType                = "ffldb"
	DefaultFreeTxRelayLimit      = 15.0
	DefaultTrickleInterval       = peer.DefaultTrickleInterval
	DefaultBlockMinSize          = 80
	DefaultBlockMaxSize          = 200000
	DefaultBlockMinWeight        = 10
	DefaultBlockMaxWeight        = 3000000
	BlockMaxSizeMin              = 1000
	BlockMaxSizeMax              = blockchain.MaxBlockBaseSize - 1000
	BlockMaxWeightMin            = 4000
	BlockMaxWeightMax            = blockchain.MaxBlockWeight - 4000
	DefaultGenerate              = false
	DefaultGenThreads            = 1
	DefaultMinerListener         = "127.0.0.1:11011"
	DefaultMaxOrphanTransactions = 100
	DefaultMaxOrphanTxSize       = 100000
	DefaultSigCacheMaxSize       = 100000
	// These are set to default on because more often one wants them than not
	DefaultTxIndex   = true
	DefaultAddrIndex = true
	DefaultAlgo      = "random"
)

A lotta constants that probably aren't being used

Variables

View Source
var (
	// DefaultConfigFile is
	DefaultConfigFile = filepath.Join(DefaultHomeDir, DefaultConfigFilename)
	// DefaultDataDir is
	DefaultDataDir = filepath.Join(DefaultHomeDir, DefaultDataDirname)
	// DefaultHomeDir is
	DefaultHomeDir = util.AppDataDir("pod", false)
	// DefaultLogDir is
	DefaultLogDir = filepath.Join(DefaultHomeDir, DefaultLogDirname)
	// DefaultRPCCertFile is
	DefaultRPCCertFile = filepath.Join(DefaultHomeDir, "rpc.cert")
	// DefaultRPCKeyFile is
	DefaultRPCKeyFile = filepath.Join(DefaultHomeDir, "rpc.key")
	// KnownDbTypes is
	KnownDbTypes = database.SupportedDrivers()
)

nolint

View Source
var Log = cl.NewSubSystem(pkgs.Name(_d), "info")

Functions

func Main

func Main(cx *conte.Xt, shutdownChan chan struct{},
	killswitch chan struct{}, nodechan chan *rpc.Server,
	wg *sync.WaitGroup) (err error)

Main is the real main function for pod. It is necessary to work around the fact that deferred functions do not run when os.Exit() is called. The optional serverChan parameter is mainly used by the service code to be notified with the server once it is setup so it can gracefully stop it when requested from the service control manager.

  • shutdownchan can be used to wait for the node to shut down
  • killswitch can be closed to shut the node down

func NewCheckpointFromStr

func NewCheckpointFromStr(checkpoint string) (chaincfg.Checkpoint, error)

NewCheckpointFromStr parses checkpoints in the '<height>:<hash>' format.

func NewConfigParser

func NewConfigParser(cfg *Config, so *serviceOptions, options flags.Options) *flags.Parser

NewConfigParser returns a new command line flags parser.

func ParseCheckpoints

func ParseCheckpoints(checkpointStrings []string) ([]chaincfg.Checkpoint, error)

ParseCheckpoints checks the checkpoint strings for valid syntax ( '<height>:<hash>') and parses them to chaincfg.Checkpoint instances.

func UseLogger

func UseLogger(logger *cl.SubSystem,
)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using log.

func ValidDbType

func ValidDbType(dbType string) bool

ValidDbType returns whether or not dbType is a supported database type.

func ValidLogLevel

func ValidLogLevel(logLevel string) bool

ValidLogLevel returns whether or not logLevel is a valid debug log level.

Types

type Config

type Config struct {
	ShowVersion          *bool            `short:"V" long:"version" description:"Display version information and exit"`
	ConfigFile           *string          `short:"C" long:"configfile" description:"Path to configuration file"`
	DataDir              *string          `short:"b" long:"datadir" description:"Directory to store data"`
	LogDir               *string          `long:"logdir" description:"Directory to log output."`
	DebugLevel           *string          `long:"debuglevel" description:"baseline debug level for all subsystems unless specified"`
	AddPeers             *cli.StringSlice `short:"a" long:"addpeer" description:"Add a peer to connect with at startup"`
	ConnectPeers         *cli.StringSlice `long:"connect" description:"Connect only to the specified peers at startup"`
	DisableListen        *bool            `` /* 217-byte string literal not displayed */
	Listeners            *cli.StringSlice `` /* 128-byte string literal not displayed */
	MaxPeers             *int             `long:"maxpeers" description:"Max number of inbound and outbound peers"`
	DisableBanning       *bool            `long:"nobanning" description:"Disable banning of misbehaving peers"`
	BanDuration          *time.Duration   `long:"banduration" description:"How long to ban misbehaving peers.  Valid time units are {s, m, h, d}.  Minimum 1 second"`
	BanThreshold         *int             `long:"banthreshold" description:"Maximum allowed ban score before disconnecting and banning misbehaving peers."`
	Whitelists           *cli.StringSlice `long:"whitelist" description:"Add an IP network or IP that will not be banned. (eg. 192.168.1.0/24 or ::1)"`
	RPCUser              *string          `short:"u" long:"rpcuser" description:"Username for RPC connections"`
	RPCPass              *string          `short:"P" long:"rpcpass" default-mask:"-" description:"Password for RPC connections"`
	RPCLimitUser         *string          `long:"rpclimituser" description:"Username for limited RPC connections"`
	RPCLimitPass         *string          `long:"rpclimitpass" default-mask:"-" description:"Password for limited RPC connections"`
	RPCListeners         *cli.StringSlice `` /* 150-byte string literal not displayed */
	RPCCert              *string          `long:"rpccert" description:"File containing the certificate file"`
	RPCKey               *string          `long:"rpckey" description:"File containing the certificate key"`
	RPCMaxClients        *int             `long:"rpcmaxclients" description:"Max number of RPC clients for standard connections"`
	RPCMaxWebsockets     *int             `long:"rpcmaxwebsockets" description:"Max number of RPC websocket connections"`
	RPCMaxConcurrentReqs *int             `long:"rpcmaxconcurrentreqs" description:"Max number of concurrent RPC requests that may be processed concurrently"`
	RPCQuirks            *bool            `` /* 151-byte string literal not displayed */
	DisableRPC           *bool            `` /* 165-byte string literal not displayed */
	TLS                  *bool            `long:"tls" description:"Enable TLS for the RPC server"`
	DisableDNSSeed       *bool            `long:"nodnsseed" description:"Disable DNS seeding for peers"`
	ExternalIPs          *cli.StringSlice `long:"externalip" description:"Add an ip to the list of local addresses we claim to listen on to peers"`
	Proxy                *string          `long:"proxy" description:"Connect via SOCKS5 proxy (eg. 127.0.0.1:9050)"`
	ProxyUser            *string          `long:"proxyuser" description:"Username for proxy server"`
	ProxyPass            *string          `long:"proxypass" default-mask:"-" description:"Password for proxy server"`
	OnionProxy           *string          `long:"onion" description:"Connect to tor hidden services via SOCKS5 proxy (eg. 127.0.0.1:9050)"`
	OnionProxyUser       *string          `long:"onionuser" description:"Username for onion proxy server"`
	OnionProxyPass       *string          `long:"onionpass" default-mask:"-" description:"Password for onion proxy server"`
	Onion                *bool            `long:"noonion" description:"Disable connecting to tor hidden services"`
	TorIsolation         *bool            `long:"torisolation" description:"Enable Tor stream isolation by randomizing user credentials for each connection."`
	TestNet3             *bool            `long:"testnet" description:"Use the test network"`
	RegressionTest       *bool            `long:"regtest" description:"Use the regression test network"`
	SimNet               *bool            `long:"simnet" description:"Use the simulation test network"`
	AddCheckpoints       *cli.StringSlice `long:"addcheckpoint" description:"Add a custom checkpoint.  Format: '<height>:<hash>'"`
	DisableCheckpoints   *bool            `long:"nocheckpoints" description:"Disable built-in checkpoints.  Don't do this unless you know what you're doing."`
	DbType               *string          `long:"dbtype" description:"Database backend to use for the Block Chain"`
	Profile              *string          `long:"profile" description:"Enable HTTP profiling on given port -- NOTE port must be between 1024 and 65536"`
	CPUProfile           *string          `long:"cpuprofile" description:"Write CPU profile to the specified file"`
	Upnp                 *bool            `long:"upnp" description:"Use UPnP to map our listening port outside of NAT"`
	MinRelayTxFee        *float64         `long:"minrelaytxfee" description:"The minimum transaction fee in DUO/kB to be considered a non-zero fee."`
	FreeTxRelayLimit     *float64         `` /* 140-byte string literal not displayed */
	NoRelayPriority      *bool            `long:"norelaypriority" description:"Do not require free or low-fee transactions to have high priority for relaying"`
	TrickleInterval      *time.Duration   `long:"trickleinterval" description:"Minimum time between attempts to send new inventory to a connected peer"`
	MaxOrphanTxs         *int             `long:"maxorphantx" description:"Max number of orphan transactions to keep in memory"`
	Algo                 *string          `` /* 168-byte string literal not displayed */
	Generate             *bool            `long:"generate" description:"Generate (mine) bitcoins using the CPU"`
	GenThreads           *int             `long:"genthreads" description:"Number of CPU threads to use with CPU miner -1 = all cores"`
	MiningAddrs          *cli.StringSlice `` /* 177-byte string literal not displayed */
	MinerListener        *string          `long:"minerlistener" description:"listen address for miner controller"`
	MinerPass            *string          `` /* 141-byte string literal not displayed */
	BlockMinSize         *int             `long:"blockminsize" description:"Mininum block size in bytes to be used when creating a block"`
	BlockMaxSize         *int             `long:"blockmaxsize" description:"Maximum block size in bytes to be used when creating a block"`
	BlockMinWeight       *int             `long:"blockminweight" description:"Mininum block weight to be used when creating a block"`
	BlockMaxWeight       *int             `long:"blockmaxweight" description:"Maximum block weight to be used when creating a block"`
	BlockPrioritySize    *int             `long:"blockprioritysize" description:"Size in bytes for high-priority/low-fee transactions when creating a block"`
	UserAgentComments    *cli.StringSlice `long:"uacomment" description:"Comment to add to the user agent -- See BIP 14 for more information."`
	NoPeerBloomFilters   *bool            `long:"nopeerbloomfilters" description:"Disable bloom filtering support"`
	NoCFilters           *bool            `long:"nocfilters" description:"Disable committed filtering (CF) support"`
	DropCfIndex          *bool            `` /* 138-byte string literal not displayed */
	SigCacheMaxSize      *int             `long:"sigcachemaxsize" description:"The maximum number of entries in the signature verification cache"`
	BlocksOnly           *bool            `long:"blocksonly" description:"Do not accept transactions from remote peers."`
	TxIndex              *bool            `` /* 142-byte string literal not displayed */
	DropTxIndex          *bool            `long:"droptxindex" description:"Deletes the hash-based transaction index from the database on start up and then exits."`
	AddrIndex            *bool            `` /* 130-byte string literal not displayed */
	DropAddrIndex        *bool            `long:"dropaddrindex" description:"Deletes the address-based transaction index from the database on start up and then exits."`
	RelayNonStd          *bool            `long:"relaynonstd" description:"Relay non-standard transactions regardless of the default settings for the active network."`
	RejectNonStd         *bool            `long:"rejectnonstd" description:"Reject non-standard transactions regardless of the default settings for the active network."`
}

Config defines the configuration options for pod. See loadConfig for details on the configuration load process.

Directories

Path Synopsis
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.
Package mempool provides a policy-enforced pool of unmined bitcoin transactions.
Package mempool provides a policy-enforced pool of unmined bitcoin transactions.

Jump to

Keyboard shortcuts

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