Post
Topic
Board Development & Technical Discussion
Re: Bitcoin Transaction Size And Fee Calculation
by
mocacinno
on 22/05/2019, 09:54:27 UTC
Thanks for the info:) very helpful
can you help me understand what is happening in the wallet?
So I have accounts (for now) each account is just a collection of private keys that it controls and they can: create addresses, send crypto to where ever... or even I can move these private keys from one account to another.
But what if I want to send crypto from a specific address, not account. can it be done?
I'm building a multi-user app and I want to save on fees so I want users to send to a couple of addresses that I manage and control. and when I want to send the funds I want to choose the best suitable address and send from it.


yes... It can be done

In the gui => coin controll
In the cli (or json-rpc) => "listunspent" to see unspent outputs => "createrawtransaction" to create a transaction using these unspent outputs => "signrawtransaction" to sign the raw transaction => "sendrawtransaction" to broadcast the signed tx

You'll have to combine the cli sollution with "decoderawtransaction" to look at the vsize and "estimatesmartfee" to see which fee is appropriate at that time. Oh, and the "getrawchangeaddress" to create a new change address (don't overspend on fees by not sending the change to a change addy!!!)

Both sollutions (gui with coin controll and/or cli) would also allow you to send funds to multiple addresses (users) in one transaction, increasing the size of the transaction, but still saving on fees because 1 transaction combining many unspent outputs as input and generating many new unspent outputs as output is smaller than several transactions combining less unspent outputs as input and creating 1 (or 2) new outputs (don't forget the change address)