算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
bitcoin-fee-estimation【设计与创意】Fee estimation strategies: local mempool-based (estimatesmartfee), external APIs (mempool.space, BlockCypher), bitcoind's smart-fee algorithm, replacement bidding, fee-rate floor (incremental relay). USE WHEN: choosing a fee for a new tx, evaluating fee-bump amounts, designing fee policy for a service.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Bitcoin tx fees are auctioned per-block. Wallets need to estimate the
fee rate (sat/vB) needed to confirm within n blocks.
estimatesmartfeebitcoin-cli estimatesmartfee 6 ECONOMICAL
Returns {"feerate": 0.00010000, "blocks": 6} (BTC/kvB → 10 sat/vB).
n blocks.n: find lowest fee rate that successfully confirmed
≥ X% of historical txs within n blocks.Modes: ECONOMICAL (less aggressive), CONSERVATIVE (more buffer).
Limitations:
Sample getrawmempool true:
mempool = bitcoind.getrawmempool(verbose=True)
# build histogram of (fee_rate, vsize)
# find fee rate where cumulative vsize from top fits in 1 MB block
target_rate_for_next_block = histogram.percentile(at_vsize=1_000_000)
This reflects current mempool state, not historical. Better during fee spikes; volatile during quiet periods.
GET /api/v1/fees/recommended →
{ fastestFee, halfHourFee, hourFee, economyFee, minimumFee }./api/v1/fees/mempool-blocks
shows projected next ~10 blocks with median fee rate per block.External APIs offer real-time mempool view; trade-off is trust and availability.
incrementalrelayfee = 1 sat/vB (default)
Min fee rate for a tx to be relayed. RBF replacement must add at least this much per added vbyte beyond the original.
fee_rate = max(local_estimate(target=N),
external_api(target=N))
broadcast(tx, fee_rate)
sleep(check_interval)
if not confirmed:
new_rate = max(current_market_rate * bump_factor,
fee_rate + incrementalrelayfee + buffer)
rbf_replace(tx, new_rate)
bump_factor typically 1.5x for proactive bumps.
Pre-signed commitment tx has fixed fee at signing time. To bump:
Bitcoin Core evicts tx with lowest fee when mempool is full
(maxmempool=300MB default). If your tx is evicted:
estimatesmartfee 1 (next-block) on a fresh node → returns
-1 (insufficient history) → tx with no fee.testmempoolaccept first.