# README
chaincfg
Package chaincfg defines chain configuration parameters for the three standard Parallelcoin networks and provides the ability for callers to define their own custom networks.
Although this package was primarily written for pod, it has intentionally been designed so it can be used as a standalone package for any projects needing to use parameters for the standard Bitcoin networks or for projects needing to define their own network.
Sample Use
package main
import (
"flag"
"fmt"
"log"
"github.com/p9c/pod/pkg/chain/config/netparams"
"git.parallelcoin.io/util"
"github.com/p9c/pod/pkg/chain/config"
)
var testnet = flag.Bool("testnet", false, "operate on the testnet Bitcoin network")
// By default (without -testnet), use mainnet.
var chainParams = &netparams.MainNetParams
func main() {
flag.Parse()
// Modify active network parameters if operating on testnet.
if *testnet {
chainParams = &netparams.TestNet3Params
}
// later...
// Create and print new payment address, specific to the active network.
pubKeyHash := make([]byte, 20)
addr, err := util.NewAddressPubKeyHash(pubKeyHash, chainParams)
if err != nil {
L.Error(err)
}
log.Println(addr)
}
Installation and Updating
$ go get -u github.com/p9c/pod/chaincfg
License
Package chaincfg is licensed under the copyfree ISC License.
# Packages
No description provided by the author
# Functions
BigToCompact converts a whole number N to a compact representation using an unsigned 32-bit number.
No description provided by the author
CompactToBig converts a compact representation of a whole number N to an unsigned 32-bit number.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
HDPrivateKeyToPublicKeyID accepts a private hierarchical deterministic extended key id and returns the associated public key id.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
IsBech32SegwitPrefix returns whether the prefix is a known prefix for segwit addresses on any default or registered network.
IsPubKeyHashAddrID returns whether the id is an identifier known to prefix a pay-to-pubkey-hash address on any default or registered network.
IsScriptHashAddrID returns whether the id is an identifier known to prefix a pay-to-script-hash address on any default or registered network.
Register registers the network parameters for a Bitcoin network.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Constants
DefinedDeployments is the number of currently defined deployments.
DeploymentCSV defines the rule change deployment ID for the CSV soft-fork package.
DeploymentSegwit defines the rule change deployment ID for the Segregated Witness (segwit) soft-fork package.
DeploymentTestDummy defines the rule change deployment ID for testing purposes.
# Variables
AveragingInterval is the number of blocks to average (per algorithm).
AveragingTargetTimespan is how many seconds for the averaging target interval.
ErrDuplicateNet describes an error where the parameters for a Bitcoin network could not be set due to the network already being a standard network or previously-registered into this package.
ErrUnknownHDKeyID describes an error where the provided id which is intended to identify the network for a hierarchical deterministic private extended key is not registered.
Interval is the number of blocks in the averaging window.
MainNetParams defines the network parameters for the main Bitcoin network.
MainPowLimit is the pre-hardfork pow limit.
MainPowLimitBits is the bits version of the above.
MaxAdjustDown is the percentage hard limit for downwards difficulty adjustment (ie 90%).
MaxAdjustUp is the percentage hard limit for upwards (ie 120%).
RegressionTestParams defines the network parameters for the regression test Bitcoin network.
ScryptPowLimit is the pre-hardfork maximum hash for Scrypt algorithm.
ScryptPowLimitBits is the bits version of the above.
SimNetParams defines the network parameters for the simulation test Bitcoin network.
TargetTimePerBlock is the pre hardfork target time for blocks.
TargetTimespan is the base for adjustment.
TestNet3Params defines the network parameters for the test Bitcoin network (version 3).
TestnetAveragingInterval is the number of blocks to average (per algorithm).
TestnetAveragingTargetTimespan is how many seconds for the averaging target interval.
TestnetInterval is the number of blocks in the averaging window.
TestnetMaxAdjustDown is the percentage hard limit for downwards difficulty adjustment (ie 90%).
TestnetMaxAdjustUp is the percentage hard limit for upwards (ie 120%).
TestnetTargetTimePerBlock is the pre hardfork target time for blocks.
TestnetTargetTimespan is the base for adjustment.
# Structs
Checkpoint identifies a known good point in the block chain.
ConsensusDeployment defines details related to a specific consensus rule change that is voted in.
DNSSeed identifies a DNS seed.
Params defines a Bitcoin network by its parameters.