Author

Topic: How to send balance from multiple address to a single address? (Read 303 times)

HCP
legendary
Activity: 2086
Merit: 4361
In situations like this... it is probably better to use an existing solution like BitMaxz has suggested.

Generally, you create an HD wallet (NOT on the same server etc, but offline or Hardware wallet etc) and then take the "Master Public Key" from that HD wallet and put it into your eCommerce/Bitcoin gateway... A decent eCommerce/Bitcoin gateway solution should be able to generate addresses as required from the Master Publick Key, and link those addresses to client accounts.

Meanwhile, your private keys are all safely kept elsewhere and when you want to sell, you just use your wallet software to send coins as normal, it'll be able to handle having coins in all different addresses just fine. The only real consideration you have here is to try to avoid getting "low value" inputs (aka dust). This is why a lot of exchanges and gambling sites etc have minimum deposit amounts.

The real trick will be finding an eCommerce/Bitcoin gateway that works for your setup. But I think BitMaxz suggestions should be a good starting place.
legendary
Activity: 3374
Merit: 3095
BTC price road to $80k
yes, i found about this electrum too yesterday.
i can generate a lot of addresses to give to the clients.

next step, should i link with blockchain api to read transaction history of each btc address?
or should i setup my own bitcoin server to do it?
but the syncing process will take a lot of time.

any opinion?

What exactly your business is?
Since you mention " that your clients will make monthly payment" in your business I think you are going to build a business with membership subscription? Am I right?

If your business is built on Wordpress I suggest you find "membership subscription plugin" Integrates with WooCommerce and then use BTCpayserver as a payment gateway.

All transactions will be recorded on Woocommerce so if you are going to read the transaction history all information can found on Woocommerce order page like the BTC address where they sent and how much they pay.

Btcpay has two options the self-hosted or you can use the 3rd party hosting. If you choose a self-hosted you will need to host it on your own(Don't worry they made it easy one-click deployment if you are going to host them on azure,web-deployment or Google cloud) check their documentation for more info https://docs.btcpayserver.org/
BTCpay self-hosted requires fully sync before you can use it but if you don't want to wait you can use their mainnet demo or 3rd party hosting like btcpayjungle.com

BTCpay only requires your wallet xPUB or master public key so that all addresses generated from your customers  are from your wallet(Which is fully controlled by you).


hero member
Activity: 1680
Merit: 655
If you figure things out this wouldn't be a problem if you use your main BTC address as the payment address for all of your clients.

it is hard to do accounting if every payment go to the same address.
i do not know which payment coming from which client.

so, it is easier to give a client a dedicated btc address.
any payment goes to that address, will link automatically to that client.

Sorry what I mean is wallet and not your address. Let say if you have a Electrum wallet you have the capability of having multiple addresses from that wallet all of which will have their own txids shown in any blockchain explorer website so you can easily identify which is which from this method. Also all the addresses connected from that wallet will be receiving all your payments from the same wallet. So really there is no need for you to create 1,000 different wallets to sort things out.
copper member
Activity: 1652
Merit: 1325
I'm sometimes known as "miniadmin"
1. You still need desktop wallet (which is "bridge" between you and your trezor) such as Electrum to manage your Bitcoin

Not really; I use a Trezor One, and the only software you need to install is the driver itself. It's called Trezor bridge, but everything related to wallet operations is done on a browser tab (you need to have the HW plugged in).
Apart from that, you can use "tags" on each address, so if OP is going to hand-select the addresses for the clientts, he may just use that tag function to identify every incoming transaction on the Tx history. And since every address is stored under the same wallet, you can send every input into a single output (like on every other wallet).
legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
next step, should i link with blockchain api to read transaction history of each btc address?
or should i setup my own bitcoin server to do it?
but the syncing process will take a lot of time.

any opinion?
Depending on your server's hardware and specs, synchronizing and parsing the blockchain could be much faster than you think. I would say it would be a better idea to host your own server; the uptime of your local server would still be relatively reliable and you won't have to trust a third party to supply you with the correct information.

I wouldn't say hardware wallets are good for anything requiring frequent access to the coins. Sure, it is possible to just function with the xpub exposed but automating it would be a hassle and using a client with RPC function would be much more viable.
jr. member
Activity: 85
Merit: 1
Can I ask why do you want or believe you need to consolidate all the BTC into one address? Huh

When I want to sell the btc, I need to transfer all the balance from clients btc addressess to my exchange btc address.
so, that's the reason.

If your wallet contains all the keys belonging to those addresses, then you will be able to spend the all the coins regardless of what address the coins are associated with. Your wallet software should handle that just fine. By consolidating all the coins together you're creating unnecessary transactions and wasting money on fees.

cant agree more



You're going to have to say how this will be done but I'll go with what I'd expect:

If you're using a HD wallet with a derived xpub and xprv then you merely import the xpub into the server for the clients to pay into and keep the xpriv on an offline device...

You'd then sign a transaction with the xpriv and transfer it to an online device to consolidate everything.

The actual signing of the 1000 inputs into one transaction is trivial and will be handled by any client. The important thing is, if you don't need to consolidate quickly, you should consolidate at a 1 sat per byte fee where possible and enable a rbf double spend in the software you're using.

yes, currently looking on HD wallet

Most bitcoin wallet nowadays are HD wallet, you just need to choose which wallet is best for your usage case. Electrum is good choice, but it's not scalable for big business with hundred thousand or more address/user.

You also need to consider whether to provide legacy address (1...), segwit address (3...) or native segwit address (bc1...) for your client.
SegWit address (3...) usually is best choice, but it's not available by default on Electrum.

how about Trezor?
it has segwit address (3...)
and can generate address too
but it does not has Replace by fee function.

whats your opinion?
jr. member
Activity: 85
Merit: 1
You're going to have to say how this will be done but I'll go with what I'd expect:

If you're using a HD wallet with a derived xpub and xprv then you merely import the xpub into the server for the clients to pay into and keep the xpriv on an offline device...

You'd then sign a transaction with the xpriv and transfer it to an online device to consolidate everything.

The actual signing of the 1000 inputs into one transaction is trivial and will be handled by any client. The important thing is, if you don't need to consolidate quickly, you should consolidate at a 1 sat per byte fee where possible and enable a rbf double spend in the software you're using.

yes, currently looking on HD wallet



If you figure things out this wouldn't be a problem if you use your main BTC address as the payment address for all of your clients.

it is hard to do accounting if every payment go to the same address.
i do not know which payment coming from which client.

so, it is easier to give a client a dedicated btc address.
any payment goes to that address, will link automatically to that client.



This isn't hard to do if the 1000 bitcoin address is in the same wallet you can just simply send it all to your main Bitcoin address.

Sample this image below I'm going to spend/send bitcoins from my client's addresses(Bitcoin address that you give to your clients) to my main address.


[Electrum testnet as a sample.]
Choose the client's addresses that you want to spend or send to your main BTC address right-click and then spend.
You will be redirected to send tab on Electrum then put your main BTC address and click the max under amount and set the fee then click send.

And that's it.

But if the 1000 bitcoin addresses are not on the same wallet you have to take all private keys from all of these 1000 addresses and import it to Electrum and then go to send tab>put your main address>click the max button under amount>set the fee> then click send.


This is what it looks like on the send tab you will notice there is a new box appear below the description.



yes, i found about this electrum too yesterday.
i can generate a lot of addresses to give to the clients.

next step, should i link with blockchain api to read transaction history of each btc address?
or should i setup my own bitcoin server to do it?
but the syncing process will take a lot of time.

any opinion?
HCP
legendary
Activity: 2086
Merit: 4361
How can I send the balance from all 1000 bitcoin address to my main btc address?
Can I ask why do you want or believe you need to consolidate all the BTC into one address? Huh

If your wallet contains all the keys belonging to those addresses, then you will be able to spend the all the coins regardless of what address the coins are associated with. Your wallet software should handle that just fine. By consolidating all the coins together you're creating unnecessary transactions and wasting money on fees.
legendary
Activity: 3374
Merit: 3095
BTC price road to $80k
This isn't hard to do if the 1000 bitcoin address is in the same wallet you can just simply send it all to your main Bitcoin address.

Sample this image below I'm going to spend/send bitcoins from my client's addresses(Bitcoin address that you give to your clients) to my main address.


[Electrum testnet as a sample.]
Choose the client's addresses that you want to spend or send to your main BTC address right-click and then spend.
You will be redirected to send tab on Electrum then put your main BTC address and click the max under amount and set the fee then click send.

And that's it.

But if the 1000 bitcoin addresses are not on the same wallet you have to take all private keys from all of these 1000 addresses and import it to Electrum and then go to send tab>put your main address>click the max button under amount>set the fee> then click send.


This is what it looks like on the send tab you will notice there is a new box appear below the description.

hero member
Activity: 1680
Merit: 655
This will be a hard thing to do with Bitcoin, since Bitcoin in the first place isn't like a credit card where you can allow and automate your subscribers/users to automatically deduct something under their name. Easiest way to do recurring payments is using Coinbase API which even them only has the feature to notify them on a fixed period and it still requires the user to manually pay what they are due. Other options are using a time lock function for your clients but in this method it makes them feel that they spending the whole period and not taking monthly payments for you.

How can I send the balance from all 1000 bitcoin address to my main btc address?

If you figure things out this wouldn't be a problem if you use your main BTC address as the payment address for all of your clients.
copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
You're going to have to say how this will be done but I'll go with what I'd expect:

If you're using a HD wallet with a derived xpub and xprv then you merely import the xpub into the server for the clients to pay into and keep the xpriv on an offline device...

You'd then sign a transaction with the xpriv and transfer it to an online device to consolidate everything.

The actual signing of the 1000 inputs into one transaction is trivial and will be handled by any client. The important thing is, if you don't need to consolidate quickly, you should consolidate at a 1 sat per byte fee where possible and enable a rbf double spend in the software you're using.
jr. member
Activity: 85
Merit: 1
Hi,

I am planning to integrate bitcoin to my business.
Let say I have 1000 clients and I give one bitcoin address for each of them for them to make monthly payment.
How can I send the balance from all 1000 bitcoin address to my main btc address?

I believe it is do-able and I would love to learn how to do this.

Thanks
Jump to: