13

Is there any way to find out what the fee of a certain transaction will be before sending it, via RPC calls?

As a side note, is it possible to see the transaction fee on a transfer via RPC from the returned TX hash/key?

Edit: If this is currently not available, is it something that could be considered for inclusion? It seems like this would be a very useful function for wallets that use RPC so the user is not blindsided by TX fees.

9
+50

Knowing the transaction fee in advance is not possible [1], due to two reasons:

  • the output selection is randomized, so sending, eg, 100 monero several times will potentially need different fees, for example if one tx needs just one 150 monero input (small tx, small fee), but a second attempt happens to pick many 1 or 2 monero inputs (larger tx, larger fee).

  • there is no RPC command to create a transaction without relaying it to the daemon.

It would be fairly simple to add a boolean to the transfer RPC to tell the wallet to return the signed transaction to the caller, instead of relaying it. The caller could then decide whether the fee is acceptable, and relay it to the daemon if so. This is a good candidate to add as a github issue on https://github.com/monero-project/bitmonero/issues. All the building blocks are pretty much there already.

[1] you can get a lower/high bound based on the wallet owned outputs, but that probably doesn't help here.

2

Interesing question. I have no idea if this is possible, but I suppose that if it isn't, that would be because a subsequent call to actually perform the transfer, might not necessarily use the same inputs, and thus likely result in a different fee. Hoping someone more knowledgeable can chime in.

  • It might be calculated by nodes, so not really possible. – UsernameVF Oct 14 '16 at 16:22
  • From what I understand the wallet calculates the fees – Quentin Skousen Oct 14 '16 at 16:26
  • I think that is correct. This question explains the fee structure introduced in version 0.10.0.0. – dpzz Oct 14 '16 at 16:36
  • The wallet calculates, but the output selection is random, so it's not known before creating the tx. There could be an RPC to create a tx, return the tx and fee, and an RPC to relay the tx though. – user36303 Oct 14 '16 at 17:42

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.