Skip to content

Dynamic transaction minimum fee

Aiwe edited this page Jul 25, 2018 · 4 revisions

Starting block v. 4 adaptive, difficulty driven minimum transaction fee was introduced. Its purpose is to stay at about the same level in fiat equivalent independently of the currency price. You can read more about the adaptive minimum fee in Karbo whitepaper. It varies depending on difficulty, therefore, services need to get the current minimum fee from the node when sending transactions.

Minimum tx fee is provided in responses from karbowanecd or walletd in atomic units and it is suggested not to use received value 'as is', but to round it up to one of two first digits after leading zeroes or double it to make sure tx will not become invalid and stuck due to fee fluctuations. What we mean by 'rounding up': let's assume we have a current minimum fee as 0.015662860155 KRB in readable form. It is safer to send tx with fee 0.016000000000 KRB or even 0.020000000000 KRB because minimum fee can change a little in next blocks, and become higher which will render tx invalid if it won't get into the block by that time.

For services accepting payments in KRB and finalizing transaction upon tx notification without network confirmations, it is recommended to at least check tx fee value against the current tx fee to see whether it has some margin.

The maximum value for minimum tx fee is 0.1 KRB or 100000000000 atomic units.

walletd

In walletd current minimal fee can be obtained from getStatus() JSON RPC method.

Output example:

{
  "id": "test",
  "jsonrpc": "2.0",
  "result": {
    "blockCount": 256739,
    "knownBlockCount": 256739,
    "lastBlockHash": "1ae2b3fd7351a84c775e3088869efcc8afe6424cc2bc0ba9bd448c542061099b",
    "minimalFee": 15645551732,
    "peerCount": 7
  }
}

node

To get the current fee from the karbowanecd daemon, the HTTP RPC API /getinfo method can be used. In response there is min_tx_fee parameter which contains minimum tx fee in atomic units and human-readable fee can be found in parameter readable_tx_fee.

Output example:

{
    "alt_blocks_count": 0,
    "difficulty": 35929735536,
    "fee_address": "KcKTTq9dxRJT5ZFqSWu2CGHNfLSwiwmov9s6zx7iYfMjgj2zzzhch6r4SAvZXR6HEGFw1WeKtEHpBGS5RpFVdn7CNYaRLnT",
    "grey_peerlist_size": 5000,
    "height": 256762,
    "incoming_connections_count": 0,
    "last_known_block_index": 256761,
    "min_tx_fee": 15662860155,
    "outgoing_connections_count": 3,
    "readable_tx_fee": "0.015662860155",
    "rpc_connections_count": 1,
    "start_time": 1532547548,
    "status": "OK",
    "top_block_hash": "8c731434fd331e4835bbe812e32981dd39c5c2065bff58b3d7cce9cf0ff630c1",
    "tx_count": 323026,
    "tx_pool_size": 8,
    "version": "1.5.3.800 (e2d974f)",
    "white_peerlist_size": 499
}

GUI wallets

In GUI wallets minimum tx fee is rounded up and set automatically at 'normal' priority which is 2x minimum fee. Users can send transactions with low priority at own risk.