0

I am new in bitcoin. I am developing a PHP website to let users build their wallet on my website. I want to give every user a wallet. I do not want to give users private keys. I keep private keys, so all their bitcoins owns mine. If everyone wants to spend his/her bitcoins, he/she needs to send a withdrawal request and I will handle it. I want to be able to send user's bitcoin at once with one transaction and one fee. So if I give every user a new address, bitcoins will be a changeed (a little amount in every address). So spending them needs lots of fee. What should I do? I am using blockcypher's API. Is there any other API can help? What senario should I do to achieve all above targets? thanks.

  • Bitcoin shows that a bank is not needed. And you want to be the bank.... Right? Well you have to pay the fees if you store the coins on multiple addresses. You can't do anything else. – ndsvw Mar 11 '18 at 16:43
  • @Alpha : For example in blockchain.info there is a wallet and lots of addresses associated with the wallet. If you pay to one or two of the addresses, bitcoin will be gathered in one place and you can spend them in one transaction. My question is How does blockchain.info do that?? – Meysam Valuyan Mar 11 '18 at 17:05
  • Yes, that's possible. You can add multiple UTXO. Almost every wallet supports this, but I can't explain you how it works exactly. – ndsvw Mar 13 '18 at 7:26
0

You'd have to get creative here.

Step 1) Get unspent outputs. https://bullpay.com/docs#GetUnspentOutputs You can build your unspent outputs from multiple wallets. As long as you have the private keys, it can be done. Step 2) Build your signed transaction. https://medium.com/coinmonks/how-to-create-a-raw-bitcoin-transaction-step-by-step-239b888e87f2 Step 3) Send your signed transaction. https://bullpay.com/docs#SendTransaction or use a node.

The part you'll want to repeat is in step 2. Building out the inputs each using their own private keys. The tricky part here is waiting long enough to have multiple outputs to warrant going through all this.

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.