Skip to content

Write EIP 2935 Gas Comparison Guide#121

Open
IchiBera wants to merge 11 commits intomainfrom
eip2935-gas-comparison
Open

Write EIP 2935 Gas Comparison Guide#121
IchiBera wants to merge 11 commits intomainfrom
eip2935-gas-comparison

Conversation

@IchiBera
Copy link
Contributor

@IchiBera IchiBera commented Jun 3, 2025

Guide Contribution PR

Description

This quickstart covers EIP-2935, an EIP focused on historical block hashes from state, and how it enables gas optimizations for applications building on Berachain. It is part of the Bectra upgrade, which brings Ethereum’s Pectra-era EIPs to Berachain.

This guide specifically shows obtaining a historic blockhash using the power of EIP-2935 and its system contracts, all on Bepolia. This can be done on Berachain as well.

Type of Change

  • ✨ New guide/example

Guide Details

  • Guide Name: EIP-2935 Gas-Efficient Blockhash Access for Berachain Developers
  • Category: Smart Contracts
  • Dependencies Added:
  • Network(s) Used: (e.g., Bepolia, Mainnet, Local)
  • Entry Point: README

Checklist

  • The guide/example is clear and easy to follow
  • All steps are reproducible (instructions/scripts work as described)
  • All new/changed code is commented where necessary
  • Documentation is updated (README, inline docs, etc.)
  • No sensitive information or secrets are included
  • Example runs without errors or warnings
  • (If applicable) Screenshots or output are included for clarity

Additional Notes

@IchiBera IchiBera self-assigned this Jun 3, 2025
@IchiBera
Copy link
Contributor Author

IchiBera commented Jun 3, 2025

@codingwithmanny @okjintao I am cleaning up the README tonight and preparing an X thread alongside my other guide. I will migrate the README.md from here to the docs repo as well and just have a quickstart in here. That all said, I wanted to push it as is because I wanted to make sure everything looks like it is in the right direction functionally.

The system contract that is associated to EIP-2935 is not shown anywhere that I could see. I'll message the smart contract team too to double check on it. To showcase the gas savings though, one can do it with a mock system contract, which is what I did.

@IchiBera IchiBera changed the title Write initial draft of EIP 2935 Gas Comparison guide Write EIP 2935 Gas Comparison Guide Jun 5, 2025
@IchiBera IchiBera marked this pull request as ready for review June 5, 2025 21:18
@IchiBera
Copy link
Contributor Author

IchiBera commented Jun 5, 2025

Should be all good, but I gotta do a fresh clone of the repo and run it to ensure robustness.

Copy link
Contributor

@okjintao okjintao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we show how you can leverage these using viem?


This quickstart covers [EIP-2935, _an EIP focused on historical block hashes from state_,](https://eips.ethereum.org/EIPS/eip-2935) and how it enables gas optimizations for applications building on Berachain. It is part of the [Bectra upgrade](https://x.com/berachain/status/1930326162577776655), which brings Ethereum’s Pectra-era EIPs to Berachain.

A more detailed version of this guide, with context on EIP-2935, can be found within our [docs](https://docs.berachain.com/developers/).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should have the real link. this is a bit weird to me since the docs should just be explaining vs. guide so just more for more information on eip 2935 maybe

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding was it was the opposite:

  • docs would have the detailed explanation, including EIP2935 context etc.
  • guide was a quickstart with the code and everything.

This was based on what Manny had requested from me for EIP7702, but maybe I misinterpreted, or it really should be the other way around.

As for the link, I can't update it until the docs PR is merged and vice versa. Then I'd have the proper docs URL to put in. I guess I can put in what it should be ahead of time.

@IchiBera
Copy link
Contributor Author

IchiBera commented Jun 9, 2025

@okjintao Thank you for the review! I made the changes you've outlined for the most part. Only need to sync up on how the docs should differ vs the guides repo write-ups. As well:

should we show how you can leverage these using viem?

As per this question, I think the scope was just to showcase the gas savings. If you think viem would be really helpful for this though, then I'm open to it.

Copy link
Contributor

@okjintao okjintao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm will let @codingwithmanny merge, wrt the guide vs. docs i meant more just like the docs should reference this and the guides are complimentary vs. the docs being a superset of the guides.

IchiBera and others added 2 commits June 9, 2025 19:54
Signed-off-by: Ichiraku Bera <209535819+IchiBera@users.noreply.github.com>
@IchiBera IchiBera added the bug Something isn't working label Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants