network

package
v0.0.0-...-d2b8996 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2019 License: BSD-3-Clause Imports: 0 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MainNet -- bitcoin mainet.
	MainNet = &Network{

		PubKeyHashAddrID:        0x00,
		ScriptHashAddrID:        0x05,
		PrivateKeyID:            0x80,
		WitnessPubKeyHashAddrID: 0x06,
		WitnessScriptHashAddrID: 0x0A,

		Bech32HRPSegwit: "bc",

		HDPrivateKeyID: []byte{0x04, 0x88, 0xad, 0xe4},
		HDPublicKeyID:  []byte{0x04, 0x88, 0xb2, 0x1e},

		Magic:           []byte{0xf9, 0xbe, 0xb4, 0xd9},
		Port:            8333,
		LastBlock:       1,
		ProtocolVersion: 70015,
		UserAgent:       "/tokucore:0.0.1/",
	}

	// TestNet -- bitcoin testnet.
	TestNet = &Network{

		PubKeyHashAddrID:        0x6f,
		ScriptHashAddrID:        0xc4,
		WitnessPubKeyHashAddrID: 0x03,
		WitnessScriptHashAddrID: 0x28,
		PrivateKeyID:            0xef,

		Bech32HRPSegwit: "tb",

		HDPrivateKeyID: []byte{0x04, 0x35, 0x83, 0x94},
		HDPublicKeyID:  []byte{0x04, 0x35, 0x87, 0xcf},

		Magic:           []byte{0x0b, 0x11, 0x09, 0x07},
		Port:            18333,
		LastBlock:       1,
		ProtocolVersion: 70015,
		UserAgent:       "/tokucore:0.0.1/",
	}
)

Functions

This section is empty.

Types

type Network

type Network struct {
	// Address encoding magics.
	PubKeyHashAddrID        byte // First byte of a P2PKH address
	ScriptHashAddrID        byte // First byte of a P2PSH address
	PrivateKeyID            byte // First byte of a WIF private key
	WitnessPubKeyHashAddrID byte // First byte of a P2WPKH address
	WitnessScriptHashAddrID byte // First byte of P2WSH address

	// Human-readable part for Bech32 encoded segwit addresses, as defined in BIP173.
	Bech32HRPSegwit string

	// BIP32 hierarchical deterministic extended key magics.
	HDPrivateKeyID []byte
	HDPublicKeyID  []byte

	// Protocol.
	Magic           []byte
	Port            uint32
	LastBlock       uint32
	ProtocolVersion uint32
	UserAgent       string
}

Network -- network paramars.

func (*Network) SetLastBlock

func (net *Network) SetLastBlock(last uint32) *Network

SetLastBlock -- set last block.

func (*Network) SetMagic

func (net *Network) SetMagic(magic []byte) *Network

SetMagic -- set magic.

func (*Network) SetPort

func (net *Network) SetPort(port uint32) *Network

SetPort -- set port.

Jump to

Keyboard shortcuts

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