Bitcoin Forum
June 26, 2024, 04:34:44 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Best Practice for Hot Wallets  (Read 866 times)
Miitch (OP)
Full Member
***
Offline Offline

Activity: 126
Merit: 100


View Profile
August 17, 2014, 06:56:11 PM
 #1

Hey, I'm new here so please be gentle with me! I've searched Google for this answer multiple times with no luck so hoping that you might be able to help me shed some light on this.

I've been wondering: What's the best practice for handling hot wallets when multiple small deposits are received, and occasional payments out are needed?

I am coding a website (PHP/MySQL) that accepts many small Bitcoin payments from different people. They each receive their own unique deposit address and using bitcoind I am able to tell when the deposit has been made and how many confirmations it has had. This all gets saved into MySQL and I can use it to update their website account info. It's working great!

My problem is:
The deposits all get left in the unique addresses. So now I'm writing code to allow people to withdraw money and unless their wallet has enough funds then I need to somehow pull funds from multiple of the unique deposit addresses.

The thought of the maths required is driving me a bit insane and I keep thinking, "there must be an easier way". What springs to mind is a routine that regularly sends funds in the incoming unique addresses to a main hot wallet. Then when it comes to withdrawing I can just use that slush fund to fund the output. I'm a bit worried about all the transaction fees that would be required for moving the deposited funds around though.

Can anyone suggest how this would be done normally? Or point me to documentation that explains it?

▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇   COIN-SWEEPER
▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇    Avoid Bombs Win BIG
▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇   1% House Edge   ▇ ▇ ▇ ▇ ▇ ▇ ▇
Abdussamad
Legendary
*
Offline Offline

Activity: 3640
Merit: 1571



View Profile
August 18, 2014, 12:22:38 AM
 #2

Quote
The deposits all get left in the unique addresses. So now I'm writing code to allow people to withdraw money and unless their wallet has enough funds then I need to somehow pull funds from multiple of the unique deposit addresses.

This doesn't make sense. You want to allow people to withdraw more than they deposited? I don't think that's what you mean. I think you are worried about how bitcoind will fund withdrawals. Bitcoind will automatically grab coins from whatever outputs there are to fund any withdrawals. It will not limit itself to certain addresses.  You will need to track how much a person has deposited, how much they've spent and how much they can withdraw.


Also avoid the bitcoind "accounts" feature. That's just crap.
Miitch (OP)
Full Member
***
Offline Offline

Activity: 126
Merit: 100


View Profile
August 18, 2014, 07:50:47 AM
 #3

I appreciate the reply! Your answer makes sense - I didn't realize that bitcoind would pull funds from whatever outputs it has available.

My system tracks their deposits/spending/amount available for withdrawal. I haven't read a nice thing about the "accounts" feature so I decided to give it a wide berth from the start!

Should I be concerned at all about transaction costs? I anticipate most deposits will be around 0.01~ BTC but there will be the occasional withdrawal of 3BTC~. Is there a best practice for keeping transaction costs down?

▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇   COIN-SWEEPER
▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇    Avoid Bombs Win BIG
▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇   1% House Edge   ▇ ▇ ▇ ▇ ▇ ▇ ▇
Abdussamad
Legendary
*
Offline Offline

Activity: 3640
Merit: 1571



View Profile
August 18, 2014, 12:04:08 PM
 #4

Should I be concerned at all about transaction costs? I anticipate most deposits will be around 0.01~ BTC but there will be the occasional withdrawal of 3BTC~. Is there a best practice for keeping transaction costs down?

There is but it only works for sites which have a large volume of transactions. Sites like exchanges. What they do is they send withdrawals out in batches i.e. in large transactions. This saves them some fees but it means that people have to wait a few hours for their withdrawal to be processed.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!