ENS (Ethereum Name Service)
Connect your Alternate Futures sites to Ethereum Name Service (ENS) domains for decentralized, human-readable URLs.
What is ENS?
ENS (Ethereum Name Service) is a distributed, open naming system based on the Ethereum blockchain. It allows you to:
- Map human-readable names (like
mysite.eth) to content hashes - Point ENS domains to your IPFS/IPNS content
- Create truly decentralized websites accessible via ENS-compatible browsers
Prerequisites
- An ENS domain you own (e.g., purchased from app.ens.domains)
- A deployed site with an IPNS record
- Access to manage your ENS domain's content hash
Creating an ENS Record
# Create an ENS record for your site
af ens create
# You'll be prompted for:
# - ENS name (e.g., mysite.eth)
# - Site to link
# - IPNS record to useimport { AlternateFuturesSdk } from '@alternatefutures/sdk/node';
const af = new AlternateFuturesSdk({
personalAccessToken: process.env.AF_TOKEN
});
// Create an ENS record
const ensRecord = await af.ens().create({
name: 'mysite.eth',
siteId: 'site-id',
ipnsRecordId: 'ipns-record-id'
});
console.log('ENS Record created:', ensRecord.name);
console.log('Content hash:', ensRecord.ipnsRecord.hash);Listing ENS Records
# List all ENS records
af ens list// List all ENS records
const records = await af.ens().list();
records.forEach(record => {
console.log(`${record.name} -> ${record.ipnsRecord.name}`);
console.log(`Status: ${record.status}`);
});Viewing ENS Record Details
# Get details for a specific ENS record
af ens detail
# You'll be prompted to select the ENS record// Get ENS record by name
const record = await af.ens().getByName({ name: 'mysite.eth' });
console.log('ENS Name:', record.name);
console.log('IPNS Name:', record.ipnsRecord.name);
console.log('Content Hash:', record.ipnsRecord.hash);
console.log('Status:', record.status);Verifying ENS Setup
After creating an ENS record, you need to manually update your ENS domain's content hash:
# Verify your ENS setup
af ens verify
# This checks if your ENS domain's content hash
# matches the IPNS record from Alternate Futures// Get the content hash you need to set
const record = await af.ens().getByName({ name: 'mysite.eth' });
console.log('Set your ENS content hash to:', record.ipnsRecord.hash);
// The SDK doesn't automatically update ENS
// You must do this manually via ENS interfaceSetting Up ENS Content Hash
Get your IPNS hash from Alternate Futures:
bashaf ens detail # Note the IPNS hash (starts with /ipns/...)Go to ENS Manager at app.ens.domains
Find your domain and click "Set Content Hash"
Paste the IPNS hash from step 1
Confirm the transaction on Ethereum
Verify the setup:
bashaf ens verify
Deleting an ENS Record
# Delete an ENS record
af ens delete
# You'll be prompted to select which ENS record to delete// Delete an ENS record
await af.ens().delete({ id: 'ens-record-id' });How ENS Integration Works
graph LR
A[Your Site] --> B[IPFS Deployment]
B --> C[IPNS Record]
C --> D[ENS Record]
D --> E[mysite.eth]
E --> F[ENS-Compatible Browser]- Your site is deployed to IPFS
- An IPNS record points to your latest deployment
- Alternate Futures creates an ENS record linking to the IPNS
- You update your ENS domain's content hash
- Users can access your site at
mysite.eth
Accessing ENS Sites
Users can access your ENS site through:
ENS-Compatible Browsers
- Brave Browser - Built-in ENS support
- Opera - Native ENS resolution
- MetaMask - Browser extension with ENS
ENS Gateways
https://mysite.eth.link- Public gatewayhttps://mysite.eth.limo- Alternative gateway
IPFS Gateways
Users can also access via IPNS:
https://ipfs.io/ipns/your-ipns-name
https://gateway.ipfs.io/ipns/your-ipns-nameAutomatic Updates
When you deploy new versions of your site:
- IPFS deployment creates new CID
- IPNS record automatically updates to point to new CID
- ENS content hash continues to point to IPNS name
- Users automatically see latest version at
mysite.eth
No manual ENS updates needed after initial setup!
Best Practices
Best Practices
- Use IPNS records for dynamic content (regularly updated sites)
- Set up ENS during initial site launch for consistent branding
- Test access through multiple ENS gateways
- Keep your ENS domain registration current
- Document your ENS setup for team members
Troubleshooting
ENS Verification Fails
Problem: af ens verify shows mismatch
Solutions:
- Wait 5-10 minutes for Ethereum blockchain confirmation
- Check you pasted the correct IPNS hash
- Verify transaction was confirmed on Etherscan
- Try clearing your browser cache
Site Not Loading on ENS
Problem: mysite.eth doesn't load in browser
Solutions:
- Confirm browser has ENS support (try Brave)
- Use
.eth.linkgateway:mysite.eth.link - Check IPNS record is published:
af ipns list - Verify content hash in ENS manager
Content Not Updating
Problem: ENS shows old version of site
Solutions:
- Check IPNS record updated:
af ipns list - IPNS propagation can take 5-10 minutes
- Clear browser cache
- Try different ENS gateway
Next Steps
- IPNS Records - Manage IPNS records
- Sites - Deploy and manage sites
- Custom Domains - Use traditional domains