Welcome to the Dash Forum!

Please sign up to discuss the most innovative cryptocurrency!

DASH | Where in the code is the fee calculated?

Discussion in 'Development Tech Discussion' started by Student101, Jun 4, 2018.

  1. Student101

    Student101 New Member

    Joined:
    Jun 1, 2018
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Hello Friends,

    I am doing some mathematics to determine the future predicted ROI% of DASH Masternodes once all 18,900,000 DASH are in circulation and Masternodes must survive strictly off transaction fees associated with payments, can any expert members post the exact lines of code in Main.cpp that determine the rate of each fees transaction? I found the line below that calculates the fee, however I see no option to edit any values which would raise fees to make owning Masternodes still profitable

    Transaction fees are calculated using

    nFees += view.GetValueIn(tx)-tx.GetValueOut();
     
    #1 Student101, Jun 4, 2018
    Last edited: Jun 6, 2018
  2. thephez

    thephez Member
    Dash Core Team

    Joined:
    Jan 23, 2016
    Messages:
    113
    Likes Received:
    49
    Trophy Points:
    78
    The GetBlockSubsidy() logic would be a good place to start. May have to do some digging from there.
     
    • Like Like x 1
  3. Student101

    Student101 New Member

    Joined:
    Jun 1, 2018
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Thank you for your reply, after looking through the lines of code, it seems to repeat the fact that the fees are calculated from

    fee = view.GetValueIn(tx); - tx.GetValueOut();

    nFees += view.GetValueIn(tx)-tx.GetValueOut();



    // Tally transaction fees
    CAmount nTxFee = nValueIn - tx.GetValueOut();



    What values in the code would the Dash team edit to raise the transaction fees?
     
  4. thephez

    thephez Member
    Dash Core Team

    Joined:
    Jan 23, 2016
    Messages:
    113
    Likes Received:
    49
    Trophy Points:
    78
    Oh, I see what you mean. I think that logic is changing in 12.3 and I am not very familiar with it. You could try looking at the fee and policy related code in this folder.
     
    • Like Like x 1
  5. Student101

    Student101 New Member

    Joined:
    Jun 1, 2018
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Thank you,

    class CCoinsViewCache;

    /** Default for -blockmaxsize, which controls the maximum size of block the mining code will create **/
    static const unsigned int DEFAULT_BLOCK_MAX_SIZE = 2000000;
    /** Default for -blockprioritysize, maximum space for zero/low-fee transactions **/
    static const unsigned int DEFAULT_BLOCK_PRIORITY_SIZE = 10000; // was 50000 in 0.12.0 and it is 0 in Bitcoin since 0.12
    /** Default for -blockmintxfee, which sets the minimum feerate for a transaction in blocks created by mining code **/
    static const unsigned int DEFAULT_BLOCK_MIN_TX_FEE = 1000;
    /** The maximum size for transactions we're willing to relay/mine */
    static const unsigned int MAX_STANDARD_TX_SIZE = 100000;
    /** Maximum number of signature check operations in an IsStandard() P2SH script */
    static const unsigned int MAX_P2SH_SIGOPS = 15;
    /** The maximum number of sigops we're willing to relay/mine in a single tx */
    static const unsigned int MAX_STANDARD_TX_SIGOPS = 4000;
    /** Default for -maxmempool, maximum megabytes of mempool memory usage */
    static const unsigned int DEFAULT_MAX_MEMPOOL_SIZE = 300;
    /** Default for -incrementalrelayfee, which sets the minimum feerate increase for mempool limiting or BIP 125 replacement **/
    static const unsigned int DEFAULT_INCREMENTAL_RELAY_FEE = 1000;
    /** Min feerate for defining dust. Historically this has been the same as the
    * minRelayTxFee, however changing the dust limit changes which transactions are
    * standard and should be done with care and ideally rarely. It makes sense to
    * only increase the dust limit after prior releases were already not creating
    * outputs below the new threshold */
    static const unsigned int DUST_RELAY_TX_FEE = 1000;