-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zero Cost EthereumTransaction on Success #1084
Draft
Nana-EC
wants to merge
8
commits into
hashgraph:main
Choose a base branch
from
Nana-EC:ethtx-0-cost-on-success
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f770aa4
Zero Cost EthereumTransaction on Success
Nana-EC d1895b5
Set HIP number and Renamed file
Nana-EC 5ce9980
Fix requires line
Nana-EC 859a5e9
Added some clarity for due diligence
Nana-EC a3bd490
Updated Specification section
Nana-EC 5767eb6
Changes for clarity and list of examples
rbair23 1a5f46c
Merge pull request #4 from rbair23/zero-tx-rbair
Nana-EC 6ea815f
Touched up rbair Changes for clarity and list of examples. Thanks
Nana-EC File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
--- | ||
hip: 1084 | ||
title: Zero Cost EthereumTransaction on Success | ||
author: Nana Essilfie-Conduah <@Nana-EC>, Richard Bair <@rbair> | ||
working-group: Richard Bair <@rbair>, Atul Mahamuni <@atul-hedera>, Stanimir Stoyanov <[email protected]> | ||
requested-by: Relay Operators | ||
type: Standards Track | ||
category: Service | ||
needs-council-approval: Yes | ||
status: Draft | ||
created: 2024-11-20 | ||
discussions-to: https://github.com/hashgraph/hedera-improvement-proposal/discussions/1083 | ||
updated: 2024-11-20 | ||
requires: 410 | ||
--- | ||
|
||
## Abstract | ||
|
||
Updates the rules for charging fees for EthereumTransactions, so that the payer of an `EthereumTransaction` will only | ||
incur a fee if the transaction fails due diligence checks. | ||
|
||
## Motivation | ||
|
||
Today, relay operators must pay the `EthereumTransaction` HAPI fee for every transaction they submit on behalf of an | ||
Externally Owned Account (EOA). Currently, for every simple `EthereumTransaction`, this fee is the hbar equivalent of | ||
$0.0001, based on the exchange rate. Although this fee is very low, it effectively compels relay operators on Hedera | ||
to adopt a non-standard business model to cover these costs, which are then passed on to the users. Users are also | ||
burdened with understanding this more complex business model, which negatively impacts their experience. | ||
|
||
This situation acts as a friction point for EOAs looking to access cost-effective relay operators on the Hedera public | ||
network. | ||
|
||
## Rationale | ||
|
||
On Ethereum, all execution costs are paid for by the 'sender' who created, signed, and submitted the transaction. Hedera | ||
follows a similar approach for all `ContractCallTransaction`s but also charges an additional fee for each | ||
`EthereumTransaction` submitted via JSON-RPC relays. This fee serves as a defense against a malicious JSON-RPC relay that | ||
might send malformed transactions to the network, where there would be no one to pay for the processing of those transactions. | ||
This fee is unnecessary for successful transactions since the intrinsic gas fee covers the base costs (gossip & consensus). | ||
Therefore, this HIP proposes that the fee for submitting `EthereumTransactions` to the network should only be charged if the | ||
JSON-RPC relay submits a transaction that fails due diligence checks, such that the EOA cannot be charged for the overhead | ||
of gossip and consensus. | ||
|
||
## User stories | ||
|
||
1. As a relay operator, I want to submit an `EthereumTransaction` on behalf of an EOA without paying additional fees. | ||
2. As a node operator, I want to charge relays that submit transactions that cannot be charged to the EOA. | ||
3. As a user, I want to use the same pricing structure and have the same user experience for Hedera relays as with other | ||
networks. | ||
|
||
## Specification | ||
|
||
Definitions: | ||
- `evm tx`: The RLP encoded transaction bytes defined by the Ethereum yellow paper that form a standard Ethereum transaction | ||
- `relay`: A system that, given an `evm tx`, wraps it in an HAPI `EthereumTransaction` and submits it to Hedera. | ||
This is also the `payer` for the `EthereumTransaction`. See | ||
[TransactionBody.transactionID](https://github.com/hashgraph/hedera-protobufs/blob/main/services/transaction_body.proto#L104) | ||
- `EOA`: The account that created and signed the `evm tx` and submitted it to a `relay`. This is the `from` in the | ||
[Ethereum Transaction Schema](https://github.com/ethereum/execution-apis/blob/main/src/eth/transaction.yaml) | ||
often noted as (tx.from) | ||
|
||
### Smart Contract Creation and Execution Transactions | ||
|
||
The `relay` will **only** be charged if handling of the `EthereumTransaction` fails **before** any bytecodes are executed. | ||
In other words, the `relay` is charged when one of the pre-requisite checks for `EthereumTransaction` fails, regardless of | ||
the execution status of the transaction itself once it begins smart contract creation or execution in the EVM. | ||
|
||
Examples: | ||
- The `relay` is charged if the `evm tx` cannot be parsed or is otherwise malformed | ||
- The `relay` is charged if the `EOA` specified in the `evm tx` refers to a non-existent account | ||
- The `relay` is charged if the `evm tx` was not properly signed by the keys of the `EOA` | ||
- The `relay` is charged if the `EOA` has insufficient funds to pay the intrinsic gas fee | ||
- The `relay` is charged if the `nonce` check fails | ||
- The `relay` is not charged if the contract is called but concludes with an error code | ||
- The `relay` is not charged if the contract is called and concludes without error | ||
|
||
### Regular Transactions | ||
|
||
A "regular transaction" is a simple HBAR crypto transfer between two accounts. The `relay` will be charged for **any** | ||
failure of the transaction. This is required to maintain compatibility with the semantics in Ethereum, where a regular | ||
transaction will not be included in a block or executed if it will not succeed. | ||
|
||
Example: | ||
- The `relay` is charged if the `evm tx` cannot be parsed or is otherwise malformed | ||
- The `relay` is charged if the `EOA` specified in the `evm tx` refers to a non-existent account | ||
- The `relay` is charged if the `evm tx` was not properly signed by the keys of the `EOA` | ||
- The `relay` is charged if the `EOA` has insufficient funds to pay the intrinsic gas fee **and** the transfer | ||
- The `relay` is charged if the receiver has `receiverSigRequired` enabled | ||
- The `relay` is charged if the receiver doesn't exist, must be auto-created, and the `EOA` has insufficient funds to | ||
pay for the account creation | ||
- The `relay` is charged if the `nonce` check fails | ||
|
||
## Backwards Compatibility | ||
|
||
No changes to transaction execution or record stream externalization is made in this HIP. | ||
`EthereumTransaction` will continue to work and will only see a reduction in cost on success cases. | ||
|
||
## Security Implications | ||
|
||
No changes in security. | ||
|
||
## References | ||
|
||
- [EthereumTransaction protobuf specification](https://github.com/hashgraph/hedera-protobufs/blob/main/services/ethereum_transaction.proto) | ||
- [Hedera JSON RPC Relay](https://docs.hedera.com/hedera/core-concepts/smart-contracts/json-rpc-relay) | ||
- [HIP 410](https://hips.hedera.com/hip/hip-410) | ||
|
||
## Copyright/license | ||
|
||
This document is licensed under the Apache License, Version 2.0 -- see [LICENSE](../LICENSE) or | ||
(https://www.apache.org/licenses/LICENSE-2.0) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This indeed highlights a list of prechecks performed by the Relay to validate transactions and reject them if any conditions are met, ensuring they are not forwarded to the network unnecessarily, thus avoiding charges. Notably, the Hedera JSON-RPC Relay already handles and rejects these scenarios. However, there are additional prechecks currently performed by the Relay that are not mentioned here:
I recommend considering these prechecks and including them in this HIP for greater clarity and completeness.