Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to merge inputs #1173

Open
andriibezkorovainyi opened this issue Oct 9, 2023 · 4 comments
Open

How to merge inputs #1173

andriibezkorovainyi opened this issue Oct 9, 2023 · 4 comments

Comments

@andriibezkorovainyi
Copy link

andriibezkorovainyi commented Oct 9, 2023

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.

@andriibezkorovainyi
Copy link
Author

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?

@pinheadmz
Copy link
Member

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.

@andriibezkorovainyi
Copy link
Author

andriibezkorovainyi commented Oct 10, 2023

@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?

@pinheadmz
Copy link
Member

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:

https://twitter.com/murchandamus/status/1708887501652578663

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants