btc

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BIP39MnemonicEnvName   = "SEED_MNEMONIC"
	BIP39PassphraseEnvName = "SEED_PASSPHRASE"
)
View Source
const (
	FormatCli          = "bitcoin-cli"
	FormatCliWatchOnly = "bitcoin-cli-watchonly"
	FormatImportwallet = "bitcoin-importwallet"
	FormatDescriptors  = "bitcoin-descriptors"
	FormatElectrum     = "electrum"

	PasteString = "# Paste the following lines into a command line window."
)

Variables

View Source
var (
	ErrTxNotFound = errors.New("transaction not found")
)

Functions

func DescriptorSumCheck

func DescriptorSumCheck(s string, require bool) bool

func DescriptorSumCreate

func DescriptorSumCreate(s string) string

func ExportKeys

func ExportKeys(extendedKey *hdkeychain.ExtendedKey, strPaths []string,
	paths [][]uint32, params *chaincfg.Params, recoveryWindow,
	rescanFrom uint32, exporter KeyExporter, writer io.Writer) error

func ReadMnemonicFromTerminal

func ReadMnemonicFromTerminal(params *chaincfg.Params) (*hdkeychain.ExtendedKey,
	error)

func SeedBirthdayToBlock

func SeedBirthdayToBlock(params *chaincfg.Params,
	birthdayTimestamp time.Time) uint32

func SummarizeChannels

func SummarizeChannels(api *ExplorerAPI, channels []*dataformat.SummaryEntry,
	log btclog.Logger) (*dataformat.SummaryEntryFile, error)

Types

type AddressStats

type AddressStats struct {
	Address      string `json:"address"`
	ChainStats   *Stats `json:"chain_stats"`
	MempoolStats *Stats `json:"mempool_stats"`
}

type Cli

type Cli struct{}

func (*Cli) Format

func (c *Cli) Format(hdKey *hdkeychain.ExtendedKey, params *chaincfg.Params,
	path string, branch, index uint32) (string, error)

func (*Cli) Header

func (c *Cli) Header() string

func (*Cli) Trailer

func (c *Cli) Trailer(birthdayBlock uint32) string

type CliWatchOnly

type CliWatchOnly struct{}

func (*CliWatchOnly) Format

func (c *CliWatchOnly) Format(hdKey *hdkeychain.ExtendedKey,
	params *chaincfg.Params, path string, branch, index uint32) (string,
	error)

func (*CliWatchOnly) Header

func (c *CliWatchOnly) Header() string

func (*CliWatchOnly) Trailer

func (c *CliWatchOnly) Trailer(birthdayBlock uint32) string

type Descriptors

type Descriptors struct{}

func (*Descriptors) Format

func (d *Descriptors) Format(hdKey *hdkeychain.ExtendedKey,
	params *chaincfg.Params, path string, branch, index uint32) (string,
	error)

func (*Descriptors) Header

func (d *Descriptors) Header() string

func (*Descriptors) Trailer

func (d *Descriptors) Trailer(birthdayBlock uint32) string

type Electrum

type Electrum struct{}

func (*Electrum) Format

func (p *Electrum) Format(hdKey *hdkeychain.ExtendedKey,
	params *chaincfg.Params, path string, branch, index uint32) (string,
	error)

func (*Electrum) Header

func (p *Electrum) Header() string

func (*Electrum) Trailer

func (p *Electrum) Trailer(_ uint32) string

type ExplorerAPI

type ExplorerAPI struct {
	BaseURL string
}

func (*ExplorerAPI) Address

func (a *ExplorerAPI) Address(outpoint string) (string, error)

func (*ExplorerAPI) Outpoint

func (a *ExplorerAPI) Outpoint(addr string) (*TX, int, error)

func (*ExplorerAPI) PublishTx

func (a *ExplorerAPI) PublishTx(rawTxHex string) (string, error)

func (*ExplorerAPI) Spends

func (a *ExplorerAPI) Spends(addr string) ([]*TX, error)

func (*ExplorerAPI) Transaction

func (a *ExplorerAPI) Transaction(txid string) (*TX, error)

func (*ExplorerAPI) Unspent

func (a *ExplorerAPI) Unspent(addr string) ([]*Vout, error)

type ImportWallet

type ImportWallet struct{}

func (*ImportWallet) Format

func (i *ImportWallet) Format(hdKey *hdkeychain.ExtendedKey,
	params *chaincfg.Params, path string, branch, index uint32) (string,
	error)

func (*ImportWallet) Header

func (i *ImportWallet) Header() string

func (*ImportWallet) Trailer

func (i *ImportWallet) Trailer(_ uint32) string

type KeyExporter

type KeyExporter interface {
	Header() string
	Format(*hdkeychain.ExtendedKey, *chaincfg.Params, string, uint32,
		uint32) (string, error)
	Trailer(uint32) string
}

func ParseFormat

func ParseFormat(format string) (KeyExporter, error)

ParseFormat parses the given format name and returns its associated print function.

type Outspend

type Outspend struct {
	Spent  bool    `json:"spent"`
	Txid   string  `json:"txid"`
	Vin    int     `json:"vin"`
	Status *Status `json:"status"`
}

type Stats

type Stats struct {
	FundedTXOCount uint32 `json:"funded_txo_count"`
	FundedTXOSum   uint64 `json:"funded_txo_sum"`
	SpentTXOCount  uint32 `json:"spent_txo_count"`
	SpentTXOSum    uint64 `json:"spent_txo_sum"`
	TXCount        uint32 `json:"tx_count"`
}

type Status

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

type TX

type TX struct {
	TXID string  `json:"txid"`
	Vin  []*Vin  `json:"vin"`
	Vout []*Vout `json:"vout"`
}

type Vin

type Vin struct {
	Tixid    string `json:"txid"`
	Vout     int    `json:"vout"`
	Prevout  *Vout  `json:"prevout"`
	Sequence uint32 `json:"sequence"`
}

type Vout

type Vout struct {
	ScriptPubkey     string `json:"scriptpubkey"`
	ScriptPubkeyAsm  string `json:"scriptpubkey_asm"`
	ScriptPubkeyType string `json:"scriptpubkey_type"`
	ScriptPubkeyAddr string `json:"scriptpubkey_address"`
	Value            uint64 `json:"value"`
	Outspend         *Outspend
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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