Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article examines ERC-7618, which proposes decoding compressed resources before delivering them to clients in ERC-5219 resolution mode.
This explanation translates, summarizes, and expands on the following specification.
For more EIPs, see https://cardene.dev/proposals.
Overview
The standard extends the resolution mode defined by ERC-6944 within the ERC-6860 Web3 URL standard.
For ERC-6860, see the following article.
ERC-6860 Explained: Accessing On-chain Content Through HTTP-style Web3 URLs
For ERC-6944, see the following article.
ERC-6944 Explained: Specifying How Contracts Handle Resource Requests
When a call to request() returns a Content-Encoding header, the proposal specifies how the returned data is decoded using the indicated algorithm before delivery to the client, when necessary.
Reading the related ERC-7617 proposal can also help clarify this mechanism.
ERC-7617 Explained: Retrieving Large Resources in Chunks
Motivation
Blockchain storage is expensive, making compression useful for storing and serving data.
Transaction Costs
Writing data incurs gas costs, which depend on data volume and network conditions. Large amounts of data can be expensive to store.
Storage Write Limits
Transaction gas limits constrain how much data can be written at once; writing too much may cause a transaction to fail.
Standard HTTP uses Accept-Encoding/Content-Encoding negotiation: the client sends its supported algorithms and the server returns data compressed with one of them. Applying this directly to web3:// is not ideal because of blockchain storage and computation constraints. Fixed Content-Encoding also creates compatibility problems when HTTP clients do not support that encoding.
The proposal addresses this in two ways.
- Specify supported compression algorithms. The protocol defines a list of supported algorithms.
- Decompress at the protocol layer. Decode compressed data before delivering it to clients requiring uncompressed content.
This allows compressed data to be stored and delivered in a compatible form.
Specification
ERC-7618 extends the ERC-6944 resolution mechanism to handle compression and decompression in web3://.
Checking Content-Encoding and Decoding
If the client request has no Accept-Encoding, or the encoding specified by Content-Encoding is not accepted by the client, the protocol decodes the content before forwarding it.
The supported algorithms are:
- gzip
- br (brotli)
Handling Unsupported Compression Algorithms
If decoding is required and the specified algorithm is unsupported by the protocol, an unsupported content encoding error must be returned.
Delivering Decoded Data
After decoding, the decompressed data is sent to the client without the original Content-Encoding header.
Processing Flow
- Receive the client request. The client sends a web3:// request. Accept-Encoding, when present, specifies accepted algorithms.
- Receive the response. Content-Encoding indicates the algorithm used to encode the data.
- Decode at the protocol layer. Compare Content-Encoding with Accept-Encoding. Decode if the encoding is not accepted or Accept-Encoding is absent.
- Handle errors. When decoding is necessary and the algorithm is neither gzip nor br, return an error.
- Deliver data. Send the decoded data without Content-Encoding.
Additional Considerations
This feature can be introduced without changing the interface, so it extends ERC-6944's resolution mode. To stay close to HTTP, it reuses Content-Encoding rather than introducing a new header.
Citation
Qi Zhou (@qizhou), Nicolas Deschildre (@nand2), "ERC-7618: Content encoding in ERC-5219 mode Web3 URL [DRAFT]," Ethereum Improvement Proposals, no. 7618, February 2024. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7618.
Conclusion
ERC-7618 enables compressed resources in ERC-5219 resolution mode to be decoded before delivery when clients do not accept their encoding.
Further reading and author links:




