Design And Architecture
Enscribe brings together multiple ENS-related actions into a single atomic transaction, significantly simplifying what was previously a fragmented, manual, and error-prone process.
This section covers the design and architecture of the Enscribe contract. To explore all related contracts, visit our Github contracts repository.
Key ENS Contracts used:
- ENS NameWrapper: To create subname of Wrapped ENS names
- ENS ReverseRegistrar: To set primary name (reverse resolution)
- ENS Public Resolver: To set forward resolution
- ENS Registry: To creat subanme, and resolve names.
Openzeppelin Contracts used:
- Ownable - For admin controls and to transfer ownership of deployed contract back to sender.
- ERC1155 Receiver - ENS wrapped subnames are ERC1155, this contract enables Enscribe contract to receive these subnames.
Enscribe Contract Functions
For New Contract Deployment
setNameAndDeploy(bytes memory bytecode, string calldata label, string calldata parentName, bytes32 parentNode)
Input
bytes bytecode
: Bytecode of the Contract to be deployed along with the args
string label
: Label or subname for the contract
string parentName
: Parent ENS name under which contract will be deployed
bytes32 parentNode
: NameHash of Parent ENS (Can be calculated using any Web3 Library or service)
Returns
address
: Deployed contract address
For Naming Existing Contracts
If the provided contract implements Ownable/ERC-173, you may set a primary name for a contract (setting both a forward and reverse resolution record). Otherwise it is only possible to configure a forward resolving record.
Contracts extending Ownable/ERC173
1. Forward Resolution
setName(address contractAddress, string calldata label, string calldata parentName, bytes32 parentNode)`
Input
address contractAddress
: Contract address of the existing contract
string label
: Label or subname for the contract
string parentName
: Parent ENS name under which contract will be deployed
bytes32 parentNode
: NameHash of Parent ENS (Can be calculated using any Web3 Library of service)
Returns
Boolean
: success for setting forward resolution
2. Reverse Resolution
setNameForAddr(address contractAddress, address owner, address resolver, string memory ensName)
Input
address contractAddress
: The contract address of the existing contract you are setting the primary name for.
address owner
: The owner of the reverse node in the ENS Registry
address resolver
: The resolver to use for the reverse node. Enter the default Public Resolver
string memory name
: The primary name to set for the contract. This must be a name that already forward-resolves to the contract address, otherwise Primary Name resolution will not work.
All other Existing Contracts
Forward Resolution
setName(address contractAddress, string calldata label, string calldata parentName, bytes32 parentNode)`
Input
address contractAddress
: Contract address of the existing contract
string label
: Label or subname for the contract
string parentName
: Parent ENS name under which contract will be deployed
bytes32 parentNode
: NameHash of Parent ENS (Can be calculated using any Web3 Library of service)
Returns
Boolean
: success for setting Forward Resolution
Design Considerations
-
Security: All ENS-related operations are gated by operator permissions and ENS parent ownership checks.
-
Atomicity: Deployment and ENS setup are performed in a single atomic transaction.
-
Permissionless: The user remains the ultimate owner; control is delegated to Enscribe for initial deployment and subname creation if applicable.
-
Fallback Safety: If any step fails due to ownership mismatch or unsupported contract type, the transaction reverts to prevent partial deployments.
Contract Deployment Sequence Diagrame
Workflow
Enscribe abstracts the complexity of deploying and naming smart contracts on Ethereum by combining everything into a single, atomic transaction.
The setNameAndDeploy
function encapsulates the entire flow — from CREATE2-based deployment to ENS subname creation, forward resolution, and primary name assignment — all with on-chain checks to ensure security, correctness, and full user control.
Checkout the Enscribe Whitepaper for more details.