1

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

5
  • 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.
    – m1xolyd1an
    Jul 14 at 15:11
  • @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
    Jul 14 at 15:37
  • @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. Jul 14 at 16:11
  • 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
    Jul 14 at 16:42
  • 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
    Jul 14 at 18:31
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 interesting.

2
  • 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
    Jul 15 at 11:35
  • 1
    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
    Jul 15 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.