bx

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2021 License: ISC Imports: 38 Imported by: 0

Documentation

Overview

Copyright (c) 2020-2021 The bitcoinpay developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Copyright (c) 2020-2021 The bitcoinpay developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Copyright (c) 2020-2021 The bitcoinpay developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Copyright (c) 2020-2021 The bitcoinpay developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Copyright (c) 2020-2021 The bitcoinpay developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Copyright (c) 2020-2021 The bitcoinpay developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Copyright (c) 2020-2021 The bitcoinpay developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Copyright (c) 2020-2021 The bitcoinpay developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Index

Constants

View Source
const (
	BTCMsgSignaturePrefixMagic        = "Bitcoin Signed Message:\n"
	BitcoinpayMsgSignaturePrefixMagic = "bitcoinpay Signed Message:\n"
)

Variables

View Source
var (
	BitcoinpayMainnetBip32Version = bip32.Bip32Version{PrivKeyVersion: params.MainNetParams.HDPrivateKeyID[:], PubKeyVersion: params.MainNetParams.HDPublicKeyID[:]}
	BitcoinpayTestnetBip32Version = bip32.Bip32Version{PrivKeyVersion: params.TestNetParams.HDPrivateKeyID[:], PubKeyVersion: params.TestNetParams.HDPublicKeyID[:]}
	BitcoinpayPrivnetBip32Version = bip32.Bip32Version{PrivKeyVersion: params.PrivNetParams.HDPrivateKeyID[:], PubKeyVersion: params.PrivNetParams.HDPublicKeyID[:]}
	BitcoinpayMixnetBip32Version  = bip32.Bip32Version{PrivKeyVersion: params.MixNetParam.HDPrivateKeyID[:], PubKeyVersion: params.MixNetParam.HDPublicKeyID[:]}
)

Functions

func Base58CheckDecode

func Base58CheckDecode(mode, hasher string, versionSize, cksumSize int, input string, showDetails bool)

func Base58CheckEncode

func Base58CheckEncode(version []byte, mode string, hasher string, cksumSize int, input string)

func Base58Decode

func Base58Decode(input string)

func Base58Encode

func Base58Encode(input string)

func Base64Decode

func Base64Decode(input string)

func Base64Encode

func Base64Encode(input string)

func Bitcoin160

func Bitcoin160(input string)

func Blake256

func Blake256(input string)

func Blake2b256

func Blake2b256(input string)

func Blake2b512

func Blake2b512(input string)

func BuildMsgHash

func BuildMsgHash(mode string, msg string) []byte

func CalcHash160

func CalcHash160(mode string, data []byte) []byte

func CompactToGPS

func CompactToGPS(compactS string, blockTime, scale int, printDetail bool)

func CompactToHashrate

func CompactToHashrate(input, unit string, printDetail bool, blocktime int)

func CompactToTarget

func CompactToTarget(input, powtype string)

func DecodeAddr

func DecodeAddr(mode string, addrStr string) ([]byte, error)

func DecodeSignature

func DecodeSignature(signatureType string, signStr string)

func DecodeWIF

func DecodeWIF(wif string) ([]byte, bool, error)

func Dump

func Dump(s *rlp.Stream, depth int, buffer *bytes.Buffer) (*bytes.Buffer, error)

func EcNew

func EcNew(curve string, entropyStr string) (string, error)

func EcNewSTDO

func EcNewSTDO(curve string, entropyStr string)

func EcPrivateKeyToEcPublicKey

func EcPrivateKeyToEcPublicKey(uncompressed bool, privateKeyStr string) (string, error)

func EcPrivateKeyToEcPublicKeySTDO

func EcPrivateKeyToEcPublicKeySTDO(uncompressed bool, privateKeyStr string)

func EcPrivateKeyToWif

func EcPrivateKeyToWif(uncompressed bool, privateKeyStr string)

func EcPubKeyToAddress

func EcPubKeyToAddress(version string, pubkey string) (string, error)

func EcPubKeyToAddressSTDO

func EcPubKeyToAddressSTDO(version []byte, pubkey string)

func EcScriptKeyToAddress

func EcScriptKeyToAddress(version string, pubkey string) (string, error)

func EncodeWIF

func EncodeWIF(uncompressed bool, privateKeyStr string) (string, error)

func ErrExit

func ErrExit(err error)

func GPSToCompact

func GPSToCompact(gps string, blockTime, scale int)

func GetBip32NetworkInfo

func GetBip32NetworkInfo(rawVersionByte []byte) string

func GetHashrate

func GetHashrate(hashBig *big.Int, unit string) (string, string)

func Hash160

func Hash160(input string)

func HashrateToCompact

func HashrateToCompact(difficulty string, blocktime int)

func HdDecode

func HdDecode(keyStr string)

The Serialization format of BIP32 Key https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#serialization-format

4 bytes: version bytes
         mainnet: 0x0488B21E public, 0x0488ADE4 private; testnet: 0x043587CF public, 0x04358394 private
1 byte : depth: 0x00 for master nodes, 0x01 for level-1 derived keys, ....
4 bytes: the fingerprint of the parent's key (0x00000000 if master key)
4 bytes: child number. This is ser32(i) for i in xi = xpar/i, with xi the key being serialized. (0x00000000 if master key)
         index ≥ 0x80000000 to hardened keys

32 bytes: the chain code 33 bytes: the public key or private key data (serP(K) for public keys, 0x00 || ser256(k) for private keys)

4 bytes: checksum

func HdDerive

func HdDerive(hard bool, index uint32, path wallet.DerivationPath, version bip32.Bip32Version, key string)

func HdKeyToEcKey

func HdKeyToEcKey(version bip32.Bip32Version, keyStr string)

func HdNewMasterPrivateKey

func HdNewMasterPrivateKey(version bip32.Bip32Version, entropyStr string)

func HdPrivateKeyToHdPublicKey

func HdPrivateKeyToHdPublicKey(version bip32.Bip32Version, privateKeyStr string)

func IsASCII

func IsASCII(b []byte) bool

func Keccak256

func Keccak256(input string)

func MnemonicNew

func MnemonicNew(entropyStr string)

func MnemonicToEntropy

func MnemonicToEntropy(mnemonicStr string)

func MnemonicToSeed

func MnemonicToSeed(passphrase string, mnemonicStr string)

func MsgSign

func MsgSign(mode string, showSignDetail bool, wif string, msg string, showDetails bool)

func NewEntropy

func NewEntropy(size uint) (string, error)

func Ripemd160

func Ripemd160(input string)

func RlpDecode

func RlpDecode(input string)

func RlpEncode

func RlpEncode(input string)

func Sha256

func Sha256(input string)

func Sha3_256

func Sha3_256(input string)

func TargetToCompact

func TargetToCompact(input, powtype string)

func TxDecode

func TxDecode(network string, rawTxStr string)

func TxEncode

func TxEncode(version uint32, lockTime uint32, timestamp *time.Time, inputs map[string]uint32, outputs map[string]uint64) (string, error)

func TxEncodeSTDO

func TxEncodeSTDO(version TxVersionFlag, lockTime TxLockTimeFlag, txIn TxInputsFlag, txOut TxOutputsFlag)

func TxSign

func TxSign(privkeyStr string, rawTxStr string, network string) (string, error)

func TxSignSTDO

func TxSignSTDO(privkeyStr string, rawTxStr string, network string)

func VerifyMsgSignature

func VerifyMsgSignature(mode string, addrStr string, signStr string, msgStr string)

func WifToEcPrivateKey

func WifToEcPrivateKey(wif string)

func WifToEcPubkey

func WifToEcPubkey(uncompressed bool, wif string)

func Ws

func Ws(n int) string

Types

type Bip32VersionFlag

type Bip32VersionFlag struct {
	Version bip32.Bip32Version
	// contains filtered or unexported fields
}

func (*Bip32VersionFlag) Set

func (v *Bip32VersionFlag) Set(versionFlag string) error

func (*Bip32VersionFlag) String

func (v *Bip32VersionFlag) String() string

type BitcoinpayBase58checkVersionFlag

type BitcoinpayBase58checkVersionFlag struct {
	Ver []byte
	// contains filtered or unexported fields
}

func (*BitcoinpayBase58checkVersionFlag) Set

func (*BitcoinpayBase58checkVersionFlag) String

type DerivePathFlag

type DerivePathFlag struct {
	Path wallet.DerivationPath
}

func (*DerivePathFlag) Set

func (d *DerivePathFlag) Set(s string) error

func (*DerivePathFlag) String

func (d *DerivePathFlag) String() string

type TxInputsFlag

type TxInputsFlag struct {
	// contains filtered or unexported fields
}

func (*TxInputsFlag) Set

func (v *TxInputsFlag) Set(s string) error

func (TxInputsFlag) String

func (v TxInputsFlag) String() string

type TxLockTimeFlag

type TxLockTimeFlag uint32

func (*TxLockTimeFlag) Set

func (lt *TxLockTimeFlag) Set(s string) error

func (TxLockTimeFlag) String

func (lt TxLockTimeFlag) String() string

type TxOutputsFlag

type TxOutputsFlag struct {
	// contains filtered or unexported fields
}

func (*TxOutputsFlag) Set

func (of *TxOutputsFlag) Set(s string) error

func (TxOutputsFlag) String

func (of TxOutputsFlag) String() string

type TxVersionFlag

type TxVersionFlag uint32

func (*TxVersionFlag) Set

func (ver *TxVersionFlag) Set(s string) error

func (TxVersionFlag) String

func (ver TxVersionFlag) String() string

Jump to

Keyboard shortcuts

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