0

I have a site that is trying to process micropayments. It uses a mnemonic / extended private key generated here 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 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

1 Answer 1

1

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.

2
  • 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
    Mar 10, 2018 at 23:13
  • 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
    Mar 14, 2018 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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