Create getfee RPC

Issue #217 new
Jordan Lee
repo owner created an issue

Right now, applications can determine the correct fee as it varies due to shareholder voting using the getinfo RPC and the paytxfee value it returns. This method of determining the correct fee will not work once we have introduced value based fees in Nu 3.0. With Nu 3.0, a getfee RPC will need to be used that takes the value being sent into account when returning the fee. Coinomi and NuDroid need to implement variable fees. If they use getinfo, they will have to change the implementation again for Nu 3.0. If we give them a getfee RPC now, then they can use that and no changes will be necessary later in NuDroid and Coinomi regarding fees.

In 3.0, the fee will be the greater of the fee required by two completely separate fee calculations, one being based on the number of bytes in the transaction and the other being based on the quantity currency or shares in the transaction. The current implementation of getfee will only use the size of the transaction in bytes to determine the fee. However, it should still take a parameter for the quantity of currency/shares, so that Coinomi and NuDroid can send this info now and not have to change their implementation as we implement 3.0. As we implement 3.0, we will add code to the getfee RPC to take the value of the transaction into account. However, for now, that parameter will not be used. Therefore, two parameters are needed:

  1. number of bytes in the transaction
  2. number of currency or share units being sent

Take a look at this discussion for additional context: https://discuss.nubits.com/t/draft-dynamic-fees-in-nudroid/2832/3