bch

package
v0.5.9-beta6 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: BlueOak-1.0.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UnitInfo = dex.UnitInfo{
		AtomicUnit: "Sats",
		Conventional: dex.Denomination{
			Unit:             "BCH",
			ConversionFactor: 1e8,
		},
	}
	// MainNetParams are the clone parameters for mainnet.
	MainNetParams = btc.ReadCloneParams(&btc.CloneParams{
		Name:             "mainnet",
		PubKeyHashAddrID: 0x00,
		ScriptHashAddrID: 0x05,
		Bech32HRPSegwit:  "bitcoincash",
		CoinbaseMaturity: 100,
		Net:              0xe8f3e1e3,
		GenesisHash:      mustHash("000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"),
	})
	// TestNet4Params are the clone parameters for testnet4.
	TestNet4Params = btc.ReadCloneParams(&btc.CloneParams{
		Name:             "testnet4",
		PubKeyHashAddrID: 0x6f,
		ScriptHashAddrID: 0xc4,
		Bech32HRPSegwit:  "bchtest",
		CoinbaseMaturity: 100,
		Net:              0xafdab7e2,
		GenesisHash:      mustHash("000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"),
	})
	// RegressionNetParams are the clone parameters for simnet.
	RegressionNetParams = btc.ReadCloneParams(&btc.CloneParams{
		Name:             "regtest",
		PubKeyHashAddrID: 0x6f,
		ScriptHashAddrID: 0xc4,
		Bech32HRPSegwit:  "bchreg",
		CoinbaseMaturity: 100,

		Net:         0xee87f733,
		GenesisHash: mustHash("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"),
	})
)

Functions

func DecodeCashAddress

func DecodeCashAddress(addr string, net *chaincfg.Params) (btcutil.Address, error)

DecodeCashAddress decodes a Cash Address string into a btcutil.Address that the BTC backend can use internally.

func EncodeCashAddress added in v0.5.0

func EncodeCashAddress(btcAddr btcutil.Address, net *chaincfg.Params) (string, error)

EncodeCashAddress converts a btcutil.Address that the BTC backend into a Cash Address string. For example, if a pkScript was decoded to a btcutil.Address, the correct address string would not be from the Address' String method, but from EncodeCashAddress. This is more direct than doing RecodeCashAddress(addr.String()), which needlessly decodes the string.

func RecodeCashAddress

func RecodeCashAddress(addr string, net *chaincfg.Params) (string, error)

RecodeCashAddress takes a BTC base-58 encoded address and converts it into a Cash Address.

Types

This section is empty.

Jump to

Keyboard shortcuts

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