Bitcoin Forum
November 05, 2024, 03:44:57 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Miners fee, coin age and customers withdrawals  (Read 900 times)
monsterer (OP)
Legendary
*
Offline Offline

Activity: 1008
Merit: 1007


View Profile
September 13, 2013, 10:26:51 AM
 #1

Hi guys,

If you're running a service, like an exchange, which allows customers to deposit and withdraw coins, how do you handle miners fees for coins which are too young?

If you are using a hot-wallet + cold-storage solution, you can't use the accounts feature (sendfrom) because the coins may well be in cold storage, so the account total will be wrong.

Given this fact, (and using sendtoaddress instead) it could very well be possible that a customer doesn't actually have enough total funds to cover the withdrawal AND the miners fee, which would leave the exchange out of pocket. As far as I can work out, there is no way to determine what the miners fee will be in advance?

What's the best way to handle this?

Cheers, Paul.
jl2012
Legendary
*
Offline Offline

Activity: 1792
Merit: 1111


View Profile
September 13, 2013, 11:32:37 AM
 #2

You can charge them a flat fee, say 0.0005BTC

Donation address: 374iXxS4BuqFHsEwwxUuH3nvJ69Y7Hqur3 (Bitcoin ONLY)
LRDGENPLYrcTRssGoZrsCT1hngaH3BVkM4 (LTC)
PGP: D3CC 1772 8600 5BB8 FF67 3294 C524 2A1A B393 6517
monsterer (OP)
Legendary
*
Offline Offline

Activity: 1008
Merit: 1007


View Profile
September 13, 2013, 12:05:40 PM
 #3

You can charge them a flat fee, say 0.0005BTC

But who's to say that will actually be enough to cover the miners fee? What about handling of this problem for alt-coin clients as well?

Is there no way to query what the client will generate as the miners fee in advance?
DannyHamilton
Legendary
*
Offline Offline

Activity: 3472
Merit: 4801



View Profile
September 13, 2013, 01:19:13 PM
 #4

You can generate raw transactions.

In that case you can make sure that you only use the oldest unspent outputs under your control (or the ones that contribute the most priority to the transaction).  You can calculate the priority and transaction size to make sure that a miner's fee isn't necessary, and you can toss in a 0.0001 BTC fee just to encourage fast confirmation.
jl2012
Legendary
*
Offline Offline

Activity: 1792
Merit: 1111


View Profile
September 13, 2013, 01:53:10 PM
 #5

You can charge them a flat fee, say 0.0005BTC

But who's to say that will actually be enough to cover the miners fee? What about handling of this problem for alt-coin clients as well?

Is there no way to query what the client will generate as the miners fee in advance?

A flat rate, if high enough, should cover the fee on long term.

If you really want to tell the user the exact fee before transaction, you should do it this way:

1. User tells you the amount he wants to withdraw
2. You search your UTXO set, find suitable UTXOs, calculate the fee and you tell the user
3. You lock the chosen UTXOs for a few minutes (not to be used in other tx)
4. If the user accepts the fee, you will proceed

Donation address: 374iXxS4BuqFHsEwwxUuH3nvJ69Y7Hqur3 (Bitcoin ONLY)
LRDGENPLYrcTRssGoZrsCT1hngaH3BVkM4 (LTC)
PGP: D3CC 1772 8600 5BB8 FF67 3294 C524 2A1A B393 6517
monsterer (OP)
Legendary
*
Offline Offline

Activity: 1008
Merit: 1007


View Profile
September 13, 2013, 02:56:37 PM
 #6

A flat rate, if high enough, should cover the fee on long term.

If you really want to tell the user the exact fee before transaction, you should do it this way:

1. User tells you the amount he wants to withdraw
2. You search your UTXO set, find suitable UTXOs, calculate the fee and you tell the user
3. You lock the chosen UTXOs for a few minutes (not to be used in other tx)
4. If the user accepts the fee, you will proceed

I think the former seems like the way to go - aim for something which covers fees on average.
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!