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'spriority
flag istrue
(asynchronous).4faa1fa2
: Used when the payment'spriority
flag isfalse
(synchronous).
2. Recipient Identifier (String):
- If using
to_address
: The result ofaddressToString(to_address)
. - If using
to_identity
: Theto_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:fStrings.toString(nonce)
. Purpose: Provides replay protection for thefrom
address, specific to the sync/async context.
7. Priority Flag (String):
"true"
: If the payment'spriority
flag istrue
."false"
: If the payment'spriority
flag isfalse
. 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 (oraddress(0)
if unrestricted).
tip
addressToString
converts an address to a lowercase stringStrings.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 orf4e1895b
for asynchronous) is determined by the_priority_boolean
value