types

package
v0.0.0-...-32c8a8c Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetParams

func GetParams(net Network) *chaincfg.Params

func NewOldAddr

func NewOldAddr(version []byte, data []byte) string

func NewZECAddr

func NewZECAddr(pubBytes []byte) string

func ParseScriptType

func ParseScriptType(script []byte) txscript.ScriptClass

func PubKeyToAddr

func PubKeyToAddr(publicKey []byte, addrType AddrType, net Network) (address btcutil.Address, err error)

func ScriptToAddr

func ScriptToAddr(script []byte, addrType AddrType, net Network) (address btcutil.Address, err error)

Types

type AddrType

type AddrType string
const (
	P2PKH         AddrType = "p2pkh"         // non segwit
	P2WPKH        AddrType = "p2wpkh"        // native segwit
	P2WPKH_NESTED AddrType = "p2wpkh-nested" // nested segwit

	P2SH         AddrType = "p2sh"         // non segwit
	P2WSH        AddrType = "p2wsh"        // native segwit
	P2WSH_NESTED AddrType = "p2wsh-nested" // nested segwit

	TAPROOT AddrType = "taproot" // taproot
)

type Block

type Block struct {
	ID                string  `json:"id"`
	Height            uint64  `json:"height"`
	Version           int     `json:"version"`
	Timestamp         int     `json:"timestamp"`
	TxCount           int     `json:"tx_count"`
	Size              int     `json:"size"`
	Weight            int     `json:"weight"`
	MerkleRoot        string  `json:"merkle_root"`
	Previousblockhash string  `json:"previousblockhash"`
	Mediantime        int     `json:"mediantime"`
	Nonce             int     `json:"nonce"`
	Bits              int     `json:"bits"`
	Difficulty        float64 `json:"difficulty"`
}

type BlockStatus

type BlockStatus struct {
	Confirmed   bool   `json:"confirmed"`
	BlockHeight int    `json:"block_height"`
	BlockHash   string `json:"block_hash"`
	BlockTime   int    `json:"block_time"`
}

type FeeEstimate

type FeeEstimate map[string]float64

type Network

type Network string
const (
	BTC               Network = "btc"
	BTC_Testnet3      Network = "btc-testnet3"
	BTC_Regressionnet Network = "btc-regtest"
	BTC_Signet        Network = "btc-signet"

	DGB  Network = "dgb"  // digibyte
	QTUM Network = "qtum" // qtum
	RVN  Network = "rvn"  // raven
	BTG  Network = "btg"  // bitcoin gold
	BCH  Network = "bch"  // bitcoin cash
	DOGE Network = "doge" // dogecoin
)

type Transaction

type Transaction struct {
	Txid     string      `json:"txid"`
	Version  int         `json:"version"`
	Locktime int         `json:"locktime"`
	Vin      []Vin       `json:"vin"`
	Vout     []Vout      `json:"vout"`
	Size     int         `json:"size"`
	Weight   int         `json:"weight"`
	Fee      int         `json:"fee"`
	Status   BlockStatus `json:"status"`
}

type TransactionType

type TransactionType string
const (
	Transfer TransactionType = "transfer"
	Multisig TransactionType = "multisig"
	Timelock TransactionType = "timelock"

	Ordinals TransactionType = "ordinals"
)

type Utxo

type Utxo struct {
	Txid   string      `json:"txid"`
	Vout   uint32      `json:"vout"`
	Status BlockStatus `json:"status"`
	Value  int64       `json:"value"`
}

type Vin

type Vin struct {
	Txid         string   `json:"txid"`
	Vout         uint32   `json:"vout"`
	Prevout      any      `json:"prevout"`
	Scriptsig    string   `json:"scriptsig"`
	ScriptsigAsm string   `json:"scriptsig_asm"`
	Witness      []string `json:"witness"`
	IsCoinbase   bool     `json:"is_coinbase"`
	Sequence     int64    `json:"sequence"`

	// calculated fields
	Amount  btcutil.Amount `json:"-"`
	Address string         `json:"-"`
}

type Vout

type Vout struct {
	Scriptpubkey        string `json:"scriptpubkey"`
	ScriptpubkeyAsm     string `json:"scriptpubkey_asm"`
	ScriptpubkeyType    string `json:"scriptpubkey_type"`
	ScriptpubkeyAddress string `json:"scriptpubkey_address,omitempty"`
	Value               int64  `json:"value"`

	// calculated fields
	Amount    btcutil.Amount `json:"-"`
	Address   string         `json:"-"`
	PublicKey string         `json:"-"`
}

Jump to

Keyboard shortcuts

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