stasatdaglabs 667b2d46e9
[NOD-557] Remove RegTest (#889)
* [NOD-557] Remove regTest network.

* [NOD-557] Remove remaining references to regTest.

* [NOD-557] Move newHashFromStr from params.go to params_test.go.

* [NOD-557] Rename test to network in register_test.go.

* [NOD-557] Replaced removed tests in TestDecodeAddressErrorConditions.
2020-08-23 15:38:27 +03:00
..
2020-08-23 15:38:27 +03:00
2020-08-23 15:38:27 +03:00
2020-08-23 15:38:27 +03:00
2020-08-23 15:38:27 +03:00
2020-08-13 17:27:25 +03:00

dagconfig

ISC License GoDoc

Package dagconfig defines DAG configuration parameters for the 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/domain/dagconfig"
)

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

// By default (without --testnet), use mainnet.
var dagParams = &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)
}