Handling Bitcoin Fees and Immutable Wallet Fee Policies
Research status: Theoretical SDK design. Examples are illustrative and have not been built or tested against the live engine.
Authority and amount semantics
The factory establishes the signed fee law at wallet creation. The engine verifies and executes that law; the SDK cannot replace it. A new SDK version must not change the fee law of an existing wallet. Distinguish requested amount, actual recipient output, mining fee and software fee. An inclusive fee policy can reduce the recipient output relative to the requested amount. Do not assume that all wallets share a single fee percentage or rounding rule.
Conceptual amount model
type PaymentAmounts struct {
RequestedSat int64
RecipientSat *int64
MiningFeeSat *int64
SoftwareFeeSat *int64
}Optional fields represent unknown values rather than zero. These are proposed normalized SDK fields, not documented response names. Populate them only from verified engine responses or transaction evidence with a justified attribution. A transaction's total mining fee may be derived from known input and output values, but a particular output is not automatically identifiable as a software fee.
Merchant integration
A merchant invoice specifies what must arrive at the recipient. A sender's requested amount is not necessarily that amount. Do not silently increase a requested SEND to compensate for fees; any changed spending intent requires explicit authorization. If a reliable documented quote is unavailable, expose the uncertainty rather than inventing an exact net amount. Keep health and identity discovery within their documented contracts; do not expect them to disclose fee details beyond law identity.
Failure boundaries
Network fee conditions, dust policy and available UTXOs may affect execution. An SDK estimate is not an engine guarantee. Never modify the signed law, reconstruct a different transaction locally or retry a failed payment with a larger amount without approval. Record fee observations with the wallet law identity where available and the transaction reference.
Acceptance plan
Use fixtures for unknown fees, integer rounding boundaries and insufficient funds. On Testnet compare requested amount and actual recipient output for a known wallet law. Verify fees only where evidence permits attribution. Test both address types without assuming identical transaction weight. Keep all mainnet spending outside this test plan.
Primary reference
https://thamer.org/api
Related reading in this series
https://thamer.org/docs/wab-sdk-designing-bitcoin-sdk
https://thamer.org/docs/wab-sdk-api-engine-application-boundaries
https://thamer.org/docs/wab-sdk-wallet-identity-management
https://thamer.org/docs/wab-sdk-cross-language-interfaces
https://thamer.org/docs/wab-sdk-typed-json-contracts
https://thamer.org/docs/wab-sdk-authentication-credential-management
https://thamer.org/docs/wab-sdk-wallet-creation-restoration
https://thamer.org/docs/wab-sdk-receive-address-interfaces
https://thamer.org/docs/wab-sdk-balance-utxo-management
https://thamer.org/docs/wab-sdk-transaction-execution
https://thamer.org/docs/wab-sdk-idempotency-retry-strategies
https://thamer.org/docs/wab-sdk-wallet-recovery-local-lifecycle
https://thamer.org/docs/wab-sdk-payment-sdk-design
https://thamer.org/docs/wab-sdk-watch-payment-monitoring
https://thamer.org/docs/wab-sdk-invoice-abstractions
https://thamer.org/docs/wab-sdk-confirmation-settlement-states
https://thamer.org/docs/wab-sdk-payment-reconciliation
