protocol

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Networks = map[NetworkType]*Network{
	Mainnet: mainNet(),
	Testnet: testNet(),
	Regtest: regTest(),
	Simnet:  simNet(),
}

Functions

This section is empty.

Types

type BlockLimits

type BlockLimits struct {
	PruneAfterHeight uint32
	KeepBlocks       uint32
	MaxTipAge        uint32
	SlowHeight       uint32
}

type Checkpoint

type Checkpoint struct {
	Height uint32
	Hash   string
}

type Deployment

type Deployment struct {
	Name      string
	Bit       uint32
	StartTime uint32
	Timeout   uint32
	Threshold int32
	Window    int32
	Required  bool
	Force     bool
}

type KeyPrefix

type KeyPrefix struct {
	Privkey    uint32
	XPubKey    uint32
	XPrivKey   uint32
	XPubKey58  string
	XPrivKey58 string
	CoinType   uint32
}

type NamesParams

type NamesParams struct {
	AuctionStart      uint32
	RolloutInterval   uint32
	LockupPeriod      uint32
	RenewalWindow     uint32
	RenewalPeriod     uint32
	RenewalMaturity   uint32
	ClaimPeriod       uint32
	AlexaLockupPeriod uint32
	ClaimFrequency    uint32
	BiddingPeriod     uint32
	RevealPeriod      uint32
	TreeInterval      uint32
	TransferLockup    uint32
	AuctionMaturity   uint32
	NoRollout         bool
	NoReserved        bool
}

type Network

type Network struct {
	Type           string
	Seeds          []string
	Magic          uint32
	Port           uint16
	BrontidePort   uint16
	CheckpointMap  map[uint32]string
	LastCheckpoint uint32
	Checkpoints    []Checkpoint

	HalvingInterval  uint32
	CoinbaseMaturity uint32
	Genesis          gen.Net
	GenesisBlock     string
	UnknownBitsMask  uint32

	POW        POWParams
	Names      NamesParams
	GoosigStop uint32
	Block      BlockLimits

	ActivationThreshold uint32
	MinerWindow         uint32

	Deployments map[string]Deployment
	Deploys     []Deployment

	KeyPrefix     KeyPrefix
	AddressPrefix string
	ClaimPrefix   string

	RequireStandard bool
	MinRelay        uint32
	FeeRate         uint32
	MaxFeeRate      uint32

	RPCPort    uint16
	WalletPort uint16
	NSPort     uint16
	RSPort     uint16

	IdentityKeyHex string
	SelfConnect    bool
	RequestMempool bool

	DeflationHeight uint32
	TxStartHeight   uint32
	// contains filtered or unexported fields
}

func Ensure

func Ensure(n *Network) *Network

Ensure returns n if known, else returns Primary()

func FromAddress

func FromAddress(hrp string, prefer ...NetworkType) *Network

FromAddress finds a network by its bech32 address prefix.

func FromMagic

func FromMagic(magic uint32, prefer ...NetworkType) *Network

FromMagic finds a network by magic number.

func FromPrivate

func FromPrivate(prefix uint32, prefer ...NetworkType) *Network

FromPrivate finds a network by its xprivkey prefix.

func FromPrivate58

func FromPrivate58(prefix string, prefer ...NetworkType) *Network

FromPrivate58 finds a network by its xprivkey base58 prefix.

func FromPublic

func FromPublic(prefix uint32, prefer ...NetworkType) *Network

FromPublic finds a network by xpubkey prefix.

func FromPublic58

func FromPublic58(prefix string, prefer ...NetworkType) *Network

FromPublic58 finds a network by its xpubkey base58 prefix.

func FromWIF

func FromWIF(prefix uint32, prefer ...NetworkType) *Network

FromWIF finds a network by WIF prefix.

func Get

func Get(t NetworkType) *Network

Get returns a network by type (nil if unknown)

func Primary

func Primary() *Network

Primary returns the default network and defaults to mainnet

func SelectNetwork

func SelectNetwork(t NetworkType) *Network

func SetPrimary

func SetPrimary(t NetworkType) *Network

SetPrimary sets the default/primary network.

func (*Network) ByBit

func (n *Network) ByBit(bit uint32) *Deployment

func (*Network) Ms

func (n *Network) Ms() int64

func (*Network) Now

func (n *Network) Now() time.Time

func (*Network) SetTimeSource

func (n *Network) SetTimeSource(ts TimeSource)

func (*Network) String

func (n *Network) String() string

type NetworkType

type NetworkType string
const (
	Mainnet NetworkType = "main"
	Testnet NetworkType = "testnet"
	Regtest NetworkType = "regtest"
	Simnet  NetworkType = "simnet"
)

func Types

func Types() []NetworkType

Types lists all supported network type constants.

type POWParams

type POWParams struct {
	Limit          *big.Int
	Bits           uint32
	Chainwork      *big.Int
	TargetWindow   uint32
	TargetSpacing  uint32
	BlocksPerDay   uint32
	TargetTimespan uint32
	MinActual      uint32
	MaxActual      uint32
	TargetReset    bool
	NoRetargeting  bool
}

type TimeSource

type TimeSource interface {
	Now() time.Time
	Ms() int64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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