Skip to main content

Single Payment Signature Structure

To authorize payment operations the user must generate a cryptographic signature compliant with the EIP-191 standard.

The signature is created by signing a precisely formatted string message derived from the payment details. The structure of this message varies slightly depending on whether the recipient is specified by a direct address (to_address) or an identity string (to_identity).

Signed Message Format

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

string.concat(
_priority_boolean ? "f4e1895b" : "4faa1fa2",
",",
addressToString(_receiverAddress),
",",
addressToString(_token),
",",
Strings.toString(_amount),
",",
Strings.toString(_priorityFee),
",",
Strings.toString(_nonce),
",",
_priority_boolean ? "true" : "false",
",",
addressToString(_executor)
);

For payments using the to_identity parameter:

msg = string.concat(
_priority_boolean ? "f4e1895b" : "4faa1fa2",
",",
_receiverIdentity,
",",
addressToString(_token),
",",
Strings.toString(_amount),
",",
Strings.toString(_priorityFee),
",",
Strings.toString(_nonce),
",",
_priority_boolean ? "true" : "false",
",",
addressToString(_executor)
)

1. Function Selector (Hex String):

  • f4e1895b: Used when the payment's priority flag is true (asynchronous).
  • 4faa1fa2: Used when the payment's priority flag is false (synchronous).

2. Recipient Identifier (String):

  • If using to_address: The result of addressToString(to_address).
  • If using to_identity: The to_identity string itself. Purpose: Specifies the intended recipient of the payment.

3. Token Address (String):

  • The result of addressToString(token). Purpose: Identifies the token being transferred.

4. Amount (String):

  • The result of Strings.toString(amount). Purpose: Specifies the quantity of the token to be transferred.

5. Priority Fee (String):

  • The result of Strings.toString(priorityFee). Purpose: Specifies the optional fee paid to the executor.

6. Nonce (String):

  • The result oAll parameters are an string concatenated using a comma , as a separator:f Strings.toString(nonce). Purpose: Provides replay protection for the from address, specific to the sync/async context.

7. Priority Flag (String):

  • "true": If the payment's priority flag is true.
  • "false": If the payment's priority flag is false. Purpose: Explicitly includes the execution mode preference in the signed message.

8. Executor Address (String):

  • The result of addressToString(executor). Purpose: Specifies the address authorized to submit this payment request (or address(0) if unrestricted).
tip
  • addressToString converts an address to a lowercase string
  • Strings.toString converts a number to a string
  • _priority_boolean indicates whether the payment will be executed asynchronously (true) or synchronously (false)
  • The function selector (4faa1fa2 for synchronous or f4e1895b for asynchronous) is determined by the _priority_boolean value