ERC 4804: HTTP for Blockchains

Akalanka Pathirage
Coinmonks
4 min readApr 7, 2023

--

Image source: https://w3url.w3eth.io/

If you want to access content stored on a centralized server, you can use HTTP and DNS to locate, request, and receive content. But what if you want to access content stored on a decentralized system like the Ethereum blockchain? Let’s say you want to access an SVG file stored on-chain. You would have to call a function in a smart contract that returns the SVG, and then you would have to render it. In doing this, you will most likely use Etherscan or some node service provider as a proxy to communicate with the blockchain.

So you have no way to locate resources in an end-to-end decentralized way as you have in Web2. You can use HTTP or IPFS to create a URL that will render the SVG directly. That is what cyber brokers and moon birds have done. Even though their NFTs are stored on-chain, they render the images off-chain via HTTP or IPFS. I mean this kind of defeats the purpose of storing the images on-chain.

And apps like Uniswap claim they are decentralized, but in reality, they are not. To access their frontend, users have to go through DNS. Which means access to the application can be censored. Look, For better or worse one of the major aspects of DApps is to be decentralized. To be able to resist censorship. This can be done by storing the HTML file of the DApp on-chain.

The solution

So what we need is a more efficient way to access on-chain resources, and that’s precisely what ERC 4804 provides. This is an IANA-registered scheme, proposed by ETHStorage’s founder Qi Zhou and co-authored with Ethereum researcher Sam Wilson. The standard aims to provide a simple way for Web2 users to directly access the content of Web3, especially on-chain Web content such as SVG/HTML. With ERC 4804, users can locate resources on the blockchain in a decentralized way, just as HTTP and DNS locate resources on centralized servers. This standard integrates ENS to offer human-readable URLs, instead of consisting solely of contract addresses.

All users have to do is just type URLs starting with web3:// instead of https:// . The rest will be handled by a browser extension acting as a light client. It will parse the URI and get things like the destination address and function call data. It will translate the HTTP-like URI ( RFC 2396 URI ) to an EVM message. Then will send the message and get what’s returned from the smart contract, say SVG or HTML doc, and then renders it in the browser.

For instance, the web3://uniswap.eth locates the address of uniswap.eth via ENS. Then, the protocol calls the address with empty call data, which triggers the fallback function in the smart contract. This function should return a file, such as an HTML document, that can be rendered in the browser.

Image source: https://w3url.w3eth.io/#/

This is a basic example of the protocol, considering default conditions. The protocol supports specifying chainIDs, from addresses, function names, and arguments. See here and here for a detailed explanation of the modes of resolving the Web3 URLs.

Currently, a Firefox extension is available for the job. Also, there is an HTTP gateway created to access web3 URLs as a temporary measure. The authors of the standard envision this won’t be required when there are enough browser extensions that support this protocol.

So this solution to access on-chain resources is not only a decentralized way but also a convenient way for users. Just like using familiar HTTP protocol for locating, requesting, and receiving resources.

Drawbacks

Of course, this might not be a practical solution for most applications on the ETH mainnet. Anthurine Xiang, a spokesperson for layer-2 storage protocol ETHStorage stated that 1GB of storage on the blockchain will cost approximately $10 million! He continued noting that layer-2 storage solutions might help mitigate some of the costs.

Just like with everything, decentralization is also in a spectrum. So using a combination of centralized and decentralized approaches might be the way for most of the apps in the Web3 space. However, platforms that run into censorship issues might consider the ERC-4804 protocol as the savior standard for their DApps. Also if you are planning to launch a shiny new NFT collection with 100 percent on-chain assets then this might be the cherry on top.

Sources

New to trading? Try crypto trading bots or copy trading on best crypto exchanges

Join Coinmonks Telegram Channel and Youtube Channel get daily Crypto News

Also, Read

--

--