model

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2018 License: BSD-2-Clause Imports: 11 Imported by: 44

Documentation

Index

Constants

View Source
const AntiReplayCommitment = "Bitcoin: A Peer-to-Peer Electronic Cash System"

Variables

View Source
var (
	RegisteredNets          = make(map[wire.BitcoinNet]struct{})
	PubKeyHashAddressIDs    = make(map[byte]struct{})
	ScriptHashAddressIDs    = make(map[byte]struct{})
	HDPrivateToPublicKeyIDs = make(map[[4]byte][]byte)
)
View Source
var ActiveNetParams = &MainNetParams
View Source
var GenesisBlock = block.NewGenesisBlock()
View Source
var GenesisBlockHash = GenesisBlock.GetHash()
View Source
var MainNetParams = BitcoinParams{
	Param: consensus.Param{
		GenesisHash:            &GenesisBlockHash,
		SubsidyHalvingInterval: 210000,
		BIP34Height:            227931,

		BIP34Hash: *util.HashFromString("000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8"),

		BIP65Height: 388381,

		BIP66Height: 363725,

		CSVHeight:                     419328,
		PowLimit:                      mainPowLimit,
		TargetTimespan:                60 * 60 * 24 * 14,
		TargetTimePerBlock:            60 * 10,
		FPowAllowMinDifficultyBlocks:  false,
		FPowNoRetargeting:             false,
		RuleChangeActivationThreshold: 1916,
		MinerConfirmationWindow:       2016,
		Deployments: [consensus.MaxVersionBitsDeployments]consensus.BIP9Deployment{
			consensus.DeploymentTestDummy: {Bit: 28, StartTime: 1199145601, Timeout: 1230767999},
			consensus.DeploymentCSV:       {Bit: 0, StartTime: 1462060800, Timeout: 1493596800},
		},

		MinimumChainWork: *util.HashFromString("000000000000000000000000000000000000000000a0f3064330647e2f6c4828"),

		DefaultAssumeValid: *util.HashFromString("000000000000000000e45ad2fbcc5ff3e85f0868dd8f00ad4e92dffabe28f8d2"),

		UAHFHeight: 478558,

		DAAHeight: 504031,

		MonolithActivationTime: 1526400000,

		MagneticAnomalyActivationTime: 1542300000,

		GreatWallActivationTime: 1557921600,
	},

	Name:        "main",
	BitcoinNet:  wire.MainNet,
	DefaultPort: "8333",
	DNSSeeds: []DNSSeed{
		{Host: "seed.bitcoinabc.org", HasFiltering: true},
		{Host: "seed-abc.bitcoinforks.org", HasFiltering: true},
		{Host: "btccash-seeder.bitcoinunlimited.info", HasFiltering: true},
		{Host: "seed.bitprim.org", HasFiltering: true},
		{Host: "seed.deadalnix.me", HasFiltering: true},
		{Host: "seeder.criptolayer.net", HasFiltering: false},
	},
	GenesisBlock: GenesisBlock,

	PowLimitBits:             GenesisBlock.Header.Bits,
	CoinbaseMaturity:         100,
	SubsidyReductionInterval: 210000,

	RetargetAdjustmentFactor: 4,
	ReduceMinDifficulty:      false,
	MinDiffReductionTime:     0,
	GenerateSupported:        false,
	Checkpoints: []*Checkpoint{
		{11111, util.HashFromString("0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d")},
		{33333, util.HashFromString("000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6")},
		{74000, util.HashFromString("0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20")},
		{105000, util.HashFromString("00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97")},
		{134444, util.HashFromString("00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe")},
		{168000, util.HashFromString("000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763")},
		{193000, util.HashFromString("000000000000059f452a5f7340de6682a977387c17010ff6e6c3bd83ca8b1317")},
		{210000, util.HashFromString("000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e")},
		{216116, util.HashFromString("00000000000001b4f4b433e81ee46494af945cf96014816a4e2370f11b23df4e")},
		{225430, util.HashFromString("00000000000001c108384350f74090433e7fcf79a606b8e797f065b130575932")},
		{250000, util.HashFromString("000000000000003887df1f29024b06fc2200b55f8af8f35453d7be294df2d214")},
		{267300, util.HashFromString("000000000000000a83fbd660e918f218bf37edd92b748ad940483c7c116179ac")},
		{279000, util.HashFromString("0000000000000001ae8c72a0b0c301f67e3afca10e819efa9041e458e9bd7e40")},
		{295000, util.HashFromString("00000000000000004d9b4ef50f0f9d686fd69db2e03af35a100370c64632a983")},
		{300255, util.HashFromString("0000000000000000162804527c6e9b9f0563a280525f9d08c12041def0a0f3b2")},
		{319400, util.HashFromString("000000000000000021c6052e9becade189495d1c539aa37c58917305fd15f13b")},
		{343185, util.HashFromString("0000000000000000072b8bf361d01a6ba7d445dd024203fafc78768ed4368554")},
		{352940, util.HashFromString("000000000000000010755df42dba556bb72be6a32f3ce0b6941ce4430152c9ff")},
		{382320, util.HashFromString("00000000000000000a8dc6ed5b133d0eb2fd6af56203e4159789b092defd8ab2")},

		{478558, util.HashFromString("0000000000000000011865af4122fe3b144e2cbeea86142e8ff2fb4107352d43")},

		{504031, util.HashFromString("0000000000000000011ebf65b60d0a3de80b8175be709d653b4c1a1beeb6ab9c")},

		{530359, util.HashFromString("0000000000000000011ada8bd08f46074f44a8f155396f43e38acf9501c49103")},
	},
	MineBlocksOnDemands: false,

	BlockEnforceNumRequired: 750,
	BlockRejectNumRequired:  950,
	BlockUpgradeNumToCheck:  1000,

	RequireStandard:     true,
	RelayNonStdTxs:      false,
	PubKeyHashAddressID: 0x00,
	ScriptHashAddressID: 0x05,
	PrivatekeyID:        0x80,

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

	HDCoinType: 0,
}
View Source
var RegTestGenesisBlock = block.NewRegTestGenesisBlock()
View Source
var RegTestGenesisHash = RegTestGenesisBlock.GetHash()
View Source
var RegressionNetParams = BitcoinParams{
	Param: consensus.Param{
		GenesisHash:                   &RegTestGenesisHash,
		SubsidyHalvingInterval:        150,
		BIP34Height:                   100000000,
		BIP34Hash:                     util.Hash{},
		BIP65Height:                   1351,
		BIP66Height:                   1251,
		CSVHeight:                     576,
		PowLimit:                      regressingPowLimit,
		TargetTimespan:                60 * 60 * 24 * 14,
		TargetTimePerBlock:            60 * 10,
		FPowAllowMinDifficultyBlocks:  true,
		FPowNoRetargeting:             true,
		RuleChangeActivationThreshold: 108,
		MinerConfirmationWindow:       144,
		Deployments: [consensus.MaxVersionBitsDeployments]consensus.BIP9Deployment{
			consensus.DeploymentTestDummy: {
				Bit:       28,
				StartTime: 0,
				Timeout:   999999999999,
			},
			consensus.DeploymentCSV: {
				Bit:       0,
				StartTime: 0,
				Timeout:   999999999999,
			},
		},
		MinimumChainWork:   *util.HashFromString("00"),
		DefaultAssumeValid: *util.HashFromString("00"),
		UAHFHeight:         0,
		DAAHeight:          0,

		MonolithActivationTime: 1526400000,

		MagneticAnomalyActivationTime: 1542300000,

		GreatWallActivationTime: 1557921600,
	},

	Name:         "regtest",
	BitcoinNet:   wire.RegTestNet,
	DefaultPort:  "18444",
	DNSSeeds:     []DNSSeed{},
	GenesisBlock: RegTestGenesisBlock,

	PowLimitBits:             RegTestGenesisBlock.Header.Bits,
	CoinbaseMaturity:         100,
	SubsidyReductionInterval: 150,

	RetargetAdjustmentFactor: 4,
	ReduceMinDifficulty:      true,
	MinDiffReductionTime:     time.Minute * 20,
	GenerateSupported:        true,
	Checkpoints:              nil,
	MineBlocksOnDemands:      true,

	BlockEnforceNumRequired: 750,
	BlockRejectNumRequired:  950,
	BlockUpgradeNumToCheck:  1000,

	RelayNonStdTxs:      true,
	PubKeyHashAddressID: 0x6f,
	ScriptHashAddressID: 0xc4,
	PrivatekeyID:        0xef,

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

	HDCoinType: 1,
}
View Source
var TestNetGenesisBlock = block.NewTestNetGenesisBlock()
View Source
var TestNetGenesisHash = TestNetGenesisBlock.GetHash()
View Source
var TestNetParams = BitcoinParams{
	Param: consensus.Param{
		SubsidyHalvingInterval: 210000,
		BIP34Height:            21111,
		BIP34Hash:              *util.HashFromString("0000000023b3a96d3484e5abb3755c413e7d41500f8e2a5c3f0dd01299cd8ef8"),
		BIP65Height:            581885,
		BIP66Height:            330776,
		CSVHeight:              770112,

		PowLimit:                      testNetPowLimit,
		TargetTimespan:                60 * 60 * 24 * 14,
		TargetTimePerBlock:            60 * 10,
		FPowAllowMinDifficultyBlocks:  true,
		FPowNoRetargeting:             false,
		RuleChangeActivationThreshold: 1512,
		MinerConfirmationWindow:       2016,
		Deployments: [consensus.MaxVersionBitsDeployments]consensus.BIP9Deployment{
			consensus.DeploymentTestDummy: {
				Bit:       28,
				StartTime: 1199145601,
				Timeout:   1230767999,
			},
			consensus.DeploymentCSV: {
				Bit:       0,
				StartTime: 1456790400,
				Timeout:   1493596800,
			},
		},
		MinimumChainWork:   *util.HashFromString("00000000000000000000000000000000000000000000002a650f6ff7649485da"),
		DefaultAssumeValid: *util.HashFromString("0000000000327972b8470c11755adf8f4319796bafae01f5a6650490b98a17db"),
		UAHFHeight:         1155875,
		DAAHeight:          1188697,

		MonolithActivationTime: 1526400000,

		MagneticAnomalyActivationTime: 1542300000,

		GreatWallActivationTime: 1557921600,

		GenesisHash: &TestNetGenesisHash,
	},

	Name:        "test",
	BitcoinNet:  wire.TestNet3,
	DiskMagic:   wire.TestDiskMagic,
	DefaultPort: "18333",
	DNSSeeds: []DNSSeed{
		{Host: "testnet-seed.bitcoinabc.org", HasFiltering: true},
		{Host: "testnet-seed-abc.bitcoinforks.org", HasFiltering: true},
		{Host: "testnet-seed.deadalnix.me", HasFiltering: true},
		{Host: "testnet-seed.bitprim.org", HasFiltering: true},
		{Host: "testnet-seeder.criptolayer.net", HasFiltering: true},
	},
	GenesisBlock:             TestNetGenesisBlock,
	PowLimitBits:             GenesisBlock.Header.Bits,
	CoinbaseMaturity:         100,
	SubsidyReductionInterval: 210000,
	RetargetAdjustmentFactor: 4,
	ReduceMinDifficulty:      true,
	MinDiffReductionTime:     time.Minute * 20,
	GenerateSupported:        false,
	Checkpoints: []*Checkpoint{
		{546, util.HashFromString("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70")},

		{1155875, util.HashFromString("00000000f17c850672894b9a75b63a1e72830bbd5f4c8889b5c1a80e7faef138")},

		{1188697, util.HashFromString("0000000000170ed0918077bde7b4d36cc4c91be69fa09211f748240dabe047fb")},
	},
	MineBlocksOnDemands: false,

	BlockEnforceNumRequired: 51,
	BlockRejectNumRequired:  75,
	BlockUpgradeNumToCheck:  100,

	RelayNonStdTxs:      true,
	PubKeyHashAddressID: 0x6f,
	ScriptHashAddressID: 0xc4,
	PrivatekeyID:        0xef,

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

	HDCoinType:          1,
	MiningRequiresPeers: true,
	// contains filtered or unexported fields
}

Functions

func GetBlockSubsidy added in v0.0.3

func GetBlockSubsidy(height int32, params *BitcoinParams) amount.Amount

func HDPrivateKeyToPublicKeyID

func HDPrivateKeyToPublicKeyID(id []byte) ([]byte, error)

func IsDAAEnabled

func IsDAAEnabled(height int32) bool

func IsMagneticAnomalyEnabled added in v0.0.4

func IsMagneticAnomalyEnabled(mediaTimePast int64) bool

func IsPublicKeyHashAddressID

func IsPublicKeyHashAddressID(id byte) bool

func IsReplayProtectionEnabled

func IsReplayProtectionEnabled(medianTimePast int64) bool

func IsScriptHashAddressid

func IsScriptHashAddressid(id byte) bool

func IsUAHFEnabled

func IsUAHFEnabled(height int32) bool

IsUAHFEnabled Check is UAHF has activated.

func Register

func Register(bitcoinParams *BitcoinParams) error

func SetRegTestParams added in v0.0.2

func SetRegTestParams()

func SetTestNetParams added in v0.0.2

func SetTestNetParams()

Types

type BitcoinParams

type BitcoinParams struct {
	consensus.Param
	Name                     string
	BitcoinNet               wire.BitcoinNet
	DiskMagic                wire.BitcoinNet
	DefaultPort              string
	DNSSeeds                 []DNSSeed
	GenesisBlock             *block.Block
	PowLimitBits             uint32
	CoinbaseMaturity         uint16
	SubsidyReductionInterval int32
	RetargetAdjustmentFactor int64
	ReduceMinDifficulty      bool
	MinDiffReductionTime     time.Duration
	GenerateSupported        bool
	Checkpoints              []*Checkpoint
	MineBlocksOnDemands      bool

	// Enforce current block version once network has
	// upgraded.  This is part of BIP0034.
	BlockEnforceNumRequired uint64

	// Reject previous block versions once network has
	// upgraded.  This is part of BIP0034.
	BlockRejectNumRequired uint64

	// The number of nodes to check.  This is part of BIP0034.
	BlockUpgradeNumToCheck uint64

	RequireStandard     bool
	RelayNonStdTxs      bool
	PubKeyHashAddressID byte
	ScriptHashAddressID byte
	PrivatekeyID        byte
	HDPrivateKeyID      [4]byte
	HDPublicKeyID       [4]byte
	HDCoinType          uint32

	PruneAfterHeight int

	MiningRequiresPeers      bool
	DefaultConsistencyChecks bool
	// contains filtered or unexported fields
}

func (*BitcoinParams) TxData

func (param *BitcoinParams) TxData() *ChainTxData

type ChainTxData

type ChainTxData struct {
	Time    time.Time
	TxCount int64
	TxRate  float64
}

type Checkpoint

type Checkpoint struct {
	Height int32
	Hash   *util.Hash
}

type DNSSeed

type DNSSeed struct {
	// Host defines the hostname of the seed.
	Host string

	// HasFiltering defines whether the seed supports filtering
	// by service flags (wire.ServiceFlag).
	HasFiltering bool
}

DNSSeed identifies a DNS seed.

Directories

Path Synopsis
Package wallet models the data for a wallet It is not a complete wallet and only provides basic testing capabilities for rpc currently
Package wallet models the data for a wallet It is not a complete wallet and only provides basic testing capabilities for rpc currently

Jump to

Keyboard shortcuts

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