# 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(`\
&#x20;   `string memory name,`\
&#x20;   `address owner,`\
&#x20;   `uint256 duration,`\
&#x20;   `bytes32 secret,`\
&#x20;   `address resolver,`\
&#x20;   `bytes[] memory data,`\
&#x20;   `bool reverseRecord,`\
&#x20;   `uint16 ownerControlledFuses`\
`) public pure returns (bytes32)`

`Example:`

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

&#x20;

**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(`\
&#x20;   `string memory name,`\
&#x20;   `address owner,`\
&#x20;   `uint256 duration,`\
&#x20;   `bytes32 secret,`\
&#x20;   `address resolver,`\
&#x20;   `bytes[] memory data,`\
&#x20;   `bool reverseRecord,`\
&#x20;   `uint16 ownerControlledFuses`\
`) public payable`

`Example:`

`register(`\
&#x20;   `"myname",                // Domain label`\
&#x20;   `0x1234567890abcdef,      // Owner address`\
&#x20;   `31536000,                // Duration (1 year in seconds)`\
&#x20;   `0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890, // Secret (32 bytes)`\
&#x20;   `0x1234567890abcdef,      // Resolver address`\
&#x20;   `[],                      // Data`\
&#x20;   `false,                   // Set as primary name`\
&#x20;   `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(`\
&#x20;   `address from,`\
&#x20;   `address to,`\
&#x20;   `uint256 tokenId`\
`) public`

`Example:`

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