Fee Management
Proper fee management is critical when using Shield to ensure your transactions are successfully processed by mining pools and confirmed on the Bitcoin network.
Understanding Shield Fees
Shield requires a dedicated fee for its service, which:
- Incentivizes mining pools to include your transaction
- Compensates Shield for costs incurred while collecting fees on behalf of mining pools
This fee is inclusive of the standard Bitcoin transaction fee that miners collect from transaction inputs and outputs.
Fee Structure
When using Shield, you need to:
- Include an output in your transaction that pays the Shield service
- Ensure the output has a competitive fee for miners
Shield Payment Output
The Shield payment must be:
- Paid to the address provided by the
/info
endpoint. - Included as a single output (not split across multiple outputs).
- Sufficient to meet the minimum fee requirements.
Note: The vsize of the transaction used to calculate the fee must be inclusive of the output that pays the Shield service.
Fee Rate Calculation
The fee rate is calculated as:
Fee Rate = Total Fee / Transaction Size (in vbytes)
Where Total Fee is the value of the output paying the Shield service.
Selecting the Right Fee Rate
Shield's /info
endpoint provides fee rate recommendations based on the (estimated) cumulative fraction of the network's hashrate desired:
"fees": [
{
"estimated_hashrate": 0.12,
"feerate": 18.0
},
{
"estimated_hashrate": 0.27,
"feerate": 24.0
}
]
The estimated_hashrate
value (0-1) represents the approximate percentage of Bitcoin hashrate that will accept your transaction at that fee rate.
Calculating Total Shield Fee
To calculate the total Shield fee:
- Determine your transaction size in vbytes (don't forget to account for signatures and Shield payment output)
- Choose a fee rate from the
/info
endpoint - Multiply to get your total fee:
Total Shield Fee = Transaction Size (vbytes) × Fee Rate (sats/vbyte)
Example Calculation
For a 250 vbyte transaction (including Rebar output) with a desired fee rate of 15 sats/vbyte:
Total Shield Fee = 250 vbytes × 15 sats/vbyte = 3,750 satoshis
Fee Optimization Tips
- Use native SegWit addresses (bech32/P2WPKH) for smaller transaction sizes
- Consolidate inputs when possible to reduce transaction size
- Regularly check fee recommendations as they may change with network conditions
- Consider transaction batching for multiple payments to reduce overall fees
- Implement output amount calculations that account for the Shield fee