Ah, it’s that time of the year where we gather ‘round, update our clients, and await the next Ethereum Hardfork. New features added to Ethereum are like celebrating your birthday: you get a bunch of cool stuff and upgrade your infrastructure (ok, maybe not the latter).

In this article, you’ll learn about Tenderly Forks, how to use them to simulate complex transactions, and what to do about the upcoming Berlin Hardfork.

The Fastest Way to Fork a Network

If there were a competition that measures the fastest way to fork a public network, without a doubt, Tenderly Forks would come on top. Forking is as simple as picking a name and block followed by clicking on Create.

Once you forked a public network of your choice, you can simulate Transaction without spending any gas. In addition to that, you can use all the Tenderly tooling for every simulated transaction on your private fork.

How to test a transaction without spending any gas

After you created your first fork, it’s time to roll up your sleeves, if you have any, and start submitting transactions. You can do so by opening your fork and then clicking on New Simulation. For this example, I’ll use the UniswapV2Router02 contract and simulate the swapExactTokensForTokens() function.

As you can see, you get all the information that you need to determine what would happen if you submitted the transaction on-chain.

In addition to that, I would like to point out the new Access List tab. Keep reading to learn more about the latest addition to the Tenderly tooling.

The Berlin Hardfork

The Berlin Hardfork has many EIPs in store for us (there is a pun hidden somewhere in there). Among them are a couple of gas repricing EIPs, but the one I want to focus on is EIP-2930: The Optional access lists. Here’s the verbatim summary:

Adds a transaction type which contains an access list, a list of addresses and storage keys that the transaction plans to access. Accesses outside the list are possible, but become more expensive.

The TL;DR is: if you send in advance which contracts and slots you’ll use, you’ll save on gas fees. The question now is: Which storage slots should I send?

Introducing the Access List Tool

If you’re reading this article, you’re probably more than aware of the current gas problems on the Ethereum mainnet. Thousands of developers are using the Tenderly gas profiler to optimize their Smart Contract’s gas usage. With the introduction of EIP-2930, Smart Contract developers have even more tools in their belt to save on gas fees.

But how to know which Access List was used for a particular transaction? Or the even harder question I asked in the last section: Which storage slots should you send with your transaction? This is where the Access List Tool comes in.

The Access List Tool tells you which Contracts and Storage Slots were pre-loaded. What’s even more impressive is that it tells which Access List is optimal for that particular transaction!

Let’s open the Access List tab for the Simulation we made a couple of minutes ago.

Not only do we see the pre-loaded slots, now we know how to save additional gas if we choose to submit this transaction on-chain! All of this is available via API as well!

API Access

You can use the Tenderly Forks via API! This is exactly what Instadapp used to create their DeFi Simulation Feature. Combining the JSON-RPC and REST API for Tenderly Forks gave their users a way to try Instadapp without spending any gas at all!

If you’re a Tenderly Pro user, you can contact us, and we’ll help you get started!

Tick tock

The clock is kind of ticking on this one. The Berlin Hardfork is scheduled for April 14th, so now is the time to warm up your keyboard and start testing your Smart Contracts!

Just like every article, thanks for staying with me until the end. As always, you can reach us on Discord, in-app Chat, or over at support@tenderly.co. Talk to you soon!