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
- Variables
- func Base58CheckDecode(mode, hasher string, versionSize, cksumSize int, input string, ...)
- func Base58CheckEncode(version []byte, mode string, hasher string, cksumSize int, input string)
- func Base58Decode(input string)
- func Base58Encode(input string)
- func Base64Decode(input string)
- func Base64Encode(input string)
- func Bitcoin160(input string)
- func Blake256(input string)
- func Blake2b256(input string)
- func Blake2b512(input string)
- func BuildMsgHash(mode string, msg string) []byte
- func CalcHash160(mode string, data []byte) []byte
- func CompactToGPS(compactS string, blockTime, scale int, printDetail bool)
- func CompactToHashrate(input, unit string, printDetail bool, blocktime int)
- func CompactToTarget(input, powtype string)
- func DecodeAddr(mode string, addrStr string) ([]byte, error)
- func DecodeSignature(signatureType string, signStr string)
- func DecodeWIF(wif string) ([]byte, bool, error)
- func Dump(s *rlp.Stream, depth int, buffer *bytes.Buffer) (*bytes.Buffer, error)
- func EcNew(curve string, entropyStr string) (string, error)
- func EcNewSTDO(curve string, entropyStr string)
- func EcPrivateKeyToEcPublicKey(uncompressed bool, privateKeyStr string) (string, error)
- func EcPrivateKeyToEcPublicKeySTDO(uncompressed bool, privateKeyStr string)
- func EcPrivateKeyToWif(uncompressed bool, privateKeyStr string)
- func EcPubKeyToAddress(version string, pubkey string) (string, error)
- func EcPubKeyToAddressSTDO(version []byte, pubkey string)
- func EcScriptKeyToAddress(version string, pubkey string) (string, error)
- func EncodeWIF(uncompressed bool, privateKeyStr string) (string, error)
- func ErrExit(err error)
- func GPSToCompact(gps string, blockTime, scale int)
- func GetBip32NetworkInfo(rawVersionByte []byte) string
- func GetHashrate(hashBig *big.Int, unit string) (string, string)
- func Hash160(input string)
- func HashrateToCompact(difficulty string, blocktime int)
- func HdDecode(keyStr string)
- func HdDerive(hard bool, index uint32, path wallet.DerivationPath, ...)
- func HdKeyToEcKey(version bip32.Bip32Version, keyStr string)
- func HdNewMasterPrivateKey(version bip32.Bip32Version, entropyStr string)
- func HdPrivateKeyToHdPublicKey(version bip32.Bip32Version, privateKeyStr string)
- func IsASCII(b []byte) bool
- func Keccak256(input string)
- func MnemonicNew(entropyStr string)
- func MnemonicToEntropy(mnemonicStr string)
- func MnemonicToSeed(passphrase string, mnemonicStr string)
- func MsgSign(mode string, showSignDetail bool, wif string, msg string, showDetails bool)
- func NewEntropy(size uint) (string, error)
- func Ripemd160(input string)
- func RlpDecode(input string)
- func RlpEncode(input string)
- func Sha256(input string)
- func Sha3_256(input string)
- func TargetToCompact(input, powtype string)
- func TxDecode(network string, rawTxStr string)
- func TxEncode(version uint32, lockTime uint32, timestamp *time.Time, ...) (string, error)
- func TxEncodeSTDO(version TxVersionFlag, lockTime TxLockTimeFlag, txIn TxInputsFlag, ...)
- func TxSign(privkeyStr string, rawTxStr string, network string) (string, error)
- func TxSignSTDO(privkeyStr string, rawTxStr string, network string)
- func VerifyMsgSignature(mode string, addrStr string, signStr string, msgStr string)
- func WifToEcPrivateKey(wif string)
- func WifToEcPubkey(uncompressed bool, wif string)
- func Ws(n int) string
- type Bip32VersionFlag
- type BitcoinpayBase58checkVersionFlag
- type DerivePathFlag
- type TxInputsFlag
- type TxLockTimeFlag
- type TxOutputsFlag
- type TxVersionFlag
Constants ¶
const ( BTCMsgSignaturePrefixMagic = "Bitcoin Signed Message:\n" BitcoinpayMsgSignaturePrefixMagic = "bitcoinpay Signed Message:\n" )
Variables ¶
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 Base58CheckEncode ¶
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 Blake2b256 ¶
func Blake2b256(input string)
func Blake2b512 ¶
func Blake2b512(input string)
func BuildMsgHash ¶
func CalcHash160 ¶
func CompactToGPS ¶
func CompactToHashrate ¶
func CompactToTarget ¶
func CompactToTarget(input, powtype string)
func DecodeSignature ¶
func EcPrivateKeyToWif ¶
func EcPubKeyToAddressSTDO ¶
func EcScriptKeyToAddress ¶
func GPSToCompact ¶
func GetBip32NetworkInfo ¶
func HashrateToCompact ¶
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 MnemonicNew ¶
func MnemonicNew(entropyStr string)
func MnemonicToEntropy ¶
func MnemonicToEntropy(mnemonicStr string)
func MnemonicToSeed ¶
func NewEntropy ¶
func TargetToCompact ¶
func TargetToCompact(input, powtype string)
func TxEncodeSTDO ¶
func TxEncodeSTDO(version TxVersionFlag, lockTime TxLockTimeFlag, txIn TxInputsFlag, txOut TxOutputsFlag)
func TxSignSTDO ¶
func VerifyMsgSignature ¶
func WifToEcPrivateKey ¶
func WifToEcPrivateKey(wif string)
func WifToEcPubkey ¶
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 (n *BitcoinpayBase58checkVersionFlag) Set(s string) error
func (*BitcoinpayBase58checkVersionFlag) String ¶
func (n *BitcoinpayBase58checkVersionFlag) String() 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