# Contract Fees --- eip: xxxx title: Contract Fees description: Mechanism to redistribute fee's spent on contract interactions back to the contract creators. discussions-to: todo status: Draft type: Standards Track category: Core created: 2022-06-06 requires: 1559 --- ## Abstract This proposal specifies a mechanism for redistributing a portion of the gas fee's burned, via eip1559, during a contract interaction to the contract creator. ## Motivation Developers in the wider blockchain space are constantly faced with the dilemma of how to generate revenue for themselves. Although token based approaches work great, they can help promote a thriving community, they also face risk of speculation and potential legal issues. Providing developers with a new way to generaet income directly via the base layer can alleviate unecessary governance tokens, and fee models, while driving direct value back to the user. ## Specification The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY" and "OPTIONAL" in this document are to be interpreted as described in RFC 2119. ### Terms - `gas_burned`: The amount of gas from a transaction that is burnt via the baseFee calculation. - `contract_fee`: The amount of ETH collected from a transaction that is paid to the contract creator. - `contract_fee_percentage`: A constant value representing the percentage of the total `gas_burned` that will be debited to the contract creator. - `fee_recipient`: The account that will receive the funds. ### Contract Creation During contract creation the parameter`fee_recipient` will be set to a valid ethereum address. Contract creation should revert if the value of `fee_recipient` is not a valid public key. ### Fee Calculation Once a transaction has been executed, the EVM would calculate `gas_burned` * `contract_fee_percentage` to determine the `contract_fee`. The `contract_fee` would then be debited to the `fee_recipient` as specified by the contract during contract creation. ### Contract Fee Percentage TODO, perhaps 30% of the gas burned? ### Thoughts @todo: remove - Check for all contract called, or just whats specified as the `to` address within a the transaction? - Probably just the `to` execution time of the EVM might jump quite dramatically if we have to calculate gas used at every step. Also trying to keep track of that is a bit complex and makes this EIP significantly more complex than it needs to be. - New opcode (create3) or a new transaction type (type-3)? ## Rationale This specification aims to find alternative ways for builders and proejcts in Ethereum to earn recenue streams based on how usefull the contract is to the ecosystem. Ethereum is approaching a deflationary monetary supply, and by carefully adjusting some of the parameters set by EIP-1559, we can continue to maintain it while rewarding builders. This specification can enable a nunber of things: - Builders willingness to deploy utility contracts. - A DEX could remove fee's and the `contract_fee` as a way to pay liquidity providers making markets more efficient. - Cross-chain bridges *could* avoid taking fee's, and benefit directly from the `contract_fee`. - Developers could have their `contract_fees` funnelled to a 0xSplit to help fund Protocol Development or other grants to help fuel the economy. (i.e if the WETH contract had this, there could be millions in dollars funding teams). - **Note:** Inspiration for this EIP came from the Near Protocol's implementation of [Runtime Fees](https://nomicon.io/RuntimeSpec/Fees/). ## Security Considerations Further research into how this affects the fee mechanics around 1559. ## Copyright Copyright and related rights waived via [CC0](../LICENSE.md).