<blockquote>
  <p>I know Bitcoin has this concept of "sweeping" funds. Does that still involve incurring a flat fee for every address generated by the master private key?</p>
</blockquote>

<p>No, sweeping an address involves inputting a private key into some wallet software, and then having the wallet software initiate a tx to empty that address’ funds entirely into a new address that the wallet controls the private keys for.</p>

<p>While a BIP39 xpriv key can be used to derive many child keypairs, the xpriv cannot itself be used to spend the UTXOs of those child addresses. You need the private key of each address in order to spend it’s funds. The network has no way of knowing how a key pair was derived, so only the private key of each individual address can spend its funds. </p>

<p>For best efficiency, you’ll want to batch all of the UTXOs into a single transaction with a single output (or maybe more than one, depending on how you want to divide and store the funds). </p>

<p>A single tx with a lot of inputs will have a higher fee than any single tx, but it will be lower than the total fees paid if you send each one individually. </p>

<p>I’m not familiar with blockcypher, but in general if a tx is sent on the network, and then you’d like to spend those funds again, a network fee will be incurred. So I’m not sure their service will save you money in the way you’re looking for. </p>

<p>Lightning network is a potential solution for payment processing with lower fees, but the network is still young so it will take a little time for adoption to happen. </p>

CC BY-SA 3.0
2018-03-10T23:13:42.530Z
This is really helpful. I honestly wasn't aware of batching. A few questions: am I really gaining anything by depending on BlockCypher's service? I figure I can just host my own node to minimize risk of fees. Does batching multiple inputs to multiple outputs apply to other coins like Ethereum?
Maros
CC BY-SA 3.0
2018-03-14T20:15:31.260Z
I'm not familiar with BlockCypher's service, sorry. Their service may manage incoming payments more efficiently than you will be able to on your own, but it may also come with fees of its own. In either case, you'll still have to pay network fees when sending transactions. I am not sure how Ethereum manages batching, you'll have to post a new question and hope someone else can answer.
chytrik
CC BY-SA 3.0
2018-03-10T22:55:06.667Z
2018-03-10T22:55:06.667Z
chytrik
<p>I have a site that is trying to process micropayments. It uses a mnemonic / extended private key <a href="https://iancoleman.io/bip39/" rel="nofollow noreferrer">generated here</a> to generate a new Bitcoin address for every payment.</p>

<p>Everything works fine except I'm realizing now that it will be expensive to recover funds from the generated addresses because it will cost a ~10,000 satoshi mining fee per address.</p>

<p>This is a small fee but it is too high considering the totals being extracted are only 20,000 to 30,000 satoshi.</p>

<p>Are there any options to solve this problem? I know Bitcoin has this concept of "sweeping" funds. Does that still involve incurring a flat fee for every address generated by the master private key?</p>

<p>A few other options I've been considering:</p>

<ul>
<li>BlockCypher had a <a href="https://www.blockcypher.com/dev/bitcoin/#microtransaction-api" rel="nofollow noreferrer">microtransactions API</a> which seems to be shut down now</li>
<li>Some node APIs including BlockCypher offer payment forwarding though I don't understand the fees involved or how it works internally</li>
<li>Payment channels / Lightning Network</li>
</ul>

<transaction-fees><lightning-network><micropayments><micropaymentchannels>
Sweeping funds from addresses generated by Extended Private Key (BIP39)
Maros
# Sweeping funds from addresses generated by Extended Private Key (BIP39)

(Asked by: username_0 on 2018-03-10)

I have a site that is trying to process micropayments. It uses a mnemonic / extended private key [generated here](https://iancoleman.io/bip39/) to generate a new Bitcoin address for every payment.

Everything works fine except I'm realizing now that it will be expensive to recover funds from the generated addresses because it will cost a ~10,000 satoshi mining fee per address.

This is a small fee but it is too high considering the totals being extracted are only 20,000 to 30,000 satoshi.

Are there any options to solve this problem? I know Bitcoin has this concept of "sweeping" funds. Does that still involve incurring a flat fee for every address generated by the master private key?

A few other options I've been considering:

* BlockCypher had a [microtransactions API](https://www.blockcypher.com/dev/bitcoin/#microtransaction-api) which seems to be shut down now
* Some node APIs including BlockCypher offer payment forwarding though I don't understand the fees involved or how it works internally
* Payment channels / Lightning Network

**Tags:** transaction-fees, lightning-network, micropayments, micropaymentchannels


---

## 1 answers

### Answer by username_1 on 2018-03-10. Score: 1 | Accepted answer

> I know Bitcoin has this concept of "sweeping" funds. Does that still involve incurring a flat fee for every address generated by the master private key?

No, sweeping an address involves inputting a private key into some wallet software, and then having the wallet software initiate a tx to empty that address’ funds entirely into a new address that the wallet controls the private keys for.

While a BIP39 xpriv key can be used to derive many child keypairs, the xpriv cannot itself be used to spend the UTXOs of those child addresses. You need the private key of each address in order to spend it’s funds. The network has no way of knowing how a key pair was derived, so only the private key of each individual address can spend its funds.

For best efficiency, you’ll want to batch all of the UTXOs into a single transaction with a single output (or maybe more than one, depending on how you want to divide and store the funds).

A single tx with a lot of inputs will have a higher fee than any single tx, but it will be lower than the total fees paid if you send each one individually.

I’m not familiar with blockcypher, but in general if a tx is sent on the network, and then you’d like to spend those funds again, a network fee will be incurred. So I’m not sure their service will save you money in the way you’re looking for.

Lightning network is a potential solution for payment processing with lower fees, but the network is still young so it will take a little time for adoption to happen.

> **Comments:**
> **username_0**: This is really helpful. I honestly wasn't aware of batching. A few questions: am I really gaining anything by depending on BlockCypher's service? I figure I can just host my own node to minimize risk of fees. Does batching multiple inputs to multiple outputs apply to other coins like Ethereum?  
> **username_1**: I'm not familiar with BlockCypher's service, sorry. Their service may manage incoming payments more efficiently than you will be able to on your own, but it may also come with fees of its own. In either case, you'll still have to pay network fees when sending transactions. I am not sure how Ethereum manages batching, you'll have to post a new question and hope someone else can answer.  

---

