First-in first-served .rsk registrar

Has registration role in RSK Owner.

  • Defines a commit-reveal process to avoid front-running.
  • Accepts payments via
    • ERC-20 approve() + register().1
    • ERC-721 transferAndCall().2
  • Calculates price using NamePrice contract.
  • It has an owner that can3
    • Set minimum commitment age.
    • Set minimum registration name length available.
    • Change name price contract.

The registration must be performed as follows:

  1. Calculate makeCommitment hash of the domain to be registered (off-chain).
  2. Commit the calculated hash using commit.
  3. Wait minCommitmentAge seconds.
  4. Execute registration via ERC-20 (with approval) or ERC-677.

Find transferAndCall() encoder in utils/index.js

Methods

price

function price (string memory name, uint expires, uint duration) public view returns(uint);

Calculates the price of a name, denominated in RIF.

  • name not used. Pass ''
  • expires not used. Pass 0
  • duration to register the name for.

makeCommitment

function makeCommitment (bytes32 label, address nameOwner, bytes32 secret) public pure returns (bytes32);

Create a commitment for register action.

:warning: Don’t use this method on-chain, as that will reveal your secret. Instead run this method off-chain (note that it is pure), and save the return value.

  • label keccak256 of the name to be registered.
  • nameOwner Owner of the name to be registered.
  • secret Secret to protect the name to be registered.

Returns the commitment hash.

commit

function commit(bytes32 commitment) external;

Commit before registering a name.

A valid commitment can be calculated using makeCommitment off-chain.

  • commitment A valid commitment hash.

canReveal

function canReveal(bytes32 commitment) public view returns (bool);

Ensure the commitment is ready to be revealed.

This method can be polled to ensure registration.

  • commitment Commitment to be queried.

Returns whether the commitment can be revealed or not.

register

function register(string calldata name, address nameOwner, bytes32 secret, uint duration);

Registers a .rsk name in RNS.

This method must be called after committing.

You must have previously executed approve() for the amount of tokens to be transferred.

  • name The name to register.
  • nameOwner The owner of the name to register.
  • secret The secret used to make the commitment.
  • duration Time to register in years.

Register via ERC-677

Use RIF transferAndCall method with the following encoding to perform a RIF token transfer and domain registration in a single transaction

Encoding:

size size offset
signature 4 bytes 0 bytes
owner 20 bytes 4 bytes
secret 32 bytes 24 bytes
duration 32 bytes 56 bytes
name variable size 88 bytes

Parameters are used int he same manner as register. Use 0xc2c414c8 as the signature.


  1. https://eips.ethereum.org/EIPS/eip-20
  2. https://github.com/ethereum/EIPs/issues/677
  3. https://github.com/OpenZeppelin/openzeppelin-contracts implementation.