Understanding Input Size and Transaction Fees

3 replies 519 views
Posts: 2 · Reputation: 8
#1Nov 22, 2023, 04:14 PM
I'm working on a project where BTC comes to address A, then gets sent to address B. I wanna clear out address A, like get it to zero BTC if possible. Just to clarify, not creating any malware here, so chill. Using python with bitcoinlib for this.
7 Reply Quote Share
alex.byteLegendary
Posts: 182 · Reputation: 5910
#2Nov 22, 2023, 08:44 PM
Yeah, makes sense. You can pick any of your inputs. Some wallets help with that, but really, you can choose whatever coins and the order doesn't matter. Just keep in mind the final size of the transaction in virtual bytes. You could even prep a zero-fee transaction, check the size, and adjust outputs accordingly.
10 Reply Quote Share
m1kes4tFull Member
Posts: 168 · Reputation: 252
#3Nov 23, 2023, 01:38 AM
When mentioning inputs, you should be talking about UTXOs. It’s easier to filter them by address for your case, but you can also sort by amount or how long they’ve been around. If you’re into Python, hooking up a Bitcoin node with Bitcoinlib or using an external API would be smart for handling transactions.
3 Reply Quote Share
0xNodeMember
Posts: 680 · Reputation: 80
#4Nov 23, 2023, 07:42 AM
Honestly, trying to figure out the fee manually is tricky without an API. You can't just calculate it out of the blue. Fees depend on the mempool size, but you really need to analyze past transactions to get an idea of what fees are like.
5 Reply Quote Share

Related topics