Tap to Trade in Gate Square, Win up to 50 GT & Merch!
Click the trading widget in Gate Square content, complete a transaction, and take home 50 GT, Position Experience Vouchers, or exclusive Spring Festival merchandise.
Click the registration link to join
https://www.gate.com/questionnaire/7401
Enter Gate Square daily and click any trading pair or trading card within the content to complete a transaction. The top 10 users by trading volume will win GT, Gate merchandise boxes, position experience vouchers, and more.
The top prize: 50 GT.
 and vice versa.
As powerful as this approach is, it stems from a very simple assumption: lower fees = good. We want our ecosystem to be the most accessible: the easiest, the most fun, with the lowest construction and transaction costs.
Ultimately, the Bedrock upgrade will bring a 47% reduction in protocol costs and security fees to the Optimism mainnet. Read on to learn how we made it happen.
Where does the fee come from?
Fees for sending transactions on the Optimism mainnet come from two sources: L2 (Layer 2 Network) Execution Fees and L1 Data/Security Fees.
L2 execution fees are similar to how regular transaction fees work on Ethereum, but with the added advantage that execution gas prices on Optimism mainnet are very low since the network is not as congested as L1.
L1 data fee is because all transactions on Optimism are also posted to Ethereum. This step is critical to the security of Optimism, as it means that all data needed to sync Optimism nodes is always publicly available on Ethereum. This makes Optimism an L2. Users on Optimism have to pay a fee to submit their transactions to Ethereum. Since the gas fee on Ethereum is very expensive, L1 data fee occupies a large part of the total transaction cost on the Optimism mainnet.
Looking for improvements
Early in Bedrock’s development, we were able to identify several areas that were causing unnecessary costs to users. In particular, Optimism’s legacy system was designed in such a way that it did not use the L1 data space as efficiently as possible. For example, the pre-Bedrock system that published data to Ethereum simply added as many transactions as possible into a compressed data bundle that could fill a single L1 transaction.
To solve this problem, the most logical place to start is to try improve the efficiency of compressing large amounts of data published to Ethereum. We also found that reorganizing the way data is sent from Optimism to L1 maximizes the use of available data space on L1.
Iteration of repair methods
Once we had a proof-of-concept of submitting transaction groups composed of compressed data that brought us closer to our goal, we focused on optimizing this approach.
Among the key constraints guiding development is the need to split the body of an L2 block into multiple L1 transactions. If someone submits a large transaction to L2, it may need to be split to fit in L1 Calldata. In addition, the algorithm we use to compress the data, the more data input, the better the compression ratio. To address this constraint and maximize the compression ratio, we design a system that can exploit these properties.
Batch and compress data
The key building block of this system is batch processing. Batch is a wire format designed to minimize the cost and software complexity of writing to L1. Traditional blocks are turned into batches, eliminating as much extra information as possible and keeping only the necessary, small amount of metadata.
Next, the list of L2 transactions known as sequence batches is compressed into so-called channels. Each channel has a maximum size (initially about 9.5Mb). These channels will be compressed using a compression algorithm before committing to L1. Compressing large batches into each pass is where we get good compression ratios efficiently.
Channels are further divided into channel frames. This is the part that helps us address the key constraints mentioned above. Slicing channels into frames allows us to handle very large L2 transactions by sending them to L1 in parallel, thus filling up as much as possible with corresponding L1 transactions.
Compression algorithm
When choosing a compression algorithm, we considered candidates such as zstd, brotli, and LZW, but ultimately chose zlib because it provided good performance for our needs.
Good performance in this case means the right balance between a good compression ratio and a good compression and decompression speed that we are trying to achieve. This reflects the typical trade-off in choosing a compression algorithm: speed/compression ratio performance.
Minimize the use of Ethereum Gas
The last part that helps to reduce the cost is that Bedrock removes all execution gas, reducing the L1 data cost to the theoretical minimum. We discuss this in depth in the Bedrock explainer.
Here is an excerpt:
Cost reduction by numbers
After the Bedrock upgrade, we expect a ** protocol cost/security fee reduction of 47%**, including 99% of state chain commitments and 20% of batch commit costs.
We’ll post an update via the OP Labs twitter account after the upgrade, including post-Bedrock numbers (which will show how accurate our predictions are), so keep an eye out.
Next Steps: Fee Optimization and EIP-4844
We take great pride in the designs and solutions we build to keep Bedrock posting costs down. This is a result of our team leaning towards solid engineering fundamentals and executing them cleanly.
Our team is continuing to optimize fees to reduce L2 data fees, so expect to see this in a release after Bedrock. One of the specific things we can do is time batch submissions so that batches are guaranteed to be submitted within a certain time window (say 10 minutes), and we can submit batches when the fee is lowest during those 10 minutes.
Even more exciting is that EIP-4844 will soon be incorporated into Ethereum. When that time comes, the cost of publishing data to L1 will be further reduced.
If this post got you excited about building on Optimism, check out our documentation on how to contribute to the community. Additionally, our Bedrock explainer details many of the exciting features coming with the Bedrock release.