Skip to main content

Registration of username Signature Structure

To authorize the registrationUsername operation (the reveal phase following pre-registration), the user must generate a cryptographic signature compliant with the EIP-191 standard .

This signature proves ownership of the pre-registration commit by revealing the original username and the secret clowNumber.

Signed Message Format

The message is constructed by concatenating the following components as strings, separated by commas (,):

string.concat(
"d134f8b4",
",",
_username,
",",
Strings.toString(_clowNumber),
",",
Strings.toString(_mateNameServiceNonce)
)

1. MNS Registration Identifier (Hex String):

  • Value: d134f8b4
  • Purpose: A specific identifier used within the EIP-191 framework to distinguish MNS username registration (reveal) messages from other types of signed messages.

2. Username (String):

  • Value: The _username string itself.
  • Purpose: The actual, plain-text username that the user intends to register. This must match the username used to generate the hash during pre-registration.

3. Clow Number (String):

  • Value: The result of Strings.toString(_clowNumber).
  • Purpose: The string representation of the secret uint256 number (clowNumber) chosen by the user during the pre-registration phase.

4. MNS Nonce (String):

  • Value: The result of Strings.toString(_nonce). (Use _mateNameServiceNonce if that is the specific parameter name expected by the contract).
  • Purpose: The string representation of the user's nonce specific to the MNS contract for this registration action. This prevents replay attacks for registration actions initiated by the user and should likely be incremented separately from the pre-registration nonce.
tip
  • addressToString converts an address to a lowercase string
  • Strings.toString converts a number to a string
  • AdvancedStrings.bytes32ToString(bytes32 _input) converts a bytes32 value into its lowercase hexadecimal string representation