Bitcoin
Bereit, das in der Produktion aufzurufen?
Das Free-Tier deckt persönliche Projekte ab. Pay-as-you-go skaliert ohne Karte.
Bitcoin
Das Free-Tier deckt persönliche Projekte ab. Pay-as-you-go skaliert ohne Karte.
On Bitcoin you bid for block space, and miners fill the roughly ten-minute proof-of-work block with the transactions paying the most per byte. Estimate too low and your transaction lingers in the mempool for hours or stalls until you fee-bump it; estimate too high and you simply burn BTC that could have stayed with the recipient or as change. Good fee estimation finds the smallest fee that still clears within your target window. This guide is for wallet, exchange, and payment developers who construct transactions over the TheRPC endpoint at https://bitcoin.therpc.io/YOUR_API_KEY. It covers what estimatesmartfee returns, how to read the mempool floor as a fallback, how to convert fee-rate units correctly, and how to expose fast/normal/slow tiers to users.
fee parameter — the fee is whatever you leave behind, the difference between the total BTC in the inputs and the total BTC in the outputs. Miners claim that remainder, so under-funding the outputs by too much overpays and over-funding leaves nothing for the miner.estimatesmartfee returns a feerate in BTC/kvB for a given confirmation target measured in blocks. Ask for confirmation within 1 block for urgency or 24 blocks to save money; the node bases the figure on recent block inclusion.getmempoolinfo exposes mempoolminfee: any transaction below it will not even relay across the network. Use it as a fallback when estimatesmartfee has too little data to answer, so you never broadcast a transaction that peers silently drop.estimatesmartfee returns an errors array and no feerate. Never read feerate blindly — check it exists, and fall back to the mempoolminfee floor from getmempoolinfo as the example does, so estimation never crashes during quiet periods.feerate by 1e5. Because BTC values arrive as floating-point, round with Math.ceil after the multiply rather than truncating, and keep all internal math in integer satoshis to avoid rounding drift.conf_target calls. Calling with targets like 1, 6, and 24 blocks gives natural fast/normal/slow options. Let users trade urgency for cost instead of forcing one fixed rate.mempoolminfee and recent block fee percentiles (via getblockstats) and add a margin above the estimate so your transaction clears the rising floor instead of falling just under it.