Versions in this module Expand all Collapse all v1 v1.21.0 Feb 1, 2024 Changes in this version + const BlockHeaderByteLength + const HashByteLength + func AssembleSpvProof(transactionHash Hash, requiredConfirmations uint, btcChain Chain) (*Transaction, *SpvProof, error) + func ExtractPublicKeyHash(script Script) ([20]byte, error) + func PublicKeyHash(publicKey *ecdsa.PublicKey) [20]byte + func ScriptHash(script Script) [20]byte + func WitnessScriptHash(script Script) [32]byte + type BlockHeader struct + Bits uint32 + MerkleRootHash Hash + Nonce uint32 + PreviousBlockHeaderHash Hash + Time uint32 + Version int32 + func (bh *BlockHeader) Deserialize(rawBlockHeader [BlockHeaderByteLength]byte) + func (bh *BlockHeader) Difficulty() *big.Int + func (bh *BlockHeader) Hash() Hash + func (bh *BlockHeader) Serialize() [BlockHeaderByteLength]byte + func (bh *BlockHeader) Target() *big.Int + type ByteOrder int + const InternalByteOrder + const ReversedByteOrder + type Chain interface + BroadcastTransaction func(transaction *Transaction) error + EstimateSatPerVByteFee func(blocks uint32) (int64, error) + GetBlockHeader func(blockHeight uint) (*BlockHeader, error) + GetCoinbaseTxHash func(blockHeight uint) (Hash, error) + GetLatestBlockHeight func() (uint, error) + GetMempoolForPublicKeyHash func(publicKeyHash [20]byte) ([]*Transaction, error) + GetMempoolUtxosForPublicKeyHash func(publicKeyHash [20]byte) ([]*UnspentTransactionOutput, error) + GetTransaction func(transactionHash Hash) (*Transaction, error) + GetTransactionConfirmations func(transactionHash Hash) (uint, error) + GetTransactionMerkleProof func(transactionHash Hash, blockHeight uint) (*TransactionMerkleProof, error) + GetTransactionsForPublicKeyHash func(publicKeyHash [20]byte, limit int) ([]*Transaction, error) + GetTxHashesForPublicKeyHash func(publicKeyHash [20]byte) ([]Hash, error) + GetUtxosForPublicKeyHash func(publicKeyHash [20]byte) ([]*UnspentTransactionOutput, error) + type CompactSizeUint uint64 + type Hash [HashByteLength]byte + func ComputeHash(data []byte) Hash + func NewHash(hash []byte, byteOrder ByteOrder) (Hash, error) + func NewHashFromString(hash string, byteOrder ByteOrder) (Hash, error) + func (h Hash) Hex(byteOrder ByteOrder) string + func (h Hash) String() string + type Network int + const Mainnet + const Regtest + const Testnet + const Unknown + func (n Network) String() string + type Script []byte + func NewScriptFromVarLenData(varLenData []byte) (Script, error) + func PayToPublicKeyHash(publicKeyHash [20]byte) (Script, error) + func PayToScriptHash(scriptHash [20]byte) (Script, error) + func PayToWitnessPublicKeyHash(publicKeyHash [20]byte) (Script, error) + func PayToWitnessScriptHash(witnessScriptHash [32]byte) (Script, error) + func (s Script) ToVarLenData() ([]byte, error) + type ScriptType uint8 + const NonStandardScript + const P2PKHScript + const P2SHScript + const P2WPKHScript + const P2WSHScript + func GetScriptType(script Script) ScriptType + func (st ScriptType) String() string + type SignatureContainer struct + PublicKey *ecdsa.PublicKey + R *big.Int + S *big.Int + type SpvProof struct + BitcoinHeaders []byte + CoinbasePreimage [32]byte + CoinbaseProof []byte + MerkleProof []byte + TxIndexInBlock uint + type Transaction struct + Inputs []*TransactionInput + Locktime uint32 + Outputs []*TransactionOutput + Version int32 + func (t *Transaction) Deserialize(data []byte) error + func (t *Transaction) Hash() Hash + func (t *Transaction) Serialize(format ...TransactionSerializationFormat) []byte + func (t *Transaction) SerializeInputs() []byte + func (t *Transaction) SerializeLocktime() [4]byte + func (t *Transaction) SerializeOutputs() []byte + func (t *Transaction) SerializeVersion() [4]byte + func (t *Transaction) WitnessHash() Hash + type TransactionBuilder struct + func NewTransactionBuilder(chain Chain) *TransactionBuilder + func (tb *TransactionBuilder) AddOutput(output *TransactionOutput) + func (tb *TransactionBuilder) AddPublicKeyHashInput(utxo *UnspentTransactionOutput) error + func (tb *TransactionBuilder) AddScriptHashInput(utxo *UnspentTransactionOutput, redeemScript Script) error + func (tb *TransactionBuilder) AddSignatures(signatures []*SignatureContainer) (*Transaction, error) + func (tb *TransactionBuilder) ComputeSignatureHashes() ([]*big.Int, error) + func (tb *TransactionBuilder) TotalInputsValue() int64 + type TransactionFeeEstimator struct + func NewTransactionFeeEstimator(chain Chain) *TransactionFeeEstimator + func (tfe *TransactionFeeEstimator) EstimateFee(transactionVirtualSize int64, blocks ...uint32) (int64, error) + type TransactionInput struct + Outpoint *TransactionOutpoint + Sequence uint32 + SignatureScript []byte + Witness [][]byte + type TransactionMerkleProof struct + BlockHeight uint + MerkleNodes []string + Position uint + type TransactionOutpoint struct + OutputIndex uint32 + TransactionHash Hash + type TransactionOutput struct + PublicKeyScript Script + Value int64 + type TransactionSerializationFormat int + const Standard + const Witness + type TransactionSizeEstimator struct + func NewTransactionSizeEstimator() *TransactionSizeEstimator + func (tse *TransactionSizeEstimator) AddPublicKeyHashInputs(count int, isWitness bool) *TransactionSizeEstimator + func (tse *TransactionSizeEstimator) AddPublicKeyHashOutputs(count int, isWitness bool) *TransactionSizeEstimator + func (tse *TransactionSizeEstimator) AddScriptHashInputs(count int, redeemScriptLength int, isWitness bool) *TransactionSizeEstimator + func (tse *TransactionSizeEstimator) AddScriptHashOutputs(count int, isWitness bool) *TransactionSizeEstimator + func (tse *TransactionSizeEstimator) VirtualSize() (int64, error) + type UnspentTransactionOutput struct + Outpoint *TransactionOutpoint + Value int64