kaspad/dagconfig
Svarog 1cd2eb9308 [NOD-494] Update readmes (#543)
* [NOD-494] Updated main README.md

* [NOD-494] Updated blockdag/README.md

* [NOD-494] Aligned text length in main README.md

* [NOD-494] Updated most remaining packages READMEs + deleted util/coinset

* [NOD-494] Update integration README

* [NOD-494] Did a final pass over all readmes

* [NOD-494] Updated README for DNSSeeder with more info on how to create a functioning setup

* [NOD-494] Remove all double spaces from readmes

* [NOD-494] Minor fixes in READMEs + update license to kaspanet developers

* [NOD-494] Add backtick around ecc and util in hdkeychain README
2019-12-16 17:37:17 +02:00
..
2019-12-16 17:22:10 +02:00
2019-12-16 17:37:17 +02:00

dagconfig

ISC License GoDoc

Package dagconfig defines DAG configuration parameters for the four standard Kaspad networks and provides the ability for callers to define their own custom Kaspad networks.

Sample Use

package main

import (
	"flag"
	"fmt"
	"log"

	"github.com/kaspanet/kaspad/util"
	"github.com/kaspanet/kaspad/dagconfig"
)

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

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

func main() {
	flag.Parse()

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

	// later...

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