dcrd/chaincfg
Hamid e40b33a2b1 chaincfg: Move a test to chainhash package.
This moves a test in chaincfg which belongs to chainhash package.
The test case that has been moved has already been covered in
chainhash test suite, but instead of deleting the test case it has
been moved, so to have a stronger test suite.
2019-03-08 00:28:27 -06:00
..
chainec multi: cleanup linter warnings 2019-02-13 08:38:25 -05:00
chainhash chaincfg: Move a test to chainhash package. 2019-03-08 00:28:27 -06: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: Remove non-root module replacements. 2019-02-08 18:01:43 -06: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: Introduce agenda for fixlnseqlocks vote. 2019-01-28 09:18:44 -06: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.