tip:196
title: Reward SRs with the transaction fees charged for bandwidth and Energy
author: sean liu <liu.sean@tron.network>
discussions to: https://github.com/tronprotocol/TIPs/issues/196
status: Final
type: Standards Track
category: core
created: 2020-12-06
Reward SRs with the transaction fees charged for bandwidth and Energy.
With the development of the TRON network, the TRON network ecosystem has become increasingly prosperous. At the same time, SR (Super Representatives) also need to consume more resources to maintain the entire network, which includes higher hardware demand and higher maintenance cost. The current rewards given to each SR include 16 TRX for block production and 160 TRX for voting. Compared with other public blockchains, the TRON network currently lacks the mechanism for rewarding SR with transaction fees. The transaction fee of the TRON network is mainly caused by energy and bandwidth consumption. Currently, all the transaction fee is transferred to the black hole account.
In order to further improve the stability and efficiency of the TRON network, it is proposed to increase the rewards for SRs. The transaction fees charged by energy and bandwidth consumption can be rewarded to SR, and they are distributed to voters like rewards for producing block. Transaction fees will increase the enthusiasm of SR to maintain the network. At the same time, the transaction fee mechanism can effectively prevent SR from producing blank blocks that contain 0 transactions.
Previously, in each transaction, if a user burned TRX to obtain energy and bandwidth, the transaction fee was directly transferred to the black hole, and now it is transferred to the fee pool. At the end of each block, the fee of all transactions in this block is rewarded to the block SR, which is the total number in the fee pool. The reward method is similar to the block reward.
In the storage method, add TRANSACTION_FEE_POOL to dynamicStore to store transaction fees.
private static final byte[] TRANSACTION_FEE_POOL = "TRANSACTION_FEE_POOL".getBytes();
In the TransactionInfo protocol, add packingFee to record the fee rewarded to the SR and voters.
message TransactionInfo {
...
int64 packingFee = 27;
}
In the process of transaction processing, the fee generated by each transaction, including bandwidth fee and energy fee, is directly transferred to TRANSACTION_FEE_POOL.
//bandwidth fee code
if (dynamicPropertiesStore.supportTransactionFeePool()) {
dynamicPropertiesStore.saveTransactionFeePool(dynamicPropertiesStore.getTransactionFeePool() + fee);
} else {
Commons.adjustBalance(accountStore, accountStore.getBlackhole().createDbKey(), +fee);
}
//energy fee code
if (dynamicPropertiesStore.supportTransactionFeePool() &&
!contractResult.equals(contractResult.OUT_OF_TIME)) {
dynamicPropertiesStore.saveTransactionFeePool(dynamicPropertiesStore.getTransactionFeePool() + energyFee);
} else {
//send to blackHole
Commons.adjustBalance(accountStore, accountStore.getBlackhole().getAddress().toByteArray(),energyFee);
}
For the fees of timeout smart contract transaction, it should continue to transfer them to the black hole account to avoid malicious SRs from deliberately setting the transaction overtime to obtain high fees.
When the block is packaged, all transaction fees in the TRANSACTION_FEE_POOL will be rewarded to the block-producing SR. If the SR adopts the default reward distribution method, then 20% of it will be transferred to the SR and 80% to the voters.
if (chainBaseManager.getDynamicPropertiesStore().supportTransactionFeePool()) {
long transactionFeeReward = Math
.floorDiv(chainBaseManager.getDynamicPropertiesStore().getTransactionFeePool(),
Constant.TRANSACTION_FEE_POOL_PERIOD);//Constant.TRANSACTION_FEE_POOL_PERIOD=1
mortgageService.payTransactionFeeReward(witnessCapsule.getAddress().toByteArray(),
transactionFeeReward);//reward distribution method
chainBaseManager.getDynamicPropertiesStore().saveTransactionFeePool(
chainBaseManager.getDynamicPropertiesStore().getTransactionFeePool()
- transactionFeeReward);
}
There are no backward compatibility concerns.
- Check the balance of the black hole account after the implementation of the new solution.
- Check the reward income of the SR.
- Check the recipient of fee for the timeout transaction.