First-in first-served .rsk registrar
- Rootstock (RSK) MainNet:
0x779195c53cc7c1a33bd2eea5f63f2c1da8798d61
- Rootstock (RSK) TestNet:
0x36ffda909f941950a552011f2c50569fda14a169
- Smart contract
Has registration role in RSK Owner
.
- Defines a commit-reveal process to avoid front-running.
- Accepts payments via
- ERC-20
approve()
+register()
.1 - ERC-677
transferAndCall()
.2
- ERC-20
- 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:
- Calculate
makeCommitment
hash of the domain to be registered (off-chain). - Commit the calculated hash using
commit
. - Wait
minCommitmentAge
seconds. - Execute registration via ERC-20 (with approval) or ERC-677.
Find
transferAndCall()
encoder inutils/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. Pass0
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:
parameter | 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.