Documentation
¶
Index ¶
- Constants
- Variables
- type Block
- type Client
- func (c *Client) FetchBlockHistory(ctx context.Context, tip int64, pages int) ([]Block, error)
- func (c *Client) FetchMining(ctx context.Context) (MiningStats, error)
- func (c *Client) FetchOverview(ctx context.Context) (Overview, error)
- func (c *Client) FetchTransaction(ctx context.Context, txid string) (TransactionInspection, error)
- func (c *Client) StreamStats(ctx context.Context) <-chan LiveStats
- type DifficultyAdjustment
- type DifficultyPoint
- type Fees
- type HashratePoint
- type HashrateStats
- type LiveStats
- type Mempool
- type MiningPool
- type MiningStats
- type Outspend
- type Overview
- type PoolStats
- type Prices
- type ProjectedBlock
- type RewardStats
- type Transaction
- type TransactionDetail
- type TransactionInput
- type TransactionInspection
- type TransactionOutput
- type TransactionStatus
Constants ¶
const DefaultBaseURL = "https://mempool.space/api"
Variables ¶
var UserAgent = "ompool"
UserAgent identifies ompool to the API. main sets it to include the version.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct {
ID string `json:"id"`
Height int64 `json:"height"`
Timestamp int64 `json:"timestamp"`
TxCount int `json:"tx_count"`
Size int64 `json:"size"`
Weight int64 `json:"weight"`
Extras struct {
Reward int64 `json:"reward"`
MedianFee float64 `json:"medianFee"`
FeeRange []float64 `json:"feeRange"`
TotalFees int64 `json:"totalFees"`
AvgFee int64 `json:"avgFee"`
AvgFeeRate float64 `json:"avgFeeRate"`
AvgTxSize float64 `json:"avgTxSize"`
SegwitTotalTx int `json:"segwitTotalTxs"`
MatchRate float64 `json:"matchRate"`
Pool struct {
Name string `json:"name"`
Slug string `json:"slug"`
} `json:"pool"`
} `json:"extras"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) FetchBlockHistory ¶
FetchBlockHistory requests older v1 block pages concurrently. The caller supplies the current tip, allowing deterministic non-overlapping 15-block windows without a serial pagination waterfall.
func (*Client) FetchMining ¶
func (c *Client) FetchMining(ctx context.Context) (MiningStats, error)
FetchMining loads slower-moving mining analytics independently from the core snapshot so screens that do not display them avoid the extra requests.
func (*Client) FetchOverview ¶
func (*Client) FetchTransaction ¶
FetchTransaction loads the decoded transaction, its raw serialization, and output-spend state concurrently so the viewer can describe both sides of the UTXO exchange without serial request latency.
type DifficultyAdjustment ¶
type DifficultyAdjustment struct {
ProgressPercent float64 `json:"progressPercent"`
DifficultyChange float64 `json:"difficultyChange"`
EstimatedRetargetDate int64 `json:"estimatedRetargetDate"`
RemainingBlocks int `json:"remainingBlocks"`
RemainingTime int64 `json:"remainingTime"`
NextRetargetHeight int64 `json:"nextRetargetHeight"`
}
type DifficultyPoint ¶
type HashratePoint ¶
type HashrateStats ¶
type HashrateStats struct {
Hashrates []HashratePoint `json:"hashrates"`
Difficulty []DifficultyPoint `json:"difficulty"`
CurrentHashrate float64 `json:"currentHashrate"`
CurrentDifficulty float64 `json:"currentDifficulty"`
}
type LiveStats ¶
type LiveStats struct {
VBytesPerSecond float64 `json:"vBytesPerSecond"`
HasFlow bool
Transactions []Transaction `json:"transactions"`
}
type MiningPool ¶
type MiningStats ¶
type MiningStats struct {
Hashrate HashrateStats
Pools PoolStats
Rewards RewardStats
}
type Outspend ¶
type Outspend struct {
Spent bool `json:"spent"`
TxID string `json:"txid"`
Vin int `json:"vin"`
Status TransactionStatus `json:"status"`
}
type Overview ¶
type Overview struct {
Fees Fees
Mempool Mempool
Blocks []Block
ProjectedBlocks []ProjectedBlock
Difficulty DifficultyAdjustment
Recent []Transaction
Prices Prices
Mining MiningStats
Fetched time.Time
}
type PoolStats ¶
type PoolStats struct {
Pools []MiningPool `json:"pools"`
BlockCount int `json:"blockCount"`
LastEstimatedHashrate float64 `json:"lastEstimatedHashrate"`
}
type ProjectedBlock ¶
type RewardStats ¶
type Transaction ¶
type TransactionDetail ¶
type TransactionDetail struct {
TxID string `json:"txid"`
Version int `json:"version"`
Locktime uint32 `json:"locktime"`
Size int64 `json:"size"`
Weight int64 `json:"weight"`
Fee int64 `json:"fee"`
Vin []TransactionInput `json:"vin"`
Vout []TransactionOutput `json:"vout"`
Status TransactionStatus `json:"status"`
}
TransactionDetail is the full transaction shape returned by the explorer endpoint. Prevout carries the UTXO consumed by an input; Vout contains the newly-created transaction outputs.
type TransactionInput ¶
type TransactionInput struct {
TxID string `json:"txid"`
Vout uint32 `json:"vout"`
Prevout *TransactionOutput `json:"prevout"`
ScriptSig string `json:"scriptsig"`
ScriptSigAsm string `json:"scriptsig_asm"`
Witness []string `json:"witness"`
IsCoinbase bool `json:"is_coinbase"`
Sequence uint32 `json:"sequence"`
}
type TransactionInspection ¶
type TransactionInspection struct {
Transaction TransactionDetail
RawHex string
Outspends []Outspend
}