types

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommitmentDataSize    = 33
	CommitmentHexDataSize = 66
	EmptyBlinder          = "0000000000000000000000000000000000000000000000000000000000000000"
)
View Source
const (
	DescriptorKeyNull DescriptorKeyType = iota
	DescriptorKeyPublic
	DescriptorKeyBip32
	DescriptorKeyBip32Priv
	DescriptorKeySchnorr

	DescriptorTypeNull DescriptorType = iota
	DescriptorTypeSh
	DescriptorTypeWsh
	DescriptorTypePk
	DescriptorTypePkh
	DescriptorTypeWpkh
	DescriptorTypeCombo
	DescriptorTypeMulti
	DescriptorTypeSortedMulti
	DescriptorTypeAddr
	DescriptorTypeRaw
	DescriptorTypeMiniscript
	DescriptorTypeTaproot
)
View Source
const (
	PrivkeyLength    = 32 // privkey length
	PrivkeyHexLength = 64 // privkey hex length
)
View Source
const (
	CompressedPubkeyLength      = 33  // compressed pubkey length
	CompressedPubkeyHexLength   = 66  // compressed pubkey hex length
	UncompressedPubkeyLength    = 65  // uncompressed pubkey length
	UncompressedPubkeyHexLength = 130 // uncompressed pubkey hex length
)
View Source
const (
	// sequence lock time: final
	SequenceLockTimeFinal uint32 = 0xffffffff
	// sequence lock time: enable max time
	SequenceLockTimeEnableMax uint32 = 0xfffffffe

	// tx version: 1
	TxVersion1 uint32 = 1
	// tx version: 2
	TxVersion2 uint32 = 1

	// locktime: 0
	LockTimeZero uint32 = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Address       string
	Network       NetworkType
	Type          AddressType
	LockingScript Script
}

Address ...

type AddressType

type AddressType int
const (
	// AddressType
	UnknownAddress AddressType = iota
	P2pkhAddress
	P2shAddress
	P2wpkhAddress
	P2wshAddress
	P2shP2wpkhAddress
	P2shP2wshAddress
	TaprootAddress
)

func NewAddressType

func NewAddressType(cfdAddressType int) AddressType

NewAddressType ...

func NewAddressTypeByHashType

func NewAddressTypeByHashType(hashType int) AddressType

NewAddressTypeByHashType ...

func NewAddressTypeByString

func NewAddressTypeByString(addressType string) AddressType

NewAddressTypeByString ...

func (AddressType) String added in v0.3.12

func (n AddressType) String() string

String ...

func (AddressType) ToCfdValue

func (n AddressType) ToCfdValue() int

ToCfdValue ...

func (AddressType) ToHashType

func (n AddressType) ToHashType() HashType

ToHashType ...

type BlindInputData

type BlindInputData struct {
	OutPoint         OutPoint // OutPoint
	Asset            string   // Asset
	AssetBlindFactor string   // Asset BlindFactor
	Amount           int64    // satoshi value
	ValueBlindFactor string   // Value BlindFactor
	IssuanceKey      *IssuanceBlindingKey
}

BlindInputData ...

type BlindOutputData

type BlindOutputData struct {
	Index               int    // txout index (-1: auto)
	ConfidentialAddress string // confidential or not address
	ConfidentialKey     string // (optional) confidential key
}

BlindOutputData ...

type BlindTxOption

type BlindTxOption struct {
	MinimumRangeValue int64 // blind minimum range value
	Exponent          int64 // blind exponent
	MinimumBits       int64 // blind minimum bits
	AppendDummyOutput bool  // add dummy output if txout is low
}

BlindTxOption BlindRawTransaction option data struct.

func NewBlindTxOption

func NewBlindTxOption() BlindTxOption

NewBlindTxOption ...

type Block

type Block struct {
	Hex string
}

Block ...

type BlockHeader

type BlockHeader struct {
	Version       uint32 // Version
	PrevBlockHash string // previous block hash
	MerkleRoot    string // merkleroot
	Time          uint32 // block time
	Bits          uint32 // bit flag
	Nonce         uint32 // nonce
}

BlockHeader block header information.

type ByteData

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

ByteData This struct holds a byte array.

func NewByteData

func NewByteData(data []byte) ByteData

NewByteData This function create a bytedata from a byte array.

func NewByteDataFromHex

func NewByteDataFromHex(hexStr string) (ByteData, error)

NewByteDataFromHex This function create a bytedata from a hex string.

func NewByteDataFromHexIgnoreError

func NewByteDataFromHexIgnoreError(hexStr string) *ByteData

NewByteDataFromHex This function create a bytedata from a hex string. On error, it returns nil.

func (*ByteData) ToHex

func (obj *ByteData) ToHex() string

ToHex This function return a hex string.

func (*ByteData) ToSlice

func (obj *ByteData) ToSlice() []byte

ToHex This function return a byte array.

type ConfidentialAddress

type ConfidentialAddress struct {
	ConfidentialAddress string
	Address             string
	Network             NetworkType
	Type                AddressType
	ConfidentialKey     *Pubkey
}

ConfidentialAddress ...

type ConfidentialTx

type ConfidentialTx struct {
	Hex string
}

ConfidentialTx ...

type ConfidentialTxIn

type ConfidentialTxIn struct {
	OutPoint                 OutPoint
	Sequence                 uint32
	ScriptSig                string
	Issuance                 IssuanceData
	WitnessStack             ScriptWitness
	PeginWitness             ScriptWitness
	IssuanceAmountRangeproof string
	InflationKeysRangeproof  string
}

ConfidentialTxIn confidential transaction input.

func NewConfidentialTxIn added in v0.3.9

func NewConfidentialTxIn(cfdTxin *cfd.ConfidentialTxIn) *ConfidentialTxIn

type ConfidentialTxOut

type ConfidentialTxOut struct {
	Amount          int64  // satoshi amount (unblind value)
	Asset           string // asset (or commitment asset)
	LockingScript   string // locking script
	Address         string // address or confidential address. (if locking script is usual hashtype.)
	CommitmentValue string // commitment value
	CommitmentNonce string // commitment nonce
	Surjectionproof string // surjectionprooof of asset
	Rangeproof      string // rangeproof of value
}

ConfidentialTxOut confidential transaction output.

func NewConfidentialTxOut added in v0.3.9

func NewConfidentialTxOut(cfdTxout *cfd.ConfidentialTxOut) *ConfidentialTxOut

func (ConfidentialTxOut) HasBlinding added in v0.3.15

func (c ConfidentialTxOut) HasBlinding() bool

type ConfidentialTxOutIndexMap added in v0.3.16

type ConfidentialTxOutIndexMap map[uint32]*ConfidentialTxOut

func (ConfidentialTxOutIndexMap) GetTotalAmount added in v0.3.16

func (c ConfidentialTxOutIndexMap) GetTotalAmount() int64

type ConfidentialTxOutSet added in v0.3.13

type ConfidentialTxOutSet []*ConfidentialTxOut

func (ConfidentialTxOutSet) Filter added in v0.3.16

func (ConfidentialTxOutSet) FindByAddress added in v0.3.13

func (c ConfidentialTxOutSet) FindByAddress(address string) map[uint32]*ConfidentialTxOut

func (ConfidentialTxOutSet) FindByAddressFirst added in v0.3.13

func (c ConfidentialTxOutSet) FindByAddressFirst(address string) (*ConfidentialTxOut, uint32)

func (ConfidentialTxOutSet) FindByLockingScript added in v0.3.13

func (c ConfidentialTxOutSet) FindByLockingScript(lockingScript string) map[uint32]*ConfidentialTxOut

func (ConfidentialTxOutSet) FindByLockingScriptFirst added in v0.3.13

func (c ConfidentialTxOutSet) FindByLockingScriptFirst(lockingScript string) (*ConfidentialTxOut, uint32)

func (ConfidentialTxOutSet) GetFeeAmount added in v0.3.13

func (c ConfidentialTxOutSet) GetFeeAmount() int64

type Descriptor

type Descriptor struct {
	// Output Descriptor
	OutputDescriptor string
}

Descriptor This struct use for the output descriptor.

type DescriptorData

type DescriptorData struct {
	// depth (0 - )
	Depth uint32
	// script type. (CfdDescriptorScriptType)
	ScriptType int
	// locking script.
	LockingScript string
	// address string. (for ScriptType not KCfdDescriptorScriptRaw)
	Address string
	// hash type. (CfdHashType)
	HashType int
	// redeem script. (for ScriptType KCfdDescriptorScriptSh or KCfdDescriptorScriptWsh)
	RedeemScript string
	// key type. (see CfdDescriptorKeyData.KeyType)
	KeyType int
	// pubkey
	Pubkey string
	// extend pubkey
	ExtPubkey string
	// extend privkey
	ExtPrivkey string
	// schnorr pubkey
	SchnorrPubkey string
	// has multisig
	IsMultisig bool
	// number of multisig require signatures
	ReqSigNum uint32
	// Taproot ScriptTree string
	TreeString string
}

*

  • Descriptor data struct.

func NewDescriptorData added in v0.3.9

func NewDescriptorData(cfdData *cfd.CfdDescriptorData) *DescriptorData

type DescriptorKey added in v0.3.11

type DescriptorKey struct {
	// key type. (CfdDescriptorKeyType)
	// - KCfdDescriptorKeyNull
	// - KCfdDescriptorKeyPublic
	// - KCfdDescriptorKeyBip32
	// - KCfdDescriptorKeyBip32Priv
	// - KCfdDescriptorKeySchnorr
	KeyType DescriptorKeyType
	// pubkey
	Pubkey *Pubkey
	// extend pubkey
	ExtPubkey *ExtPubkey
	// extend privkey
	ExtPrivkey *ExtPrivkey
	// schnorr pubkey
	SchnorrPubkey string // TODO(k-matsuzawa): please wait
}

DescriptorKey stores a key data for descriptor.

func NewDescriptorKey added in v0.3.11

func NewDescriptorKey(keyType int, pubkey, extPubkey, extPrivkey, schnorrPubkey string) DescriptorKey

func (DescriptorKey) GetPublicKey added in v0.3.11

func (d DescriptorKey) GetPublicKey() string

type DescriptorKeyData

type DescriptorKeyData struct {
	// key type. (CfdDescriptorKeyType)
	// - KCfdDescriptorKeyNull
	// - KCfdDescriptorKeyPublic
	// - KCfdDescriptorKeyBip32
	// - KCfdDescriptorKeyBip32Priv
	// - KCfdDescriptorKeySchnorr
	KeyType int
	// pubkey
	Pubkey string
	// extend pubkey
	ExtPubkey string
	// extend privkey
	ExtPrivkey string
	// schnorr pubkey
	SchnorrPubkey string
}

*

  • Descriptor key data struct.

type DescriptorKeyType added in v0.3.11

type DescriptorKeyType int

func NewDescriptorKeyType added in v0.3.11

func NewDescriptorKeyType(keyType int) DescriptorKeyType

func (DescriptorKeyType) ToCfdValue added in v0.3.11

func (k DescriptorKeyType) ToCfdValue() int

ToCfdValue ...

func (DescriptorKeyType) Valid added in v0.3.11

func (k DescriptorKeyType) Valid() bool

Valid ...

type DescriptorKeys added in v0.3.14

type DescriptorKeys []DescriptorKey

func (DescriptorKeys) ExistPublicKey added in v0.3.14

func (d DescriptorKeys) ExistPublicKey(pubkey *Pubkey) bool

func (DescriptorKeys) Find added in v0.3.14

func (d DescriptorKeys) Find(key DescriptorKey) bool

func (DescriptorKeys) GetPublicKeys added in v0.3.14

func (d DescriptorKeys) GetPublicKeys() []string

type DescriptorMultisig added in v0.3.11

type DescriptorMultisig struct {
	ReqSigNum uint32         // number of multisig require signatures
	Keys      DescriptorKeys // Multisig keys
}

DescriptorMultisig stores the multisig data for descriptor.

func NewDescriptorMultisig added in v0.3.11

func NewDescriptorMultisig(reqSigNum uint32, keys []DescriptorKeyData) *DescriptorMultisig

type DescriptorParseFilter added in v0.3.13

type DescriptorParseFilter struct {
	EnableHashTypes            []HashType
	DisableHashTypes           []HashType
	IsMultisigOnlyOnScriptHash bool
	EnableRootDescriptorTypes  []DescriptorType
	DisableRootDescriptorTypes []DescriptorType
}

DescriptorParseFilter defines filter conditions for parsing output descriptors.

func (*DescriptorParseFilter) Check added in v0.3.13

type DescriptorRootData added in v0.3.11

type DescriptorRootData struct {
	// depth (0 - )
	Depth uint32
	// script type. (CfdDescriptorScriptType)
	Type DescriptorType
	// address string. (for Type not KCfdDescriptorScriptRaw)
	Address Address
	// hash type.
	HashType HashType
	// redeem script. (for HashType P2sh,P2wsh,P2shP2wsh)
	RedeemScript *Script
	// key
	Key DescriptorKey
	// multisig
	Multisig *DescriptorMultisig
	// Taproot ScriptTree string
	TreeString string // TODO(k-matsuzawa): please wait
}

DescriptorRootData stores descriptor root data

func (DescriptorRootData) ExistPublicKey added in v0.3.14

func (d DescriptorRootData) ExistPublicKey(pubkey *Pubkey) bool

func (DescriptorRootData) GetAddress added in v0.3.14

func (d DescriptorRootData) GetAddress() string

func (DescriptorRootData) GetPublicKey added in v0.3.11

func (d DescriptorRootData) GetPublicKey() string

func (DescriptorRootData) GetPublicKeys added in v0.3.14

func (d DescriptorRootData) GetPublicKeys() []string

func (DescriptorRootData) GetRedeemScript added in v0.3.11

func (d DescriptorRootData) GetRedeemScript() string

func (DescriptorRootData) HasMultisig added in v0.3.11

func (d DescriptorRootData) HasMultisig() bool

type DescriptorType added in v0.3.11

type DescriptorType int

func NewDescriptorType added in v0.3.11

func NewDescriptorType(descType int) DescriptorType

func (DescriptorType) ToCfdValue added in v0.3.11

func (t DescriptorType) ToCfdValue() int

ToCfdValue ...

type DescriptorTypes added in v0.3.13

type DescriptorTypes []DescriptorType

func (DescriptorTypes) Find added in v0.3.13

func (d DescriptorTypes) Find(descType DescriptorType) bool

func (DescriptorTypes) IsValid added in v0.3.13

func (d DescriptorTypes) IsValid() bool

type ElementsUtxoData

type ElementsUtxoData struct {
	OutPoint          OutPoint             // OutPoint
	Asset             string               // Asset
	AssetBlindFactor  string               // Asset BlindFactor
	AssetCommitment   string               // Asset commitment
	Amount            int64                // satoshi value
	ValueBlindFactor  string               // Value BlindFactor
	AmountCommitment  string               // Amount commitment
	Descriptor        string               // output descriptor
	ScriptSigTemplate string               // scriptsig template hex (require script hash estimate fee)
	IssuanceKey       *IssuanceBlindingKey // issuance key
	IsIssuance        bool                 // is issuance output
	IsBlindIssuance   bool                 // is blind issuance output
	PeginData         *PeginUtxoData       // pegin data
	GenesisBlockHash  *string              // genesis block hash
}

func (ElementsUtxoData) ConvertToCfdUtxo

func (u ElementsUtxoData) ConvertToCfdUtxo() cfd.CfdUtxo

func (ElementsUtxoData) HasBlindUtxo

func (u ElementsUtxoData) HasBlindUtxo() bool

type ExtPrivkey

type ExtPrivkey struct {
	Key string
}

ExtPrivkey xprv

type ExtPubkey

type ExtPubkey struct {
	Key string
}

ExtPubkey xpub

type ExtkeyData

type ExtkeyData struct {
	// version
	Version string
	// parent fingerprint
	Fingerprint string
	// chain code
	ChainCode string
	// depth
	Depth uint32
	// child number
	ChildNumber uint32
	// key type
	KeyType ExtkeyType
	// network
	Network NetworkType
}

type ExtkeyFormatType added in v0.4.0

type ExtkeyFormatType int
const (
	ExtkeyFormatTypeUnknown ExtkeyFormatType = -1
	ExtkeyFormatTypeBip32   ExtkeyFormatType = 0
	ExtkeyFormatTypeBip49   ExtkeyFormatType = 1
	ExtkeyFormatTypeBip84   ExtkeyFormatType = 2
)

func NewExtkeyFormatTypeByString added in v0.4.0

func NewExtkeyFormatTypeByString(formatTypeStr string) ExtkeyFormatType

func (ExtkeyFormatType) ToCfdValue added in v0.4.0

func (t ExtkeyFormatType) ToCfdValue() int

type ExtkeyType added in v0.3.7

type ExtkeyType int

ExtkeyType ...

const (
	// ExtkeyType
	UnknownExtkeyType ExtkeyType = iota
	ExtPrivkeyType
	ExtPubkeyType
)

func NewExtkeyType added in v0.3.7

func NewExtkeyType(cfdExtkeyType int) ExtkeyType

NewExtkeyType ...

func NewExtkeyTypeByString added in v0.3.7

func NewExtkeyTypeByString(extkeyType string) ExtkeyType

NewExtkeyTypeByString ...

func (ExtkeyType) String added in v0.3.12

func (n ExtkeyType) String() string

String ...

func (ExtkeyType) ToCfdValue added in v0.3.7

func (n ExtkeyType) ToCfdValue() int

ToCfdValue ...

func (ExtkeyType) Valid added in v0.3.7

func (n ExtkeyType) Valid() bool

Valid ...

type FundRawTxOption

type FundRawTxOption struct {
	// fee asset
	FeeAsset string
	// use blind tx
	IsBlindTx bool
	// effective feerate
	EffectiveFeeRate float64
	// longterm feerate
	LongTermFeeRate float64
	// dust feerate
	DustFeeRate float64
	// knapsack min change value. knapsack logic's threshold. Recommended value is 1.
	KnapsackMinChange int64
	// blind exponent. default is 0.
	Exponent int64
	// blind minimum bits. default is -1 (cfd-go auto).
	MinimumBits int64
}

*

  • FundRawTransaction option data struct.

func NewCfdFundRawTxOption

func NewCfdFundRawTxOption(networkType NetworkType) FundRawTxOption

type HashType

type HashType int
const (
	// HashType
	UnknownType HashType = iota
	P2pkh
	P2sh
	P2wpkh
	P2wsh
	P2shP2wpkh
	P2shP2wsh
	Taproot
)

func NewHashType

func NewHashType(cfdHashType int) HashType

NewHashType ...

func NewHashTypeByString

func NewHashTypeByString(hashType string) HashType

NewHashTypeByString ...

func (HashType) GetWitnessVersion added in v0.4.0

func (n HashType) GetWitnessVersion() int

func (HashType) IsP2shSegwit added in v0.3.11

func (n HashType) IsP2shSegwit() bool

IsP2shSegwit ...

func (HashType) IsPubkeyHash added in v0.3.11

func (n HashType) IsPubkeyHash() bool

IsPubkeyHash ...

func (HashType) IsScriptHash added in v0.3.11

func (n HashType) IsScriptHash() bool

IsScriptHash ...

func (HashType) IsWitness added in v0.3.12

func (n HashType) IsWitness() bool

IsWitness ...

func (HashType) IsWitnessV1OrLater added in v0.3.13

func (n HashType) IsWitnessV1OrLater() bool

IsWitnessV1OrLater ...

func (HashType) String added in v0.3.12

func (n HashType) String() string

String ...

func (HashType) ToCfdValue

func (n HashType) ToCfdValue() int

ToCfdValue ...

type HashTypes added in v0.3.13

type HashTypes []HashType

func (HashTypes) Find added in v0.3.13

func (d HashTypes) Find(hashType HashType) bool

func (HashTypes) IsValid added in v0.3.13

func (d HashTypes) IsValid() bool

type HdWallet

type HdWallet struct {
	Seed string
}

HdWallet seed

type InputConfidentialTxIn

type InputConfidentialTxIn struct {
	OutPoint   OutPoint
	Sequence   uint32
	PeginInput *InputPeginData
}

InputConfidentialTxIn ...

type InputConfidentialTxOut

type InputConfidentialTxOut struct {
	Amount        int64  // satoshi amount (unblind value)
	Asset         string // asset (or commitment asset)
	LockingScript string // locking script
	Address       string // address or confidential address. (if locking script is usual hashtype.)
	Nonce         string // direct nonce
	PegoutInput   *InputPegoutData
	IsDestroy     bool
	IsFee         bool
}

InputConfidentialTxOut ...

type InputPeginData

type InputPeginData struct {
	BitcoinTransaction      string
	BitcoinGenesisBlockHash string
	BitcoinAssetId          string
	ClaimScript             string
	TxOutProof              string
}

InputPeginData ...

type InputPegoutData

type InputPegoutData struct {
	BitcoinGenesisBlockHash string
	OnlineKey               string
	BitcoinOutputDescriptor string
	Bip32Counter            uint32
	Whitelist               string
}

InputPegoutData ...

type InputTxIn

type InputTxIn struct {
	OutPoint OutPoint
	Sequence uint32
}

type InputTxOut

type InputTxOut struct {
	Amount        int64  // satoshi amount (unblind value)
	LockingScript string // locking script
	Address       string // address or confidential address. (if locking script is usual hashtype.)
}

type IssuanceBlindingKey

type IssuanceBlindingKey struct {
	AssetBlindingKey string // (option) Asset blinding key
	TokenBlindingKey string // (option) Token blinding key
}

IssuanceBlindingKey ...

type IssuanceData

type IssuanceData struct {
	Entropy     string
	Nonce       string
	AssetAmount int64
	AssetValue  string
	TokenAmount int64
	TokenValue  string
}

IssuanceData confidential transaction issuance input.

type NetworkType

type NetworkType int
const (
	// NetworkType
	Unknown NetworkType = iota
	Mainnet
	Testnet
	Regtest
	LiquidV1
	ElementsRegtest
)

func NewNetworkType

func NewNetworkType(cfdNetworkType int) NetworkType

NewNetworkType ...

func NewNetworkTypeByString

func NewNetworkTypeByString(networkType string) NetworkType

NewNetworkTypeByString ...

func (NetworkType) IsBitcoin

func (n NetworkType) IsBitcoin() bool

IsBitcoin ...

func (NetworkType) IsElements

func (n NetworkType) IsElements() bool

IsElements ...

func (NetworkType) IsMainnet added in v0.3.10

func (n NetworkType) IsMainnet() bool

IsMainnet ...

func (NetworkType) String added in v0.3.12

func (n NetworkType) String() string

String ...

func (NetworkType) ToBitcoinType

func (n NetworkType) ToBitcoinType() NetworkType

ToBitcoinType ...

func (NetworkType) ToBitcoinTypePointer

func (n NetworkType) ToBitcoinTypePointer() *NetworkType

ToBitcoinTypePointer ...

func (NetworkType) ToCfdValue

func (n NetworkType) ToCfdValue() int

ToCfdValue ...

func (NetworkType) Valid

func (n NetworkType) Valid() bool

Valid ...

type OutPoint

type OutPoint struct {
	// txid
	Txid string
	// vout
	Vout uint32
}

OutPoint : utxo outpoint struct.

func (OutPoint) Equal

func (o OutPoint) Equal(target OutPoint) bool

String This function return outpoint's string.

func (OutPoint) String

func (o OutPoint) String() string

String This function return outpoint's string.

type PakEntry added in v0.4.0

type PakEntry struct {
	ByteData
}

PakEntry ...

func NewPakEntry added in v0.4.0

func NewPakEntry(data ByteData) *PakEntry

NewPakEntry ...

func (*PakEntry) String added in v0.4.0

func (p *PakEntry) String() string

String ...

func (*PakEntry) Valid added in v0.4.0

func (p *PakEntry) Valid() bool

Valid ...

type PeginTxOption

type PeginTxOption struct {
	// fee asset
	FeeAsset string
	// use blind tx
	IsBlindTx bool
	// effective feerate
	EffectiveFeeRate float64
	// longterm feerate
	LongTermFeeRate float64
	// dust feerate
	DustFeeRate float64
	// knapsack min change value. knapsack logic's threshold. Recommended value is 1.
	KnapsackMinChange int64
	// blind minimum range value
	MinimumRangeValue int64
	// blind exponent. default is 0.
	Exponent int64
	// blind minimum bits. default is -1 (cfd-go auto).
	MinimumBits int64
}

PeginTxOption ...

func NewPeginTxOption

func NewPeginTxOption() PeginTxOption

NewPeginTxOption ...

type PeginUtxoData

type PeginUtxoData struct {
	BitcoinTransaction string
	TxOutProof         string
	ClaimScript        string
}

type PegoutTxOption

type PegoutTxOption struct {
	// fee asset
	FeeAsset string
	// use blind tx
	IsBlindTx bool
	// effective feerate
	EffectiveFeeRate float64
	// longterm feerate
	LongTermFeeRate float64
	// dust feerate
	DustFeeRate float64
	// knapsack min change value. knapsack logic's threshold. Recommended value is 1.
	KnapsackMinChange int64
	// blind minimum range value
	MinimumRangeValue int64
	// blind exponent. default is 0.
	Exponent int64
	// blind minimum bits. default is -1 (cfd-go auto).
	MinimumBits int64
	// subtract fee by pegout amount.
	SubtractFee bool
}

PegoutTxOption ...

func NewPegoutTxOption

func NewPegoutTxOption() PegoutTxOption

NewPegoutTxOption ...

type Privkey

type Privkey struct {
	Hex                string
	Wif                string
	Network            NetworkType
	IsCompressedPubkey bool
}

Privkey ...

type Pubkey

type Pubkey struct {
	Hex string
}

Pubkey ...

type Script

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

Script This struct holds a script.

func NewScript

func NewScript(data []byte) Script

NewScript This function create a script from a byte array.

func NewScriptFromAsm

func NewScriptFromAsm(scriptAsm string) (Script, error)

NewScriptFromAsm This function create a script from an asm string.

func NewScriptFromAsmList

func NewScriptFromAsmList(scriptAsmList []string) (Script, error)

NewScriptFromAsmList This function create a script from the asm string list.

func NewScriptFromHex

func NewScriptFromHex(hexStr string) (Script, error)

NewScriptFromHex This function create a script from a hex string.

func NewScriptFromHexIgnoreError

func NewScriptFromHexIgnoreError(hexStr string) *Script

NewScriptFromHex This function create a script from a hex string. On error, it returns nil.

func (*Script) IsEmpty

func (obj *Script) IsEmpty() bool

IsEmpty This function return a empty or not.

func (*Script) Parse

func (obj *Script) Parse() (scriptItems []string, err error)

Parse This function return a parsing script.

func (*Script) ToHex

func (obj *Script) ToHex() string

ToHex This function return a hex string.

func (*Script) ToSlice

func (obj *Script) ToSlice() []byte

ToHex This function return a byte array.

type ScriptWitness

type ScriptWitness struct {
	// witness stack by hex.
	Stack []string
}

ScriptWitness : witness stack.

type SigHashType

type SigHashType struct {
	Type         int
	AnyoneCanPay bool
	Rangeproof   bool
}

SigHashType This struct use for the sighashtype utility function.

var (
	// SigHashType: default (for taproot)
	SigHashTypeDefault SigHashType = *NewSigHashType(0)
	// SigHashType: all
	SigHashTypeAll SigHashType = *NewSigHashType(1)
	// SigHashType: none
	SigHashTypeNone SigHashType = *NewSigHashType(2)
	// SigHashType: single
	SigHashTypeSingle SigHashType = *NewSigHashType(3)
)

func NewSigHashType

func NewSigHashType(sighashType int) *SigHashType

NewSigHashType This function return a SigHashType.

func NewSigHashTypeFromString added in v0.4.0

func NewSigHashTypeFromString(sighashType string) *SigHashType

NewSigHashTypeFromString return a SigHashType.

func (*SigHashType) GetValue

func (obj *SigHashType) GetValue() int

ToHex This function return a sighashtype byte value.

func (*SigHashType) String added in v0.3.12

func (obj *SigHashType) String() string

String ...

func (*SigHashType) ToCfdValue added in v0.4.0

func (obj *SigHashType) ToCfdValue() *cfdgo.SigHashType

type SignParameter added in v0.3.11

type SignParameter struct {
	Data          Script
	IsDerEncode   bool
	SigHashType   SigHashType
	RelatedPubkey *Pubkey
}

func NewSignParameterFromString added in v0.3.13

func NewSignParameterFromString(derSignature, relatedPubkey string) *SignParameter

type Transaction

type Transaction struct {
	Hex string
}

Transaction ...

type TransactionData

type TransactionData struct {
	// txid
	Txid string
	// witness txid
	Wtxid string
	// witness hash
	WitHash string
	// size
	Size uint32
	// virtual size
	Vsize uint32
	// weight
	Weight uint32
	// version
	Version uint32
	// locktime
	LockTime uint32
}

*

  • TransactionData data struct.

type TxIn

type TxIn struct {
	// utxo outpoint.
	OutPoint OutPoint
	// sequence number.
	Sequence uint32
	// script sig.
	ScriptSig string
	// witness stack.
	WitnessStack ScriptWitness
}

TxIn : transaction input.

type TxOut

type TxOut struct {
	// satoshi amount.
	Amount int64
	// locking script.
	LockingScript string
	// address (if locking script is usual hashtype.)
	Address string
}

TxOut : transaction output.

type UnblindData added in v0.3.16

type UnblindData struct {
	Asset            string // Asset
	AssetBlindFactor string // Asset BlindFactor
	Amount           int64  // satoshi value
	ValueBlindFactor string // Value BlindFactor
}

type UtxoData

type UtxoData struct {
	OutPoint          OutPoint // OutPoint
	Amount            int64    // satoshi value
	Descriptor        string   // output descriptor
	ScriptSigTemplate string   // scriptsig template hex (require script hash estimate fee)
	Asset             string   // Asset
	AmountCommitment  string   // Amount commitment
}

func (UtxoData) ConvertToCfdUtxo added in v0.3.9

func (u UtxoData) ConvertToCfdUtxo() cfd.CfdUtxo

Jump to

Keyboard shortcuts

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