Renew Username Signature Structure
To authorize the renewUsername
operation within the MNS service, the user who currently owns the username must generate a cryptographic signature compliant with the EIP-191 standard.
This signature proves the current username owner's intent and authorization to extend the expiration period for their specified username (_username
), typically involving a renewal fee.
Signed Message Format
The message is constructed by concatenating the following components as strings, separated by commas (,
):
string.concat(
"35723e23",
",",
_username,
",",
Strings.toString(_nameServiceNonce)
)
1. MNS Renew Username Identifier (Hex String):
- Value:
35723e23
- Purpose: A specific identifier used within the EIP-191 framework to distinguish MNS
renewUsername
messages from other types of signed messages.
2. Target Username (String):
- Value: The
_username
string itself. - Purpose: Specifies the username whose registration the owner is requesting to renew.
3. MNS Nonce (String):
- Value: The result of
Strings.toString(_nameServiceNonce)
. - Purpose: The string representation of the current username owner's nonce specific to the MNS contract for this
renewUsername
action. This prevents replay attacks of the renewal operation initiated by the owner.
Practical Example
Let's say the current owner wants to renew their username with the following parameters:
- Username to Renew:
"alice"
- Name Service Nonce:
8
The message would be constructed as:
"35723e23,alice,8"
Message Breakdown:
35723e23
: Function selector for renew username verificationalice
: The username that the current owner wants to renew8
: The current username owner's name service nonce
This message would then be signed using EIP-191 standard, and the resulting signature would be used to verify the renewal request in the verifyMessageSignedForRenewUsername
function.
- The function selector
35723e23
is the first 4 bytes of the keccak256 hash of the function signature forverifyMessageSignedForRenewUsername
Strings.toString
converts a number to a string (standard OpenZeppelin utility)- The signature verification uses the EIP-191 standard for message signing
- Only the current owner of the username can renew their own username
- Renewal typically extends the username's expiration period and may involve a renewal fee