decentralized-identity / sidetree-reference-impl

Sidetree Reference Implementation
Apache License 2.0
5 stars 7 forks source link

BitcoinClient::createSidetreeTransaction should add allowed deviation to the minimumFeeInSatoshi parameter #10

Open mudiali opened 4 years ago

mudiali commented 4 years ago

https://github.com/decentralized-identity/sidetree/blob/8a82934182a1b1b399aafda54448cb5270a29cf0/lib/bitcoin/BitcoinClient.ts#L133

Currently, the above function calls the createTransaction function which adds the percentage to the transaction fee (the percentage is defined by the sidetreeTransactionFeeMarkupPercentage config parameter). We should refactor this so that this function adds the allowed deviation (maxQuantileDeviationPercentage config parameter) to the minimumFeeInSatoshis parameter to ensure that in case the fee goes up in the next block, the transaction is not rejected.

This would allow the admin to set the sidetreeTransactionFeeMarkupPercentage to 0 if they want and make sure that the transaction still follows the protocol rules (minimumFeeInSatoshis condition is met) and they don't have to pay the premium if they don't want.