<p>Every output of a transaction needs to be explicitly spent as an input eventually, but there is no need to stage deposits separately and resend them to yourself again. Maybe I'm missing something, but you could and should give out addresses of your service's wallet to your users and thus get deposits directly into your wallet. If you give each user a new address for every deposit, you can tell via the funded address which user to credit, and the funds will immediately be available to process withdrawals.</p>
<p>If your wallet grows too large, you'll want to consolidate some funds either back into the hot wallet or move some into cold wallet with stricter security policies.</p>
<p>You may find my blog post on <a href="https://blog.bitgo.com/utxo-management-for-enterprise-wallets-5357dad08dd1" rel="nofollow noreferrer">UTXO management for enterprise wallets</a> interesting.</p>

CC BY-SA 4.0
2021-07-15T11:35:25.903Z
Awesome discovery! I need to write bitcoin transaction constructor that will collect as much UTXOs from deposition wallets as needed for a transaction with multiple receiver wallet and two outputs - target and change. That should allow spending any amount from user deposits. Maybe any keywords to find existing implementations?
Akias
CC BY-SA 4.0
2021-07-15T12:37:41.493Z
The search term is "coin selection". You don't have to do all that yourself, there are a number of libraries that have implementations of coin selection already.
Murch
CC BY-SA 4.0
2021-07-14T18:42:08.140Z
2021-07-14T18:42:08.140Z
Murch
<p>We're looking into making website for trading Bitcoin.</p>
<p>Users get <em>individual bitcoin addresses</em> to deposit BTC.</p>
<p>How do we avoid paying transaction fees for every of these deposit transactions that we'll have to 'repeat' to send money to our 'system' wallet address?</p>
<p>We've played with <strong>bitcoind</strong> json-rpc. Could <strong>blockchain.com API</strong> help in aggregating this deposition payments without fees?</p>
<p>Thank you</p>

CC BY-SA 4.0
2021-07-14T15:11:52.370Z
I would assume the users individual bitcoin address you provide them is part of your "system", is that correct?  The part where you send money to your system after you already provided the users with a deposit address seems unnecessary and chaotic.
m1xolyd1an
CC BY-SA 4.0
2021-07-14T15:37:08.727Z
@m1xolyd1an Three users registered and deposited 0.1 BTC each using their three individual deposit BTC addresses (wallets). How could website/owner then, say, make a transaction worth of ~ 0.3 BTC if all user money are spread across technically unrelated wallets ?
Akias
CC BY-SA 4.0
2021-07-14T16:11:49.020Z
@Akias Bitcoin transactions have an input and an output section. You can put three entries in the input section to "gather" those payments into a single transaction. You can also have multiple outputs to make several outbound payments in the same transaction. This complex transaction will require a larger fee, but not as much as doing it with separate transactions. But, yes, you will need some complex code if you want to minimize your transaction fees.
David Schwartz
CC BY-SA 4.0
2021-07-14T16:42:35.593Z
Is there a limit to transaction inputs count? I mean, a threshold after miners will not mine it. I assume that you say I can sign N inputs with N different keys/wallets. Googling around 1 hour I've found exactly 1 paper that at least says I can sign, the topic seems to be poorly documented.
Akias
CC BY-SA 4.0
2021-07-14T18:31:55.227Z
Transactions larger than 400,000 weightunits are non-standard. Depending on the output type of your funds that limits you to roughly 650-1450 inputs per transaction.
Murch
<transaction-fees><blockchain.info><website-integration><automation>
Avoiding fees collecting BTC deposits from different addresses
Akias
# Avoiding fees collecting BTC deposits from different addresses

(Asked by: username_0 on 2021-07-14)

We're looking into making website for trading Bitcoin.

Users get *individual bitcoin addresses* to deposit BTC.

How do we avoid paying transaction fees for every of these deposit transactions that we'll have to 'repeat' to send money to our 'system' wallet address?

We've played with **bitcoind** json-rpc. Could **blockchain.com API** help in aggregating this deposition payments without fees?

Thank you

**Tags:** transaction-fees, blockchain.info, website-integration, automation

> **Comments:**
> **username_1**: I would assume the users individual bitcoin address you provide them is part of your "system", is that correct?  The part where you send money to your system after you already provided the users with a deposit address seems unnecessary and chaotic.  
> **username_0**: @username_1 Three users registered and deposited 0.1 BTC each using their three individual deposit BTC addresses (wallets). How could website/owner then, say, make a transaction worth of ~ 0.3 BTC if all user money are spread across technically unrelated wallets ?  
> **username_2**: @username_0 Bitcoin transactions have an input and an output section. You can put three entries in the input section to "gather" those payments into a single transaction. You can also have multiple outputs to make several outbound payments in the same transaction. This complex transaction will require a larger fee, but not as much as doing it with separate transactions. But, yes, you will need some complex code if you want to minimize your transaction fees.  
> **username_0**: Is there a limit to transaction inputs count? I mean, a threshold after miners will not mine it. I assume that you say I can sign N inputs with N different keys/wallets. Googling around 1 hour I've found exactly 1 paper that at least says I can sign, the topic seems to be poorly documented.  
> **username_3**: Transactions larger than 400,000 weightunits are non-standard. Depending on the output type of your funds that limits you to roughly 650-1450 inputs per transaction.  

---

## 1 answers

### Answer by username_3 on 2021-07-14. Score: 1

Every output of a transaction needs to be explicitly spent as an input eventually, but there is no need to stage deposits separately and resend them to yourself again. Maybe I'm missing something, but you could and should give out addresses of your service's wallet to your users and thus get deposits directly into your wallet. If you give each user a new address for every deposit, you can tell via the funded address which user to credit, and the funds will immediately be available to process withdrawals.

If your wallet grows too large, you'll want to consolidate some funds either back into the hot wallet or move some into cold wallet with stricter security policies.

You may find my blog post on [UTXO management for enterprise wallets](https://blog.bitgo.com/utxo-management-for-enterprise-wallets-5357dad08dd1) interesting.

> **Comments:**
> **username_0**: Awesome discovery! I need to write bitcoin transaction constructor that will collect as much UTXOs from deposition wallets as needed for a transaction with multiple receiver wallet and two outputs - target and change. That should allow spending any amount from user deposits. Maybe any keywords to find existing implementations?  
> **username_3**: The search term is "coin selection". You don't have to do all that yourself, there are a number of libraries that have implementations of coin selection already.  

---

