dcrd/chaincfg
Dave Collins 99ac29c86b
chaincfg: Rename extended key accessor funcs.
This renames the recently introduced accessor functions for obtaining
the hierarchical deterministic extended private and public key magic
version bytes based on feedback.

Ordinarily this would require a major module version bump, however,
since a new version with the functions has not been released yet, it is
acceptable to rename them without breaking callers.
2019-03-25 13:09:38 -05:00
..
chainec multi: cleanup linter warnings 2019-02-13 08:38:25 -05:00
chainhash multi: Add go 1.11 directive to all modules. 2019-03-18 02:02:35 -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 chaincfg: Use expected regnet merkle root var. 2019-03-15 14:25:27 -05:00
go.mod multi: Add go 1.11 directive to all modules. 2019-03-18 02:02:35 -05:00
go.sum multi: Remove non-root module replacements. 2019-02-08 18:01:43 -06:00
init_test.go chaincfg: Unexport internal errors. 2018-10-10 17:56:16 -05:00
init.go multi: cleanup linter warnings 2019-02-13 08:38:25 -05:00
mainnetparams.go chaincfg: Introduce agenda for fixlnseqlocks vote. 2019-01-28 09:18:44 -06:00
params_test.go chainhash: Abstract hash logic to new package. (#729) 2016-08-08 14:04:33 -05:00
params.go chaincfg: Rename extended key accessor funcs. 2019-03-25 13:09:38 -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: cleanup linter warnings 2019-02-13 08:38:25 -05:00
regnetparams.go chaincfg: Introduce agenda for fixlnseqlocks vote. 2019-01-28 09:18:44 -06:00
simnetparams.go multi: Latest consensus active from simnet genesis. 2018-10-10 15:58:53 -05:00
testnetparams.go chaincfg: Introduce agenda for fixlnseqlocks vote. 2019-01-28 09:18:44 -06: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.