Hello is there any class or function where I can control the fees of stellar?
How much fee and where it goes ... etc
if you are using JS-Stellar-SDK, you may refer to this format: (for example, fee=478)
var StellarSdk = require('stellar-sdk');
var server = new StellarSdk.Server('https://horizon-testnet.stellar.org');
new StellarSdk.TransactionBuilder(sourceAccount, opts={fee:478})
.addOperation(StellarSdk.Operation.payment({ destination: destinationId, asset: StellarSdk.Asset.native(), amount: "1" })) .build()
The default fee is 100 stroops, and all the fee goes for inflation.
You can specify a custom fee, greater than default. It may give you a benefit in some rare cases. If the fee amount is less than default (0.00001 XLM per each operation included into transaction), the transaction will be rejected.
As @cesar mak mentioned above, fees are collected by the Inflation Poll and then distributed to inflation voting destinations.
Is it possible to make that fee goes to a specific account instead of inflate?
No, it's not possible. Fee mechanics is specifically designed to protect the network from spamming.
Is it possible to make that fee goes to a specific account instead of inflating?
So what I understood (happy to be counter attacked) is you can set inflation destination using set_option operation. Which basically means that, you are voting this guy (inflation destination) to receive fee when inflation happens. I am not sure if it will work in case of public network or not since there will be multiple such voted accounts.
look at here :
Using the set options operation, every account selects another account as its inflation destination or nominee to receive new currency. The inflation destination will persist until changed with another set options operation.
The inflation funds are sent to an address chosen by the network to receive it each week.
Hey if you want to change fee in the stellar-core code base for the purpose of private stellar network, you can do it from LedgerManagerImpl.cpp
file. It has method called, startNewLedger()
. What you can do is, take a key (say MY_CUSTOM_FEE
) in config file and set it in here something like this to start with new configuration.
void
LedgerManagerImpl::startNewLedger()
{
auto ledger = genesisLedger();
auto const& cfg = mApp.getConfig();
if (cfg.USE_CONFIG_FOR_GENESIS)
{
ledger.ledgerVersion = cfg.LEDGER_PROTOCOL_VERSION;
ledger.baseFee = cfg.TESTING_UPGRADE_DESIRED_FEE;
ledger.baseReserve = cfg.TESTING_UPGRADE_RESERVE;
ledger.maxTxSetSize = cfg.TESTING_UPGRADE_MAX_TX_SET_SIZE;
}
if(cfg.CUSTOM_CONFIG)
{
CLOG(INFO, "Ledger") << "********************";
CLOG(INFO, "Ledger") << "Custom config params are set";
CLOG(INFO, "Ledger") << "********************";
ledger.baseFee = cfg.MY_CUSTOM_FEE;
}
startNewLedger(ledger);
}
else you can directly go ahead and change the genesis parameters.