Registration Steps (ENSRegistrarController)

1. Commit Reveal Process

The ENSRegistrarController uses a commit-reveal scheme to prevent front-running. Here’s how to perform the commit and reveal process:

1.1. Make Commitment

First, generate a commitment hash using the makeCommitment function. This hash is opaque and is revealed during the registration process.

Function:

function makeCommitment( string memory name, address owner, uint256 duration, bytes32 secret, address resolver, bytes[] memory data, bool reverseRecord, uint16 ownerControlledFuses ) public pure returns (bytes32)

Example:

makeCommitment( "myname", // Domain label 0x1234567890abcdef, // Owner address 31536000, // Duration (1 year in seconds) 0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890, // Secret (32 bytes) 0x1234567890abcdef, // Resolver address [], // Data false, // Set as primary name 0 // Owner-controlled fuses );

1.2. Commit

Once you have the commitment hash, call the commit function.

Function:

function commit(bytes32 commitment) public

Example:

commit(0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890);

Notes: - This requires an on-chain transaction. - Wait at least MIN_COMMITMENT_AGE (~60 seconds) before proceeding to register.

2. Register Domain

After the commitment period, you can proceed to register your domain.

2.1. Register

Ensure the domain name is available and meets the duration requirement. The actual duration is set to 584,554 years, but the input duration must be more than 28 days for validation. It should contain the same informations inputed during make commitment.

Make sure to approve an allowance of 100 ecld/etny to the controller address before registering, otherwise, the transfer will not be possible.

Function:

function register( string memory name, address owner, uint256 duration, bytes32 secret, address resolver, bytes[] memory data, bool reverseRecord, uint16 ownerControlledFuses ) public payable

Example:

register( "myname", // Domain label 0x1234567890abcdef, // Owner address 31536000, // Duration (1 year in seconds) 0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890, // Secret (32 bytes) 0x1234567890abcdef, // Resolver address [], // Data false, // Set as primary name 0 // Owner-controlled fuses );

Notes: - Ensure the domain is available: available(name) == true. - Input duration must be >= MIN_REGISTRATION_DURATION (28 days). - Commitments must be between 1 minute and 24 hours old. - The cost is fixed at 100 ECLD/ETNY.

3. Transfer NFT Token using NameWrapper

Once the domain is registered, you may need to transfer the NFT token associated with the domain to your account.

Function:

function safeTransferFrom( address from, address to, uint256 tokenId ) public

Example:

transferFrom( 0xOriginalOwner, // Current owner's address 0xNewOwner, // New owner's address 123456 // Token ID of the domain );

Last updated