estimate-transaction-fee

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Estimate Transaction Fee

估算交易手续费

Estimate fees for BSV transactions based on size and fee rates.
基于交易大小和费率估算BSV交易的手续费。

When to Use

适用场景

  • Estimate fee before sending a transaction
  • Calculate size of a transaction
  • Understand fee structure
  • 发送交易前估算手续费
  • 计算交易大小
  • 了解手续费结构

Usage

使用方法

bash
undefined
bash
undefined

Estimate by size

按大小估算

bun run skills/estimate-transaction-fee/scripts/estimate.ts --size 226
bun run skills/estimate-transaction-fee/scripts/estimate.ts --size 226

Estimate from raw tx hex

根据原始交易十六进制估算

bun run skills/estimate-transaction-fee/scripts/estimate.ts --tx <hex>
bun run skills/estimate-transaction-fee/scripts/estimate.ts --tx <hex>

Estimate by inputs/outputs

按输入/输出数量估算

bun run skills/estimate-transaction-fee/scripts/estimate.ts --inputs 2 --outputs 3
bun run skills/estimate-transaction-fee/scripts/estimate.ts --inputs 2 --outputs 3

Custom fee rate

自定义费率

bun run skills/estimate-transaction-fee/scripts/estimate.ts --size 226 --rate 2
bun run skills/estimate-transaction-fee/scripts/estimate.ts --size 226 --rate 2

JSON output

JSON格式输出

bun run skills/estimate-transaction-fee/scripts/estimate.ts --size 226 --json
bun run skills/estimate-transaction-fee/scripts/estimate.ts --size 226 --json

Show help

显示帮助信息

bun run skills/estimate-transaction-fee/scripts/estimate.ts --help
undefined
bun run skills/estimate-transaction-fee/scripts/estimate.ts --help
undefined

Size Estimation

大小估算

P2PKH transaction size formula:
  • Base overhead: 10 bytes
  • Per input: ~148 bytes
  • Per output: ~34 bytes
Example: 1 input + 2 outputs = 10 + 148 + 68 = 226 bytes
P2PKH交易大小计算公式:
  • 基础开销:10字节
  • 每个输入:约148字节
  • 每个输出:约34字节
示例:1个输入 + 2个输出 = 10 + 148 + 68 = 226字节

Output Examples

输出示例

Default output:
Fee Estimation
==============
Size: 226 bytes
Rate: 1 sat/byte
Fee: 226 satoshis (0.00000226 BSV)
With --inputs/--outputs (shows breakdown):
Fee Estimation
==============
Size: 226 bytes
Rate: 1 sat/byte
Fee: 226 satoshis (0.00000226 BSV)
Breakdown:
  - Inputs (1): ~148 bytes
  - Outputs (2): ~68 bytes
  - Overhead: ~10 bytes
JSON output (--json):
json
{
  "size": 226,
  "rate": 1,
  "fee": 226,
  "feeBsv": 0.00000226
}
默认输出:
手续费估算
==============
大小:226字节
费率:1聪/字节
手续费:226聪(0.00000226 BSV)
使用--inputs/--outputs参数(显示明细):
手续费估算
==============
大小:226字节
费率:1聪/字节
手续费:226聪(0.00000226 BSV)
明细:
  - 输入(1个):约148字节
  - 输出(2个):约68字节
  - 开销:约10字节
JSON格式输出(--json参数):
json
{
  "size": 226,
  "rate": 1,
  "fee": 226,
  "feeBsv": 0.00000226
}

Status

状态

Complete
已完成