Lock your IPFS website deployments to versioned ENS subdomains for ultimate decentralization
The inspiration behind this idea came from Micah Zoltu's concern with people accessing the Tornado Cash website via the ENS name tornadocash.eth after the DAO was attacked. More context: https://twitter.com/MicahZoltu/status/1660096315416793090
This made me realize that a versioned approach to deploying decentralized frontends for web3 protocols might be the safer move so that the contents can never be changed. Rather than pointing everyone towards tornadocash.eth.limo (https://eth.limo/ is one of a few gateways that people use to access the decentralized websites attached to .eth names), let's deploy v1.tornadocash.eth and lock that forever. When a significant change is ready, that should be deployed to v2.tornadocash.eth and so on.
The ideal decentralized website should only contain mission-critical information and be as standalone as possible, so frequent updates aren't likely on this type of deployment.
To accomplish this, I'm using the ENS NameWrapper with two special contracts; a resolver and subname renewal manager, both recently created by serenae.eth unrelated to ETHGlobal Waterloo. My hack is a frontend to tie all the pieces together.
Here's exactly how it works:
Step 1: Check if a given .eth name is wrapped Step 2: Allow anyone to renew subnames of the given .eth name by approving the subname renewal manager for the NFT's token id Step 3: Burn the ability for anyone to change the subname renewal manager in the future Step 4: Create the first versioned subname Step 5: Set the contenthash record on the subname Step 6: Lock the contenthash record on the subname using the custom resolver contract
My stack for this project's frontend was Vite + React + RainbowKit + viem + wagmi on the tech side, and thorin (ENS's component library) on the design side. I originally started building this in Next.js, but moved away to Vite to ultimately ship a light page bundle.
The core functionality of decentralized websites is powered by IPFS and ENS.