Bee treats ENS as a first class citizen, wherever you can use a Swarm reference, you can also use an ENS domain where the
content ENS Resolver record is set to be a
You may substitute ENS names for Swarm references in any of the API methods where you would normally use a Swarm reference.
In order to resolve ENS names using your API endpoints, you must specify a valid ENS resolver endpoint when starting your Bee node. We recommend that users run their own Geth node, which can be trusted absolutely, however service providers such as https://cloudflare-eth.com or Infura may suffice. Public gateways such as gateway.ethswarm.org will also usually provide ENS resolution.
If specifying using your
bee.yaml configuration file, the syntax is as follows.
Once you have restarted your node, you should be able to see the Swarm homepage at:
resolver-options flag to point the bee resolver to any ENS compatible smart-contract on any EVM compatible chain
:::warn Make sure you trust the gateway you are interacting with! To ensure that you are retrieving the correct content, run your own ENS resolver and Bee node. :::
First we will need to upload the website assets to Swarm in order to get its Swarm reference hash, see uploading a directory for more information.
This time we will also include the
Swarm-Index-Document header set to the
index.html. This will cause Bee to serve each directories
index.html file as default when browsing to the directory root
/ url. We will also provide a custom error page, using the
index.html page for both settings.
Next, we add a
Content record to your ENS domain's resolver contract.
Once you have registered your name, and have connected Metamask with the relevant Ethereum account, you must first set the resolver to use the public ENS if you have not already done so.
First, navigate to 'My Names', and select the name you would like to link your Swarm content to.
Press 'Set' next to your resolver record.
Choose the public resolver.
Press add a record.
Choose the Content Record type from the drop down menu.
Add the Swarm reference you created earlier and press 'save'.
Verify the Content Record has been created!
Now you will be able to see your website hosted using the ENS name instead of the Swarm Reference!