Skip to main content

Accept Offer Signature Structure

To authorize the acceptOffer 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 accept a specific offer (_offerId), thereby agreeing to transfer ownership of their username (_username) in exchange for the offered amount.

Signed Message Format

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

string.concat(
"8e3bde43",
",",
_username,
",",
Strings.toString(_offerId),
",",
Strings.toString(_nameServiceNonce)
)

1. MNS Accept Offer Identifier (Hex String):

  • Value: 8e3bde43
  • Purpose: A specific identifier used within the EIP-191 framework to distinguish MNS acceptOffer messages from other types of signed messages.

2. Target Username (String):

  • Value: The _username string itself.
  • Purpose: Specifies the username that the owner is agreeing to sell by accepting this offer.

3. Offer ID (String):

  • Value: The result of Strings.toString(_offerId).
  • Purpose: The string representation of the unique identifier (uint256) of the specific offer (made previously by another user) that the owner is now accepting.

4. 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 acceptOffer action. This prevents replay attacks of the acceptance operation initiated by the owner.

Practical Example

Let's say the current owner of a username wants to accept an offer with the following parameters:

  • Owned Username: "alice"
  • Offer ID: 123 (the unique identifier of the offer to accept)
  • Name Service Nonce: 3

The message would be constructed as:

"8e3bde43,alice,123,3"

Message Breakdown:

  • 8e3bde43: Function selector for accept offer verification
  • alice: The username that the current owner is agreeing to sell
  • 123: The unique ID of the specific offer being accepted
  • 3: 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 acceptance request in the verifyMessageSignedForAcceptOffer function.

tip
  • The function selector 8e3bde43 is the first 4 bytes of the keccak256 hash of the function signature for verifyMessageSignedForAcceptOffer
  • 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 accept offers on that username
  • The _offerId must correspond to a valid, existing offer that hasn't expired
  • Accepting an offer transfers ownership of the username to the offeror