Contracts reference
The protocol is made of two contracts, both deployed at the same address on Ethereum Mainnet and Sepolia, verified, and without owner or admin functions. Their full source is readable directly on Etherscan: NameNFT (the registry, resolver and ERC-721 in one) and the SubdomainRegistrar (subdomain sales).
The contracts are a minimal adaptation of the “wei names” codebase, which was audited by Cantina, Plainshift and Zellic (reports linked from the audit trail). Every line changed from that audited base is public and reviewable on the audit trail page.
| Contract | Address |
|---|---|
| NameNFT (registry + resolver) | 0x9D51D507BC7264d4fE8Ad1cf7Fe191933A0a81d6 |
| SubdomainRegistrar (sales) | 0xc1D5245bfd98dDB7E73B33209B346b4FC0E03f3c |
Identity model
tokenId = uint256(namehash)where namehash is the recursive label hash rooted at the.gweinode (0xcca9c7f2dbe2808af0de2982fc84314bfa68a82a6a60ad5cd757f91a233d7d7f).computeId("alice")andcomputeNamehash("alice.gwei")are pure helpers on the contract.- ERC-721 with resolver interfaces (
addr,text,contenthash) exposed both byuint256 tokenIdand standardbytes32 nodeoverloads.
Constants
| Constant | Value |
|---|---|
| Registration period | 365 days |
| Grace period | 90 days |
| Commitment window | 60 s – 24 h |
| Premium start / decay | 100 ETH → 0 over 21 days |
| Fees (1/2/3/4/5+ bytes) | 0.5 / 0.1 / 0.05 / 0.01 / 0.0005 ETH |
| Max label length | 255 bytes |
| Max subdomain depth | 10 |
NameNFT: key functions
Registration & lifecycle
function makeCommitment(string label, address owner, bytes32 secret) pure returns (bytes32)
function commit(bytes32 commitment)
function reveal(string label, bytes32 secret) payable returns (uint256 tokenId)
function renew(uint256 tokenId) payable
function isAvailable(string label, uint256 parentId) view returns (bool)
function getFee(uint256 byteLength) pure returns (uint256)
function getPremium(uint256 tokenId) view returns (uint256)
function expiresAt(uint256 tokenId) view returns (uint256)
function isExpired(uint256 tokenId) view returns (bool)
function inGracePeriod(uint256 tokenId) view returns (bool)
Subdomains
function registerSubdomain(string label, uint256 parentId) returns (uint256)
function registerSubdomainFor(string label, uint256 parentId, address to) returns (uint256)
Records & resolution
function setAddr(uint256 tokenId, address addr)
function setAddrForCoin(uint256 tokenId, uint256 coinType, bytes addr)
function setText(uint256 tokenId, string key, string value)
function setContenthash(uint256 tokenId, bytes hash)
function setPrimaryName(uint256 tokenId) // tokenId 0 clears
function resolve(uint256 tokenId) view returns (address) // falls back to owner
function reverseResolve(address addr) view returns (string)
function text(uint256 tokenId, string key) view returns (string)
function contenthash(uint256 tokenId) view returns (bytes)
Introspection
function records(uint256 tokenId) view returns (string label, uint256 parent, uint64 expiresAt, uint64 epoch, uint64 parentEpoch)
function getFullName(uint256 tokenId) view returns (string)
function normalize(string label) pure returns (string)
function commitments(bytes32 commitment) view returns (uint256 timestamp)
function primaryName(address addr) view returns (uint256 tokenId)
Events
event NameRegistered(uint256 indexed tokenId, string label, address indexed owner, uint256 expiresAt)
event SubdomainRegistered(uint256 indexed tokenId, uint256 indexed parentId, string label)
event NameRenewed(uint256 indexed tokenId, uint256 newExpiresAt)
event PrimaryNameSet(address indexed addr, uint256 indexed tokenId)
event Committed(bytes32 indexed commitment, address indexed committer)
event AddrChanged(bytes32 indexed node, address addr)
event TextChanged(bytes32 indexed node, string indexed key, string value)
event ContenthashChanged(bytes32 indexed node, bytes contenthash)
SubdomainRegistrar: key functions
function configure(uint256 parentId, address payout, address feeToken, uint256 price,
bool enabled, address gateToken, uint256 minGateBalance)
function disable(uint256 parentId)
function deposit(uint256 parentId) // escrow mode
function withdrawParent(uint256 parentId, address to) // leave escrow
function register(uint256 parentId, string label) payable returns (uint256)
function registerFor(uint256 parentId, string label, address to) payable returns (uint256)
function ethBalance(address account) view returns (uint256)
function withdrawETH(address to)
function config(uint256 parentId) view returns (address controller, bool enabled,
address feeToken, uint96 price, address gateToken, uint96 minGateBalance, address payout)
feeToken = address(0) means ETH. ERC-20 sales transfer directly to the payout; ETH sales
accumulate in ethBalance and are withdrawn pull-payment style.