當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


Bitcoin bumpfee用法及代碼示例


比特幣(Bitcoin) RPC Wallet API中bumpfee的用法及代碼示例。

用法:

bumpfee "txid" ( options )

取消opt-in-RBF事務T的費用,將其替換為新事務B。

具有給定txid的opt-in RBF事務必須在錢包中。

該命令將通過減少(或刪除)其更改輸出來支付額外的費用。

如果更改輸出的大小不足以支付增加的費用,則該命令當前將失敗,而不是添加新的輸入來進行補償。 (將來的實現可能會改善此情況。)如果錢包或內存池包含花費T的輸出之一的交易,則該命令將失敗。

默認情況下,新費用將使用Estimatesmartfee自動計算。

用戶可以為估算費用指定確認目標。

或者,用戶可以指定totalFee,或使用RPC settxfee設置較高的費用率。

至少,新費用率必須足夠高才能支付額外的新中繼費用(getnetworkinfo返回的增量費)以進入節點的內存池。

參數1 - txid

類型:字符串,必填

txid被撞

參數2 - options

類型:json對象,可選

{
  "confTarget": n,           (numeric, optional, default=fallback to wallet's default) Confirmation target (in blocks)
  "totalFee": n,             (numeric, optional, default=fallback to 'confTarget') Total fee (NOT feerate) to pay, in satoshis.
                             In rare cases, the actual fee paid might be slightly higher than the specified
                             totalFee if the tx change output has to be removed because it is too close to
                             the dust threshold.
  "replaceable": bool,       (boolean, optional, default=true) Whether the new transaction should still be
                             marked bip-125 replaceable. If true, the sequence numbers in the transaction will
                             be left unchanged from the original. If false, any input sequence numbers in the
                             original transaction that were less than 0xfffffffe will be increased to 0xfffffffe
                             so the new transaction will not be explicitly bip-125 replaceable (though it may
                             still be replaceable in practice, for example if it has unconfirmed ancestors which
                             are replaceable).
  "estimate_mode": "str",    (string, optional, default=UNSET) The fee estimate mode, must be one of:
                             "UNSET"
                             "ECONOMICAL"
                             "CONSERVATIVE"
}

返回結果

{
  "txid":    "value",   (string)  The id of the new transaction
  "origfee":  n,         (numeric) Fee of the replaced transaction
  "fee":      n,         (numeric) Fee of the new transaction
  "errors":  [ str... ] (json array of strings) Errors encountered during processing (may be empty)
}

示例

收取費用,獲取新交易的txid:

bitcoin-cli bumpfee <txid>

相關用法


注:本文由純淨天空篩選整理自bitcoin.org大神的英文原創作品 Bitcoin bumpfee。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。