qx

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: ISC Imports: 36 Imported by: 4

Documentation

Overview

Copyright 2017-2018 The qitmeer developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Copyright 2017-2018 The qitmeer developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Copyright 2017-2018 The qitmeer developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Copyright 2017-2018 The qitmeer developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Copyright 2017-2018 The qitmeer developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Copyright 2017-2018 The qitmeer developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Copyright 2017-2018 The qitmeer developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Copyright 2017-2018 The qitmeer 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"
	QitmeerMsgSignaturePrefixMagic = "Qitmeer Signed Message:\n"
)

Variables

View Source
var (
	QitmeerMainnetBip32Version = bip32.Bip32Version{PrivKeyVersion: params.MainNetParams.HDPrivateKeyID[:], PubKeyVersion: params.MainNetParams.HDPublicKeyID[:]}
	QitmeerTestnetBip32Version = bip32.Bip32Version{PrivKeyVersion: params.TestNetParams.HDPrivateKeyID[:], PubKeyVersion: params.TestNetParams.HDPublicKeyID[:]}
	QitmeerPrivnetBip32Version = bip32.Bip32Version{PrivKeyVersion: params.PrivNetParams.HDPrivateKeyID[:], PubKeyVersion: params.PrivNetParams.HDPublicKeyID[:]}
	QitmeerMixnetBip32Version  = 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 added in v0.10.1

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

func CompactToTarget added in v0.10.1

func CompactToTarget(input, powtype string)

func DecodeAddr

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

func DecodePkString added in v0.10.1

func DecodePkString(pk string) (string, 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 added in v0.10.1

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

func ErrExit

func ErrExit(err error)

func GPSToCompact added in v0.10.1

func GPSToCompact(gps string, blockTime, scale int)

func GetBip32NetworkInfo

func GetBip32NetworkInfo(rawVersionByte []byte) string

func GetHashrate added in v0.10.1

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

func Hash160

func Hash160(input string)

func HashrateToCompact added in v0.10.1

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 added in v0.10.1

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 []Input, outputs map[string]Amount) (string, error)

func TxEncodeSTDO

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

func TxSign

func TxSign(privkeyStrs []string, rawTxStr string, network string, pks []string) (string, error)

func TxSignSTDO

func TxSignSTDO(privkeyStr string, rawTxStr string, network string, pks []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 Amount added in v0.10.1

type Amount struct {
	TargetLockTime int64
	Value          int64
	Id             types.CoinID
}

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 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 Input added in v0.10.1

type Input struct {
	TxID     string
	OutIndex uint32
}

type QitmeerBase58checkVersionFlag

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

func (*QitmeerBase58checkVersionFlag) Set

func (*QitmeerBase58checkVersionFlag) 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