dashed-slug.net › Forums › CoinPayments.net Wallet Adapter extension support › Calculate fees gathered from users?
Tagged: fees, txfee, withdrawal
- This topic has 8 replies, 2 voices, and was last updated 3 years ago by Stockero.
June 3, 2020 at 3:56 am #8507
Under wallet>adapters within admin panel i see
Hot Wallet Balance
Sum of User Balances
And i was wondering if i subtract
Hot Wallet Balance – Sum of User Balances= disposable income from fees?
What I’m trying to do is accurately pinpoint how much my website made from user fees so i can
Use those fees that was gathered towards Airdrops.June 3, 2020 at 7:46 am #8509
Unfortunately the plugin does not record the actual amount that was paid in fees to the blockchain network. The plugin only records the fees that the user sees, which should be more than the actual fee. The reason is that not all wallets report back the actual fees paid and therefore the transaction DB schema and coin adapter API are not designed to hold that information.
If you know how much your wallet pays in fees in a typical transaction, you can calculate this. Go to the admin dashboard and you will see sums of fees paid and transaction counts for the last day, week, month, and year.
For example, say that there have been 10 BTC withdrawals, and the sum of fees paid was 0.00500000 using CoinPayments. We know that CoinPayments uses a fee of 0.00040000 (or 40k satoshis) per BTC withdrawal. Therefore, the fees that remain with your site are 0.00500000 – 10*0.0004 = 0.001 BTC.
On the other hand, the fees that you see paid for internal transfers is accurate, as shown in the admin dashboard. All the fees paid for internal transfers are yours since you don’t pay a network fee for those.
The same goes for full node wallets, you just need the
txfeevalue that you use in your
.conffile to do the same calculation.
Hope this helps. Let me know if you have any more questions about this.
with regardsJune 3, 2020 at 4:09 pm #8512
Thank you for the reply, this definitely helps.June 3, 2020 at 6:05 pm #8513
It’s pretty much
My Fixed fee – number of withdraws*coinpayments network fee = earned commissionJune 3, 2020 at 6:45 pm #8514
Oops this is what i meant.
Fees paid to withdrawals – number of withdraws*coinpayments network fee = earned commissionJune 4, 2020 at 7:35 am #8517
Yes, that last formula is correct for withdrawals. Don’t forget to also count the internal transfers (moves) if you have any.June 4, 2020 at 3:48 pm #8519
Ty, I’ll take that to account.
I guess all i have left to ask is if i make a withdraw the first month for example, 0.005
And i wait two months to make the 2nd withdraw I’d have to keep track of the previous withdraw amount and calculate that as well?
Fees paid to withdrawals – number of withdraws*coinpayments network fee – 0.005 = earned commissionJune 5, 2020 at 7:41 am #8521
Yes, or if you really want to calculate withdrawal fees paid in any arbitrary range, you can easily pull this info from your SQL console (phpMyAdmin or mysql client command line).
Assuming that your DB prefix is
wp_, which is the default:
SELECT symbol, SUM( fee ) as fees, COUNT( 1 ) as count FROM wp_wallets_txs WHERE status = 'done' AND category = 'withdraw' AND amount < 0 AND created_time BETWEEN '2019-12-15' AND NOW() GROUP BY symbol ORDER BY symbol;
This query will sum the fees paid and transaction count for each coin, between the specified date and today. You can modify this range to fit your needs.
From these total fees, you then need to subtract the actual fee paid to the blockchain, times the transaction count.
Hope this helps. Let me know if you have any further questions.June 5, 2020 at 2:21 pm #8524
Amazing, that’s exactly what i need.
Thank you. I express my gratitude.
- You must be logged in to reply to this topic.