How to Deploy and Name Your Smart Contract with ENS on Ethereum
Learn how to deploy a smart contract and give it a human-readable ENS name using Enscribe, making your contract more trustworthy and user-friendly.
Before: 0x742d35cc567890c000c000c07c81c25d7df34793
(confusing hex address)
After: v0.app.enscribe.eth
(clear, trustworthy identity)
What You'll Learn
This comprehensive guide will walk you through:
- Preparing your smart contract for deployment with ENS naming
- Using Enscribe's Contract Deployment Service to deploy with automatic ENS naming
- Alternative: Deploying first, then naming existing contracts
- Verifying and managing your named contracts
- Best practices for contract naming
Prerequisites
Before you begin, ensure you have:
- Web3 Wallet: MetaMask, WalletConnect, or similar
- ETH for Gas: On your chosen network (mainnet, testnet, or L2)
- Compiled Smart Contract: With bytecode and ABI
- Basic ENS Knowledge: Understanding of domains and subdomains
Part 1: Prepare Your Smart Contract
Step 1: Choose Your Network
Enscribe supports multiple networks to deploy your contract. Choose based on your needs:
Network | Use Case | Gas Costs | Best For |
---|---|---|---|
Ethereum Mainnet | Production contracts | High | High-value, established projects |
Base | Production with lower costs | Low | DeFi, consumer apps |
Linea | Alternative L2 option | Low | DeFi, consumer apps |
Testnets | Testing and development | Free | Development, testing |
Other L2 networks like Arbitrum, Optimism and Scroll don't support contract deployment via Enscribe because ENS contracts aren't deployed on these networks. Linea and Base have support for .linea.eth
and .base.eth
ENS domains respectively, so you can use them to name your contract during deployment.
Step 2: Ensure Contract Compatibility
For setting primary name (reverse resolution), your contract must implement one of these interfaces:
Supported Interfaces:
- Ownable (OpenZeppelin) - Most common
- ERC173 - Standard ownership interface
- ReverseClaimer - Custom ENS interface
- ReverseSetter - Alternative ENS interface
Example: Ownable Contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
contract MyDeFiVault is Ownable {
mapping(address => uint256) public balances;
constructor(address initialOwner) Ownable(initialOwner) {
// Your constructor logic
}
function deposit() external payable {
balances[msg.sender] += msg.value;
}
function withdraw(uint256 amount) external {
require(balances[msg.sender] >= amount, "Insufficient balance");
balances[msg.sender] -= amount;
payable(msg.sender).transfer(amount);
}
}
What if my contract doesn't implement these?
- You can still get forward resolution (ENS name → contract address)
- But not reverse resolution (contract address → ENS name)
- Consider using compatible patterns for future deployments
Step 3: Compile Your Contract
Compile your contract using your preferred tool:
Using Remix:
- Go to Remix IDE
- Create your contract file
- Go to the "Solidity Compiler" tab
- Click "Compile"
- Copy the compilation artifacts:
YourContract.bin
(bytecode)YourContract.abi
(ABI)
Using Hardhat:
npx hardhat compile
# Find artifacts in artifacts/contracts/YourContract.sol/
Using Foundry:
forge build
# Find artifacts in out/YourContract.sol/
After compilation, you'll need two files:
- Bytecode file (
.bin
) - Contains the compiled contract code - ABI file (
.abi
) - Contains the contract interface definition
Part 2: Deploy with Enscribe Contract Deployment Service
Step 1: Access Enscribe
- Go to enscribe.xyz
- Click "Deploy Contract" in the navigation
- Connect your wallet
- Select your target network
Look for the "Deploy Contract" button in the main navigation or on the homepage to access the deployment service.
Step 2: Fill the Deployment Form
The deployment form has five key sections:
The deployment form is organized into clear sections for easy completion. Each section is explained in detail below.
Contract Bytecode
- Paste the contents of your
.bin
file (hexadecimal format) - This is the compiled smart contract code that gets deployed
Contract ABI (Optional but Recommended)
- Paste the contents of your
.abi
file (JSON format) - Enables automatic constructor parameter detection
- Reduces errors and manual work
Constructor Arguments
Enscribe will automatically detect constructor parameters if you provide the ABI:
Automatic Detection:
- Form fields appear based on your constructor
- Select appropriate types from dropdowns
- Enter values in the correct format
Manual Entry: For complex types, use the "Custom Type" option:
// For array of structs: Person[]
Custom Type: tuple(string,uint256,address)[]
Value: [
["Alice", 25, "0x1bA43Becc3Ea96c37343b7CB18de7386bA29445B"],
["Bob", 30, "0x7cF7816d45398A1b37bBE517ca24d8CdFb8D042D"]
]
Contract Name
Choose your contract's subdomain name:
- Must be unique under the parent domain
- You can auto generate a label name using the "Generate Name" button
- Use descriptive names:
defi-vault
,nft-marketplace
,dao-governance
ENS Parent Name
Choose between two options:
Option 1: Enscribe-Hosted Parent (Recommended for beginners)
- No additional permissions required
- Instant deployment
- Your contract gets:
your-label.deployd.eth
Option 2: Your Own ENS Domain
- Requires granting operator permissions to Enscribe
- More control over branding
- Your contract gets:
your-label.yourdomain.eth
Step 3: Deploy Your Contract
- Review Details: Double-check all information
- Deploy Contract: Click "Deploy"
- Sign Transactions: Enscribe will open a modal with all the steps, sign each transaction in your wallet
- Wait for Confirmation: Monitor transaction status
Step 4: Verify Deployment Success
After deployment succeeds, you'll see:
Enscribe provides a detailed message showing your contract address, ENS name, and transaction details.
Once you close the modal, you'll be redirected to the explore page for your new contract. You can share this URL with your users to let them interact with your contract.
What Happens Automatically:
- Contract deployed to blockchain
- ENS subname created (e.g.,
my-vault.app.enscribe.eth
) - Forward resolution set (ENS name → contract address)
- Primary name set (contract address → ENS name)
- Contract appears in your "My Contracts" dashboard
Complete deployment walkthrough
What's Next?
You've deployed and named your smart contract with ENS. Here are your next steps:
- Share Your Contract: Use the ENS name in documentation and interfaces
- Build Trust: Let users know they're interacting with a named, verified contract
- Explore Advanced Features: Set up subdomain hierarchies and manage multiple contracts
- Join the Community: Share your experience and get support
Getting Help
Community Support
Documentation Resources
- Complete Docs: Technical reference
- Blog: Updates and announcements
- Check our FAQ
Ready to deploy and name your contract? Head to Enscribe and give your smart contract the human-readable identity it deserves.