• Forum has been upgraded, all links, images, etc are as they were. Please see Official Announcements for more information

DASH | Where in the code is the fee calculated?

Student101

New member
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();
 
Last edited:
Hello Friends,

Are any forum members here familiar enough with the actual source code and C++ to copy/paste the code where the fees are calculated based on the transaction size? I am experimenting with some mathematics and would like to see what a sustainable model would be, if Miners and Masternodes were to strictly survive off of transaction fees
The GetBlockSubsidy() logic would be a good place to start. May have to do some digging from there.
 
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?
 
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.
 
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;
 
Back
Top