dcrd/chaincfg
cjepson df701d8cdf Revert sync merge
The sync merge does not build and needs further testing. It is
being reverted.
2016-03-08 22:16:06 -05:00
..
chainec Resolve all remaining issues caught by goclean.sh 2016-02-15 11:24:00 -05:00
chainhash Resolve all remaining issues caught by goclean.sh 2016-02-15 11:24:00 -05:00
doc.go Initial Decred Commit. 2016-02-07 14:00:12 -05:00
genesis_test.go Re-add genesis block 2016-02-08 12:21:43 -05:00
genesis.go Re-add genesis block 2016-02-08 12:21:43 -05:00
internal_test.go Work on improving the use of analysis tools in goclean.sh 2016-02-12 15:24:32 -05:00
params.go Revert sync merge 2016-03-08 22:16:06 -05:00
premine.go Initial Decred Commit. 2016-02-07 14:00:12 -05:00
README.md Initial Decred Commit. 2016-02-07 14:00:12 -05:00
register_test.go Initial Decred Commit. 2016-02-07 14:00:12 -05:00

chaincfg

(http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)

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/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)
}

Documentation

[GoDoc] (http://godoc.org/github.com/decred/dcrd/chaincfg)

Full go doc style documentation for the project can be viewed online without installing this package by using the GoDoc site here.

You can also view the documentation locally once the package is installed with the godoc tool by running godoc -http=":6060" and pointing your browser to http://localhost:6060/pkg/github.com/decred/dcrd/chaincfg

Installation

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

License

Package chaincfg is licensed under the copyfree ISC License.