ofek / bit

Bitcoin made easy.
https://ofek.dev/bit/
MIT License
1.24k stars 211 forks source link

Pay fee from transaction #174

Open enty8080 opened 1 year ago

enty8080 commented 1 year ago

@ofek

Is it possible to pay fee from transaction and not the whole amount of available currency?

For instance, when you send 0.01 BTC you pay a fee from your wallet, but I want to pay fee from this exact amount and the client will receive 0.01 - fee BTC.

How can I do this?

kuopassa commented 1 year ago

Idea: attempt to calculate transaction size, then get a fee estimate (satoshis per byte) using get_fee(fast=True). After that you can use tx size + fee per byte to guesstimate the sum, which you need to add to the total. Of course this spergtech even after 13-14 years has no easy way to calculate transaction size.