This page describes the new fields and flags added to all transactions to support Sponsored Fees and Reserves. These fields extend the existing common transaction fields.
(Requires the Sponsor amendment )
The following fields are added to the common transaction fields:
| Field Name | JSON Type | Internal Type | Required? | Description |
|---|---|---|---|---|
Sponsor | String | AccountID | No | The address of the sponsoring account. |
SponsorFlags | Number | UInt32 | No | Flags indicating the type of sponsorship. If included, at least one flag must be set. |
SponsorSignature | Object | Object | No | Contains the signing information for the sponsorship. |
The SponsorFlags field allows the user to specify which sponsorship type(s) they wish to participate in.
| Flag Name | Hex Value | Decimal Value | Description |
|---|---|---|---|
spfSponsorFee | 0x00000001 | 1 | Sponsoring the fee of the transaction. |
spfSponsorReserve | 0x00000002 | 2 | Sponsoring the reserve for any objects created in the transaction. |
Both flags can be used together in a single transaction. At least one flag must be set if the Sponsor field is included.
Pseudo-transactions do not support either sponsorship flag as they simply don't have fees or reserves at all. For all other transactions:
- The
spfSponsorFeeflag can be used with any transaction type. - The
spfSponsorReserveflag can only be used with the following transactions:- AccountSet
- CheckCancel
- CheckCash
- CheckCreate
- Clawback
- CredentialAccept
- CredentialCreate
- CredentialDelete
- DelegateSet
- DepositPreauth
- EscrowCancel
- EscrowCreate
- EscrowFinish
- MPTokenAuthorize
- MPTokenIssuanceCreate
- MPTokenIssuanceDestroy
- MPTokenIssuanceSet
- Payment
- PaymentChannelClaim
- PaymentChannelCreate
- PaymentChannelFund
- SetRegularKey
- SignerListSet
- SponsorshipTransfer
- TrustSet
Fee-sponsored transactions cannot be queued. If a fee-sponsored transaction does not make it into the open ledger, it fails with telCAN_NOT_QUEUE instead of entering the transaction queue.
The SponsorSignature field is an object containing the sponsor's signing information.
| Field Name | JSON Type | Internal Type | Required? | Description |
|---|---|---|---|---|
SigningPubKey | String | Blob | No | The SigningPubKey for the Sponsor, if single-signing. |
TxnSignature | String | Blob | No | A signature of the transaction from the sponsor, to indicate their approval of this transaction, if single-signing. |
Signers | Array | Array | No | An array of signatures of the transaction from the sponsor's signers to indicate their approval of this transaction, if the sponsor is multi-signing. |
These fields are not included in transaction signatures, though they are still included in the stored transaction. There is no additional transaction fee for using TxnSignature.
A sponsor signature is only required if no pre-funded Sponsorship ledger entry exists, or if the lsfSponsorshipRequireSignForFee or lsfSponsorshipRequireSignForReserve flags are enabled on the Sponsorship ledger entry.
If the SponsorSignature.Signers field is necessary, the total fee of the transaction will be increased due to the extra signatures that need to be processed. This is similar to the additional fees for multi-signing.
The total fee calculation for signatures is:
(1 + |tx.Signers| + |tx.SponsorSignature.Signers|) × base_fee (+ any transaction-specific fees)The SponsorFlags apply at opposite levels of a Batch. Reserve sponsorship goes on the inner transactions, because the outer Batch doesn't support spfSponsorReserve. Fee sponsorship works the other way, so spfSponsorFee is valid only on the outer Batch, not on the inner transactions.
When a reserve sponsor co-signs an inner transaction, that transaction's SponsorSignature field must be present but empty. The sponsor signs the outer Batch transaction instead and appears as a BatchSigners entry.
For transactions that include a Delegate field, note the following:
- Fee sponsorship applies to the delegate, since the delegate pays the transaction fee.
- When using pre-funded fee sponsorship, the delegate must be the sponsee instead of the account sending the transaction.
- Reserve sponsorship cannot be combined with delegation and fails with
temINVALID.
The following failure conditions have been added to transactions using the sponsorship fields:
| Error Code | Description |
|---|---|
temDISABLED | The Sponsor amendment is not enabled. |
temMALFORMED | The transaction is malformed. This can occur when:
|
temINVALID | The transaction has an invalid sponsor configuration. This can occur when:
|
temINVALID_FLAG | The transaction has invalid flags. This can occur when:
|
terNO_ACCOUNT | The sponsor account does not exist. |
tefBAD_AUTH | The sponsor signature is invalid. The public key does not match the sponsor account's master key or regular key, or the key type is unknown. |
tefNOT_MULTI_SIGNING | The sponsor account does not have a signer list. |
tefBAD_SIGNATURE | The sponsor multi-signature is invalid. A signer is not in the signer list, a public key is invalid, or a signature is invalid. |
tefBAD_QUORUM | The sponsor multi-signature does not meet the required quorum. |
terNO_PERMISSION | The transaction does not meet the sponsorship requirements. This can occur when:
|
terINSUF_FEE_B | The sponsor cannot pay the transaction fee: the co-signing sponsor's balance above its own reserve, or the pre-funded Sponsorship's FeeAmount (capped by MaxFee), is insufficient. Returned against the open ledger, or when the fee payer has nothing spendable at all. |
tecINSUFF_FEE | The same insufficient-fee condition as terINSUF_FEE_B, returned when the transaction is applied in a closed ledger and the fee payer has some spendable balance (non-zero) but not enough. |
tecINSUFFICIENT_RESERVE | The sponsor does not have enough XRP to cover the reserve, or the pre-funded Sponsorship does not have enough RemainingOwnerCount. |