$$ \newcommand \Hash {\mathrm{Hash}} \newcommand \pk {\mathrm{pk}} \newcommand \MSigPrefix {\texttt{MultisigAddr}} \newcommand \PQAPrefix {\texttt{PQA}} \newcommand \Fee {\mathrm{fee}} \newcommand \MinTxnFee {T_{\Fee,\min}} $$
Authorization and Signatures
Transactions are not valid unless they are somehow authorized by the sender account (for example, with a signature).
The authorization information is not considered part of the transaction and does
not affect the transaction ID (TXID).
Rather, when serializing a transaction for submitting to a node or including in
a block, the transaction and its authorization appear together in a structure called
a SignedTxn.
The SignedTxn struct contains:
-
The transaction (in msgpack field
txn); -
An OPTIONAL authorizer address (field
sgnr); -
Exactly one of a signature (field
sig), multisignature (fieldmsig), logic signature (fieldlsig), or post-quantum signature (fieldpqsig).
The authorizer address, a 32-byte address, determines against what to verify the
sig / msig / lsig / pqsig, as described below.
If the sgnr field is omitted (or zero), then the authorizer address defaults
to the transaction sender address.
At the time the transaction is applied to the Ledger, the authorizer address MUST match the transaction sender account’s spending key (or the sender address, if the account’s spending key is zero). If it does not match, then the transaction was improperly authorized and is invalid.
Signatures
-
A valid signature (
sig) is a (64-byte) valid Ed25519 signature of the transaction (encoded in canonical msgpack and with domain separation prefixTX) where the public key is the authorizer address (interpreted as an Ed25519 public key). -
A valid multisignature (
msig) is an object containing the following fields and which hashes to the authorizer address as described in the Multisignature section:-
The
subsigarray of subsignatures, each consisting of a signer address and a 64-byte signature of the message covered by the multisignature. The signature MUST contain all signer’s addresses in thesubsigarray even if the transaction has not been signed by that address. -
The threshold
thrthat is a minimum number of REQUIRED signatures. -
The multisignature version
v(current value is \( 1 \)).
-
-
A valid post-quantum signature (
pqsig) is an object which derives the authorizer address and signs the transaction with a post-quantum signature scheme, as described in the Post-Quantum Signature section. -
A valid logic signature (
lsig) is an object containing the following fields:-
The logic
lwhich is versioned bytecode (see AVM specifications). -
At most one OPTIONAL delegation signature: a single signature
sig, a multisignaturelmsig, or a post-quantum signaturepqsigfrom the authorizer address of the transaction, as described in the Logic Signature Delegation section. -
An OPTIONAL array of byte strings
argwhich are arguments supplied to the program inl(argbytes are not covered bysig,lmsig, orpqsig).
-
The logic signature is valid if the one set is a valid delegation signature of the program by the authorizer address of the transaction, or if none of them is set and the authorizer address is equal to the program hash defined in the Contract Account Mode.
Also the program MUST execute and finish with a single non-zero value on the AVM stack (see AVM specifications for details on program execution semantics).
Multisignature
Multisignature term describes a special multisignature address, signing and validation procedures.
In contrast with a single signature address that may be understood as a public key, multisignature address is a hash of a constant string identifier for:
-
The \( \MSigPrefix \) prefix,
-
A version \( v \),
-
The multisignature authorization threshold \( t \),
-
All \( n \) addresses (\( \pk \)) used for multisignature address creation.
$$ \mathrm{MSig} = \Hash(\MSigPrefix, v, t, \pk_1, \ldots \pk_n) $$
One address MAY be specified multiple times in multisignature address creation. In this case, every occurrence is counted independently in validation.
The repetition of the same address in the multisignature defines the “weight” of the address.
The multisignature validation process checks that:
-
All non-empty signatures are valid for the same message covered by the multisignature;
-
The valid signatures count is not less than the threshold.
Validation fails if any of the signatures is invalid, even if the count of all remaining correct signatures is greater or equals than the threshold.
Post-Quantum Signature
A post-quantum signature authorizes a transaction with a post-quantum digital signature
scheme, either directly (SignedTxn field pqsig) or by delegating a logic signature
(lsig field pqsig, see Logic Signature Delegation).
The pqsig object contains the following fields:
-
The scheme identifier
sch, a 2-byte string identifying the post-quantum signature scheme. The supported values are:f1, denoting deterministic FALCON-1024.
-
The address salt
slt, a 1-byte unsigned integer. -
The canonical public key
pkof the scheme, a byte string. -
The canonical signature
sigof the scheme, a non-empty byte string.
The post-quantum address of a scheme identifier, salt, and public key is derived by hashing their concatenation with the domain separation prefix \( \PQAPrefix \):
$$ \mathrm{PQAddr} = \Hash(\PQAPrefix, \mathtt{sch}, \mathtt{slt}, \pk) $$
The salt takes part in the address derivation, so one public key derives up to \( 256 \) distinct addresses. This allows clients to select, by rejection sampling over the salt, an address which is not a valid Ed25519 public key, so that no Ed25519 signature may ever authorize the account. This property is not enforced by consensus.
A post-quantum signature is valid if all the following conditions hold:
-
The scheme identifier
schis supported; -
The post-quantum address derived from
sch,slt, andpkis equal to the authorizer address of the transaction; -
The signature
sigis valid for the transaction (encoded in canonical msgpack and with domain separation prefixTX), under the public keypk, according to the scheme denoted bysch.
Fee Surcharge
A transaction authorized with a post-quantum signature, either directly or through a post-quantum delegated logic signature, requires an additional fee, given by the scheme fee contribution:
f1: \( 2 \times \MinTxnFee \).
This contribution adds to the minimum fee otherwise required by the transaction or by its transaction group, if any. The contribution adds even when the minimum fee is discounted in a fee-exempt Heartbeat transaction authorized by a post-quantum signature. The contribution never applies to a State Proof transaction, since it carries no authorization at all.
Logic Signature Delegation
An account MAY delegate authority to a logic signature by signing its program (see the Delegated Signature Mode of the AVM specifications).
The lsig object carries the delegation signature in one of the following forms,
according to the delegating account type:
-
The single signature
sigis a valid 64-byte Ed25519 signature of the stringProgramconcatenated with the bytes inl, where the public key is the authorizer address. -
The multisignature
lmsigis a valid multisignature (an object structured asmsig), which hashes to the authorizer address as described in the Multisignature section, where the covered message is the stringMsigProgramconcatenated with the bytes of the authorizer address and the bytes inl. -
The post-quantum signature
pqsigis a valid post-quantum signature, where the signed message is the stringPQProgramconcatenated with the bytes of the authorizer address and the bytes inl, in place of the transaction.
The
lmsigandpqsigmessages bind the delegating account address: a delegation produced for one account is not valid for any other account (in particular, for a different salted address derived from the same post-quantum public key).