dcrd/chaincfg
Dave Collins 527399b852
chaincfg: Unexport internal errors.
These errors are only used internally and thus should not be exported.

While here, it also removes the completely unused VoteBitsNotFound
error.

It should be noted that this is a breaking change to the API and thus
will need a v2 major version bump of the chaincfg module to be published
before the changes can be externally consumed.
2018-10-10 17:56:16 -05:00
..
chainec multi: Remove unused secp256k1 sig parse parameter. 2018-07-04 12:27:34 -05:00
chainhash chainhash: Update go build module support. 2018-07-20 17:27:06 -05:00
doc.go Merge remaining dcrutil code into a dcrd package. 2017-10-11 22:06:36 -04:00
genesis_test.go multi: Resurrect regression network. 2018-10-09 18:52:13 -05:00
genesis.go multi: Resurrect regression network. 2018-10-09 18:52:13 -05:00
go.mod multi: Resurrect regression network. 2018-10-09 18:52:13 -05:00
go.sum build: Tidy module sums (go mod tidy). 2018-08-16 20:03:27 -05:00
init_test.go chaincfg: Unexport internal errors. 2018-10-10 17:56:16 -05:00
init.go chaincfg: Unexport internal errors. 2018-10-10 17:56:16 -05:00
internal_test.go multi: Upstream chainhash abstraction sync 2016-11-16 12:48:40 -06:00
mainnetparams.go chaincfg: Add checkpoints for upcoming release. 2018-08-07 11:46:16 -05:00
params_test.go chainhash: Abstract hash logic to new package. (#729) 2016-08-08 14:04:33 -05:00
params.go chaincfg: Unexport internal errors. 2018-10-10 17:56:16 -05:00
premine.go multi: Resurrect regression network. 2018-10-09 18:52:13 -05:00
README.md Merge remaining dcrutil code into a dcrd package. 2017-10-11 22:06:36 -04:00
register_test.go multi: Resurrect regression network. 2018-10-09 18:52:13 -05:00
regnetparams.go multi: Resurrect regression network. 2018-10-09 18:52:13 -05:00
simnetparams.go multi: Latest consensus active from simnet genesis. 2018-10-10 15:58:53 -05:00
testnetparams.go multi: Remove testnet version 2 defs and refs. 2018-08-08 08:10:22 -05:00

chaincfg

Build Status ISC License GoDoc

Package chaincfg defines chain configuration parameters for the three standard Decred networks and provides the ability for callers to define their own custom Decred networks.

Although this package was primarily written for dcrd, it has intentionally been designed so it can be used as a standalone package for any projects needing to use parameters for the standard Decred networks or for projects needing to define their own network.

Sample Use

package main

import (
	"flag"
	"fmt"
	"log"

	"github.com/decred/dcrd/dcrutil"
	"github.com/decred/dcrd/chaincfg"
)

var testnet = flag.Bool("testnet", false, "operate on the testnet Decred network")

// By default (without -testnet), use mainnet.
var chainParams = &chaincfg.MainNetParams

func main() {
	flag.Parse()

	// Modify active network parameters if operating on testnet.
	if *testnet {
		chainParams = &chaincfg.TestNetParams
	}

	// later...

	// Create and print new payment address, specific to the active network.
	pubKeyHash := make([]byte, 20)
	addr, err := btcutil.NewAddressPubKeyHash(pubKeyHash, chainParams)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(addr)
}

Installation and Updating

$ go get -u github.com/decred/dcrd/chaincfg

License

Package chaincfg is licensed under the copyfree ISC License.