3

I want my customers to pay transaction fees. The only helpful but incomplete answer I have found so far is from here:

You can create a transaction which spends the output to yourself, attaching a fee to that transaction. In order for miners to grab the transaction fee on that transaction, they would have to also mine the original transaction.

I have some experience of calling bitcoind methods using JSON. With these assumptions:

my account: "my"
receiver's address: "123..zyz"
coins to be sent: 0.001
transaction fee: (unpredictable)

my customer will receive 0.0008 coins if the transaction fee is 0.0002 in this case.

Am I supposed to first call method sendfrom like below?

sendfrom("my","123..zyz",0.001)

Then how do I determine the transaction fee? How do I charge the transaction fee to the receiver? Would kind soul please provide me the detail answer with complete list of calls to Original Bitcoin client/API calls?

4
  • In a standard Bitcoin transaction your customer DO pay the transaction fee. Also you do not need to send a transaction fee - it can be free. What is the issue here?
    – T9b
    Commented Jun 8, 2014 at 10:13
  • I have been in the impression that it is senders rather than receivers who pay transaction fees. I have difficulty in acquiring the more or less official documentation depicting the opposite.
    – Nakamichi
    Commented Jun 8, 2014 at 15:15
  • Nakamichi, you are correct that the sender does pay the fee. I think your question is a bit confusing though, I get the impression that you are sending your customers coins. Is this correct? If so why can't you just deduct the transaction costs from the coins you're sending them, and send your customer a note explaining why the amount sent is lower than expected? You can determine the fee by: en.bitcoin.it/wiki/Transaction_fees
    – Matt
    Commented Jun 9, 2014 at 0:13
  • @matt Yes, I am sending my customers coins. My question is confusing as English is not my native language. The official transaction fee deduction rule is too complicated for me. I opt for using accounts to automate the coins withdrawal limitations at the cost of inconvenience on customers for this moment.
    – Nakamichi
    Commented Jun 9, 2014 at 0:56

2 Answers 2

1

For precise calculations consider using raw transactions. Then you have to decide how this transaction fee will be calculated. For single output transactions it's clear, you deduct the tx fee from the receiving amount, although for some micro-payments this is not possible as the tx fee might be bigger than the actual payout amount. Batching your outgoing payments (pay many outputs in a single tx) will help reduce the transaction fees for your customers but in this case you have to decide who pays what. The tx fee is what is left if you deduct your outputs total amount (change included in that) from your inputs total amount. You can also chose to charge a flat fee per tx which is less precise but more transparent for your clients and easier for your calculations.

1
  • For precise calculations consider using raw transactions. Then you have to decide how this transaction fee will be calculated. If this approach leads to the official transaction fee calculation rules, that is exact what I would avoid to follow because it is too complicated for me. The tx fee is what is left if you deduct your outputs total amount (change included in that) from your inputs total amount. This reminds me of assigning an unique account for each customer. Thank you a lot!
    – Nakamichi
    Commented Jun 8, 2014 at 15:28
0

This thought suddenly hits me. Assigning a distinct account to every single customer automatically mitigate my problem:

With accounts in place, if a customer tries to withdraw (by calling sendfrom) more coins than the balance in his/her account plus any amount of transaction fee, that withdrawal attempt simply fails.

Such transaction failures are annoying to customers though. This is also annoying as customers are very unlikely to be able to close their accounts by withdrawing all their coins they own since they can not predict the exact transaction fees that will occur to their final withdrawal.

Not the answer you're looking for? Browse other questions tagged or ask your own question.