networks

package
v0.0.0-...-e970a8b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Mainnet = AddNetwork(&Network{
		Name:         "mainnet",
		Alias:        "livenet",
		PubKeyHash:   0x00,
		ScriptHash:   0x05,
		PrivateKey:   0x80,
		Bech32Prefix: "bc",
		XPubKey:      0x0488B21E,
		XPrivKey:     0x0488ADE4,
		NetworkMagic: IntegerToMagic(0xD9B4BEF9),
		Port:         8333,
		DNSServers: []string{
			"seed.bitcoin.sipa.be",
			"dnsseed.bluematt.me",
			"seed.bitcoinstats.com",
			"seed.bitnodes.io",
		},
	})

	Testnet = AddNetwork(&Network{
		Name:         "testnet",
		Alias:        "test",
		PubKeyHash:   0x6F,
		ScriptHash:   0xC4,
		PrivateKey:   0xEF,
		Bech32Prefix: "tb",
		XPubKey:      0x043587CF,
		XPrivKey:     0x04358394,
		NetworkMagic: IntegerToMagic(0x0709110B),
		Port:         18333,
		DNSServers: []string{
			"testnet-seed.bitcoin.jonasschnelli.ch",
			"seed.tbtc.petertodd.org",
			"testnet-seed.bluematt.me",
			"testnet-seed.bitcoin.schildbach.de",
		},
	})
	Default = Mainnet
)

Default networks

Functions

func IntegerToMagic

func IntegerToMagic(i uint32) [4]byte

IntegerToMagic converts a 32-bit int to 4-byte magic buffer

func RemoveNetwork

func RemoveNetwork(data *Network)

remove network

func SetDefault

func SetDefault(net *Network)

SetDefault sets the default network for the library

Types

type Network

type Network struct {
	Name         string
	Alias        string
	PubKeyHash   byte
	ScriptHash   byte
	PrivateKey   byte
	Bech32Prefix string
	XPubKey      uint32
	XPrivKey     uint32
	NetworkMagic [4]byte
	Port         int
	DNSServers   []string
}

Network represents a Bitcoin network configuration

func AddNetwork

func AddNetwork(data *Network) *Network

AddNetwork registers a new network configuration

func Get

func Get(arg interface{}) (*Network, error)

Get retrieves a network by name, alias, or any key like pubkeyhash or prefix.

func (*Network) Is

func (n *Network) Is(name string) bool

Is returns true if the string matches the network name or alias

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL