How to merge inputs
andriibezkorovainyi opened this issue · 4 comments
I have 1 wallet in my node, which has many accounts({ type: pubkeyhash, witness: true }). The balance is splitted among these accounts. When I need to send a bit large amount of BTC, inputs quantity can reach 400-500, with the corresponding
high transaction fee.
How can I merge my inputs into one? Or, maybe, there is another way to decrease fee, as it seems that bcoin hasn't added the PSBT's support yet.
Hello, @joemphilips help me, please. I saw your PR with PSBT implementation, and it seems bcoin doesn't support it. I'm curious can use bitcoinjs-lib to do all signature staff and bcoin to just fetch accounts and broadcast transactions?
PSBT won't help you reduce fees. If you are trying to consolidate 400-500 inputs the tx size will be very large and you can expect to pay a huge fee. Watch the mempool and wait for a low-fee period for consolidation. Another approach might be to consolidate in stages, i.e. maybe create 10-20 txs that consolidate 10-20 inputs each, and then combine those outputs if mempool fees remain low enough.
@pinheadmz Thank for your response, how would you approximately rate the possible comission reduce with the second approach? I'm asking beacuse, I don't understand clear enough, what is the difference betwen one tx with 400 inputs and 20 txs with 20 txs each, in the meaning of fee's sizes. Could you explain a bit, please?
Just depends on your budget and time preference. You also may hit the policy limit on tx weight if you try to add too many inputs. Here's some more links for you to browse:
Consolidation questions on stack exchange:
https://bitcoin.stackexchange.com/search?q=Consolidate
follow Murch on twitter for clues about best times to consolidate with low fee rates: