bitcoin

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InputSelector_name = map[int32]string{
		0: "SELECT_IN_ORDER",
		1: "SELECT_ASCENDING",
		2: "SELECT_DESCENDING",
		3: "USE_ALL",
	}
	InputSelector_value = map[string]int32{
		"SELECT_IN_ORDER":   0,
		"SELECT_ASCENDING":  1,
		"SELECT_DESCENDING": 2,
		"USE_ALL":           3,
	}
)

Enum value maps for InputSelector.

View Source
var File_txproto_bitcoin_bitcoin_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type InputSelector added in v0.12.3

type InputSelector int32

InputSelector controls the order in which UTXOs are considered for coin selection. The default (SELECT_IN_ORDER) preserves the order supplied by the caller, matching the historical behaviour.

const (
	InputSelector_SELECT_IN_ORDER   InputSelector = 0 // preserve caller-supplied order (default)
	InputSelector_SELECT_ASCENDING  InputSelector = 1 // sort UTXOs by amount ascending  (smallest first)
	InputSelector_SELECT_DESCENDING InputSelector = 2 // sort UTXOs by amount descending (largest first)
	InputSelector_USE_ALL           InputSelector = 3 // include every UTXO; still produces a change output
)

func (InputSelector) Descriptor added in v0.12.3

func (InputSelector) Enum added in v0.12.3

func (x InputSelector) Enum() *InputSelector

func (InputSelector) EnumDescriptor deprecated added in v0.12.3

func (InputSelector) EnumDescriptor() ([]byte, []int)

Deprecated: Use InputSelector.Descriptor instead.

func (InputSelector) Number added in v0.12.3

func (InputSelector) String added in v0.12.3

func (x InputSelector) String() string

func (InputSelector) Type added in v0.12.3

type OutputAddress added in v0.12.3

type OutputAddress struct {
	ToAddress string `protobuf:"bytes,1,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty"` // recipient address (any standard script type)
	Amount    int64  `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`                       // value in satoshis; must be > 0
	// contains filtered or unexported fields
}

An additional recipient output beyond the primary to_address.

func (*OutputAddress) Descriptor deprecated added in v0.12.3

func (*OutputAddress) Descriptor() ([]byte, []int)

Deprecated: Use OutputAddress.ProtoReflect.Descriptor instead.

func (*OutputAddress) GetAmount added in v0.12.3

func (x *OutputAddress) GetAmount() int64

func (*OutputAddress) GetToAddress added in v0.12.3

func (x *OutputAddress) GetToAddress() string

func (*OutputAddress) ProtoMessage added in v0.12.3

func (*OutputAddress) ProtoMessage()

func (*OutputAddress) ProtoReflect added in v0.12.3

func (x *OutputAddress) ProtoReflect() protoreflect.Message

func (*OutputAddress) Reset added in v0.12.3

func (x *OutputAddress) Reset()

func (*OutputAddress) String added in v0.12.3

func (x *OutputAddress) String() string

type SigningInput

type SigningInput struct {

	// SIGHASH type (default 0x01 = SIGHASH_ALL).
	HashType uint32 `protobuf:"varint,1,opt,name=hash_type,json=hashType,proto3" json:"hash_type,omitempty"`
	// Total amount to send to to_address, in satoshis.
	Amount int64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
	// Fee per byte, in satoshis (used by the simple coin-selection plan).
	ByteFee int64 `protobuf:"varint,3,opt,name=byte_fee,json=byteFee,proto3" json:"byte_fee,omitempty"`
	// Recipient address (bech32 P2WPKH).
	ToAddress string `protobuf:"bytes,4,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty"`
	// Change address (bech32 P2WPKH); receives the remainder.
	ChangeAddress string `protobuf:"bytes,5,opt,name=change_address,json=changeAddress,proto3" json:"change_address,omitempty"`
	// Available UTXOs.
	Utxo []*UnspentTransaction `protobuf:"bytes,6,rep,name=utxo,proto3" json:"utxo,omitempty"`
	// Locktime (default 0).
	LockTime uint32 `protobuf:"varint,7,opt,name=lock_time,json=lockTime,proto3" json:"lock_time,omitempty"`
	// If set, send everything (minus fee) to to_address; no change output.
	UseMaxAmount bool `protobuf:"varint,8,opt,name=use_max_amount,json=useMaxAmount,proto3" json:"use_max_amount,omitempty"`
	// Optional zero-amount OP_RETURN data payload (<= 80 bytes; standardness limit).
	OutputOpReturn []byte `protobuf:"bytes,9,opt,name=output_op_return,json=outputOpReturn,proto3" json:"output_op_return,omitempty"`
	// Additional recipients beyond to_address; each amount must be > 0.
	// Cannot be combined with use_max_amount.
	ExtraOutputs []*OutputAddress `protobuf:"bytes,10,rep,name=extra_outputs,json=extraOutputs,proto3" json:"extra_outputs,omitempty"`
	// UTXO selection strategy (default SELECT_IN_ORDER).
	InputSelector InputSelector `` /* 144-byte string literal not displayed */
	// If true, always emit the change output even when its value is below the
	// dust threshold (by default sub-threshold change is folded into the fee).
	DisableDustFilter bool `protobuf:"varint,12,opt,name=disable_dust_filter,json=disableDustFilter,proto3" json:"disable_dust_filter,omitempty"`
	// If > 0, overrides the built-in 546 sat dust threshold.
	FixedDustThreshold int64 `protobuf:"varint,13,opt,name=fixed_dust_threshold,json=fixedDustThreshold,proto3" json:"fixed_dust_threshold,omitempty"`
	// If true, include every available UTXO even when fewer would cover the
	// target amount; still produces a normal change output (unlike
	// use_max_amount which sends everything to the recipient).
	UseMaxUtxo bool `protobuf:"varint,14,opt,name=use_max_utxo,json=useMaxUtxo,proto3" json:"use_max_utxo,omitempty"`
	// contains filtered or unexported fields
}

SigningInput mirrors a minimal subset of TW.Bitcoin.Proto.SigningInput, restricted to P2WPKH (BIP-143) spending.

func (*SigningInput) Descriptor deprecated

func (*SigningInput) Descriptor() ([]byte, []int)

Deprecated: Use SigningInput.ProtoReflect.Descriptor instead.

func (*SigningInput) GetAmount

func (x *SigningInput) GetAmount() int64

func (*SigningInput) GetByteFee

func (x *SigningInput) GetByteFee() int64

func (*SigningInput) GetChangeAddress

func (x *SigningInput) GetChangeAddress() string

func (*SigningInput) GetDisableDustFilter added in v0.12.3

func (x *SigningInput) GetDisableDustFilter() bool

func (*SigningInput) GetExtraOutputs added in v0.12.3

func (x *SigningInput) GetExtraOutputs() []*OutputAddress

func (*SigningInput) GetFixedDustThreshold added in v0.12.3

func (x *SigningInput) GetFixedDustThreshold() int64

func (*SigningInput) GetHashType

func (x *SigningInput) GetHashType() uint32

func (*SigningInput) GetInputSelector added in v0.12.3

func (x *SigningInput) GetInputSelector() InputSelector

func (*SigningInput) GetLockTime

func (x *SigningInput) GetLockTime() uint32

func (*SigningInput) GetOutputOpReturn added in v0.12.3

func (x *SigningInput) GetOutputOpReturn() []byte

func (*SigningInput) GetToAddress

func (x *SigningInput) GetToAddress() string

func (*SigningInput) GetUseMaxAmount

func (x *SigningInput) GetUseMaxAmount() bool

func (*SigningInput) GetUseMaxUtxo added in v0.12.3

func (x *SigningInput) GetUseMaxUtxo() bool

func (*SigningInput) GetUtxo

func (x *SigningInput) GetUtxo() []*UnspentTransaction

func (*SigningInput) ProtoMessage

func (*SigningInput) ProtoMessage()

func (*SigningInput) ProtoReflect

func (x *SigningInput) ProtoReflect() protoreflect.Message

func (*SigningInput) Reset

func (x *SigningInput) Reset()

func (*SigningInput) String

func (x *SigningInput) String() string

type SigningOutput

type SigningOutput struct {

	// Fully signed raw transaction (wire format with witnesses).
	Encoded []byte `protobuf:"bytes,1,opt,name=encoded,proto3" json:"encoded,omitempty"`
	// Transaction id (double-SHA256 of the non-witness serialization), display
	// (big-endian) byte order.
	TransactionId []byte `protobuf:"bytes,2,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"`
	// Hex of `encoded`.
	EncodedHex string `protobuf:"bytes,3,opt,name=encoded_hex,json=encodedHex,proto3" json:"encoded_hex,omitempty"`
	// The fee paid, in satoshis.
	Fee int64 `protobuf:"varint,4,opt,name=fee,proto3" json:"fee,omitempty"`
	// The UTXOs that were selected and spent.
	UsedUtxo []*UsedUTXO `protobuf:"bytes,5,rep,name=used_utxo,json=usedUtxo,proto3" json:"used_utxo,omitempty"`
	// Error message, empty on success.
	Error string `protobuf:"bytes,6,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

SigningOutput mirrors a minimal subset of TW.Bitcoin.Proto.SigningOutput.

func (*SigningOutput) Descriptor deprecated

func (*SigningOutput) Descriptor() ([]byte, []int)

Deprecated: Use SigningOutput.ProtoReflect.Descriptor instead.

func (*SigningOutput) GetEncoded

func (x *SigningOutput) GetEncoded() []byte

func (*SigningOutput) GetEncodedHex

func (x *SigningOutput) GetEncodedHex() string

func (*SigningOutput) GetError

func (x *SigningOutput) GetError() string

func (*SigningOutput) GetFee

func (x *SigningOutput) GetFee() int64

func (*SigningOutput) GetTransactionId

func (x *SigningOutput) GetTransactionId() []byte

func (*SigningOutput) GetUsedUtxo

func (x *SigningOutput) GetUsedUtxo() []*UsedUTXO

func (*SigningOutput) ProtoMessage

func (*SigningOutput) ProtoMessage()

func (*SigningOutput) ProtoReflect

func (x *SigningOutput) ProtoReflect() protoreflect.Message

func (*SigningOutput) Reset

func (x *SigningOutput) Reset()

func (*SigningOutput) String

func (x *SigningOutput) String() string

type UnspentTransaction

type UnspentTransaction struct {

	// Previous output point.
	OutPointHash     []byte `protobuf:"bytes,1,opt,name=out_point_hash,json=outPointHash,proto3" json:"out_point_hash,omitempty"`              // 32-byte txid, internal (little-endian) byte order
	OutPointIndex    uint32 `protobuf:"varint,2,opt,name=out_point_index,json=outPointIndex,proto3" json:"out_point_index,omitempty"`          // vout
	OutPointSequence uint32 `protobuf:"varint,3,opt,name=out_point_sequence,json=outPointSequence,proto3" json:"out_point_sequence,omitempty"` // nSequence (default 0xffffffff)
	// Value in satoshis.
	Amount int64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"`
	// scriptPubKey of the UTXO (P2WPKH: OP_0 <20-byte-hash>).
	Script []byte `protobuf:"bytes,5,opt,name=script,proto3" json:"script,omitempty"`
	// If set, derive this UTXO's signing key at this address index instead of
	// the tx-level index passed to SignTransaction. Allows a single transaction
	// to sweep UTXOs controlled by different derivation indices of the same
	// wallet (e.g. receive + change addresses).
	KeyIndex *uint32 `protobuf:"varint,6,opt,name=key_index,json=keyIndex,proto3,oneof" json:"key_index,omitempty"`
	// contains filtered or unexported fields
}

A single unspent transaction output available to spend.

func (*UnspentTransaction) Descriptor deprecated

func (*UnspentTransaction) Descriptor() ([]byte, []int)

Deprecated: Use UnspentTransaction.ProtoReflect.Descriptor instead.

func (*UnspentTransaction) GetAmount

func (x *UnspentTransaction) GetAmount() int64

func (*UnspentTransaction) GetKeyIndex added in v0.12.3

func (x *UnspentTransaction) GetKeyIndex() uint32

func (*UnspentTransaction) GetOutPointHash

func (x *UnspentTransaction) GetOutPointHash() []byte

func (*UnspentTransaction) GetOutPointIndex

func (x *UnspentTransaction) GetOutPointIndex() uint32

func (*UnspentTransaction) GetOutPointSequence

func (x *UnspentTransaction) GetOutPointSequence() uint32

func (*UnspentTransaction) GetScript

func (x *UnspentTransaction) GetScript() []byte

func (*UnspentTransaction) ProtoMessage

func (*UnspentTransaction) ProtoMessage()

func (*UnspentTransaction) ProtoReflect

func (x *UnspentTransaction) ProtoReflect() protoreflect.Message

func (*UnspentTransaction) Reset

func (x *UnspentTransaction) Reset()

func (*UnspentTransaction) String

func (x *UnspentTransaction) String() string

type UsedUTXO

type UsedUTXO struct {
	OutPointHash  []byte `protobuf:"bytes,1,opt,name=out_point_hash,json=outPointHash,proto3" json:"out_point_hash,omitempty"`
	OutPointIndex uint32 `protobuf:"varint,2,opt,name=out_point_index,json=outPointIndex,proto3" json:"out_point_index,omitempty"`
	Amount        int64  `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"`
	// contains filtered or unexported fields
}

One selected/used output point in the final transaction.

func (*UsedUTXO) Descriptor deprecated

func (*UsedUTXO) Descriptor() ([]byte, []int)

Deprecated: Use UsedUTXO.ProtoReflect.Descriptor instead.

func (*UsedUTXO) GetAmount

func (x *UsedUTXO) GetAmount() int64

func (*UsedUTXO) GetOutPointHash

func (x *UsedUTXO) GetOutPointHash() []byte

func (*UsedUTXO) GetOutPointIndex

func (x *UsedUTXO) GetOutPointIndex() uint32

func (*UsedUTXO) ProtoMessage

func (*UsedUTXO) ProtoMessage()

func (*UsedUTXO) ProtoReflect

func (x *UsedUTXO) ProtoReflect() protoreflect.Message

func (*UsedUTXO) Reset

func (x *UsedUTXO) Reset()

func (*UsedUTXO) String

func (x *UsedUTXO) String() string

Jump to

Keyboard shortcuts

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