Amendment Idea: Scheduled Transactions #394
mvadari
started this conversation in
Ideas (pre standard proposal)
Replies: 1 comment 9 replies
-
|
I like these Scheduled Transactions. However, I do have a number of questions mainly for clarity and some comments to make:
|
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Scheduled Transactions
1. Abstract
This specification introduces a new ledger object and associated transactions that allow users to schedule a transaction on-ledger for conditional execution in the future. This feature enables programmable, condition-based execution of XRPL transactions without requiring external custodianship or centralized automation services.
2. Motivation
Today, XRPL transactions must be submitted immediately for execution; there is no native way to defer or conditionally execute them. This limits users who want to automate workflows such as stop-loss orders, time-based payments, or delegated execution of transactions under custom rules.
This feature solves this by allowing transactions to be stored directly on-ledger, along with trigger conditions and incentives for relayers to execute them. Users gain confidence that their intent is committed and immutable, relayers are incentivized to monitor and execute them, and the ledger gains a clean, native mechanism for conditional automation.
3. Overview
This spec proposes:
TransactionSavedledger objectTicketledger object's flagsTransactionSavetransactionTransactionExecutetransactionTransactionCanceltransactionThis feature will require an amendment, tentatively titled
SavedTransaction.3.1. Terminology
Batchinner transactions.3.2. Example Flows
3.2.1. Stop-Loss Order
OfferCreatetransaction to sell the XRP on the DEX, wraps it in aTransactionSaved, attaches a WASM trigger that checks the XRPL DEX price, and sets an expiration of 30 days.TransactionSaved. TheOfferCreateexecutes atomically, the bounty is paid to the relayer, and theTransactionSavedis deleted from the ledger.3.2.2. Scheduled Payroll
Paymenttransaction and stores it in aTransactionSavedwith a simple time-based trigger (execute after November 1, 2025, 00:00 UTC).TransactionSaved.ThePaymentexecutes and the employee receives his salary.TransactionSavedand ticket reservation are both released.Note: this is technically more easily done via escrow, but could theoretically be done via a scheduled transaction too, especially if the account doesn't have the funds at the time of scheduling the transaction.
4. Ledger Entry:
TransactionSaved4.1. Object ID
Hash of object key,
Transaction/`TransactionHash4.2. Fields
LedgerIndexstringHash256LedgerEntryTypeTransactionSavedstringUInt16TransactionSaved).OwnerstringAccountIDTransactionobjectSTTxTransactionHashstringUInt256TicketSequencenumberUInt32Transactionis provided instead of aTransactionHash(since the information is available in the transaction).ReleaseFunctionstringBlobValidAfternumberUInt32ExpirationnumberUInt32BountystringorobjectSTAmountOwnerNodestringUInt64PreviousTxnIDstringHash256PreviousTxnLgrSeqnumberUInt324.2.1.
TriggerFunctionThe ABI of this function will be:
Where
0or a negative number means the transaction will not be released, and a positive number means the transaction will be released.4.3. Account Deletion
The
TransactionSavedobject is not a deletion blocker.5. Ledger Entry:
TicketNew flag -
lsfReserved- to indicate when a ticket is reserved for aTransactionSaved(so that it is not accidentally used for something else, thereby invalidating the saved transaction)6. Transaction Common Fields
6.1. Flags
New
tfTxSavedflag for transactions stored inTransactionSaved. This allows the transaction to be unsigned but still invalid.7. Transaction:
TransactionSave7.1. Fields
TransactionTypestringUInt16TransactionSave).AccountstringAccountIDTransactionobjectTransactionTransactionHashstringUInt256TicketSequencenumberUInt32Transactionis provided instead of aTransactionHash(since the information is available in the transaction).ReleaseFunctionstringBlobValidAfternumberUInt32ExpirationnumberUInt32BountystringorobjectSTAmountTransactionorTransactionHashmust be included. At least one ofTriggerFunctionandValidAftermust be included.7.2. Failure Conditions
Transactionis provided:Transactionis invalid (fails preflight)Accountis not allowed to submitTransaction(i.e.Accountis not equal toTransaction.AccountorTransaction.Delegate)TicketSequenceis also provided.Transactiondoes not havetfTxSavedenabled.TransactionHashis provided:TicketSequenceis not provided.TriggerFunctionis not valid WASM code.ValidAfterhas already passed.Expirationhas already passed.Bountyis an invalid amount (i.e. is negative)Accountdoes not have theBountyfunds7.3. State Changes
If the transaction is successful:
TransactionSavedobject will be created.TicketSequenceorTransaction.TicketSequenceis specified,lsfTicketReservedis enabled on thatTicketobject.8. Transaction:
TransactionExecute8.1. Fields
TransactionTypestringUInt16TransactionExecute).AccountstringAccountIDTransactionHashstringUInt256TransactionSavedobject has aTransactionfield.TransactionobjectTransactionTransactionSavedobject has aTransactionHashfield.ReleaseInputstringBlobReleaseFunction(i.e. off-chain validations.8.2. Failure Conditions
TransactionandTransactionHashare specified.TransactionSavedobject that corresponds withTransactionHash/Transaction.Transactionis specified andTransactionSaved.Transactionis also specified.TransactionHashis specified andTransactionSaved.TransactionHashis already specified.Transactionis specified and does not havetfTxSavedenabled.ReleaseFunctionon theTransactionSavedobject does not succeed.TransactionSaved.Ownerno longer has the funds to pay theBounty(tecUNFUNDED).TransactionSaved.Ownerno longer has permission to submitTransaction(i.e. the delegation was taken away).8.3. State Changes
TransactionSaved.TransactionorTransactionExecute.Transactionis executed atomically as if it had been sent directly from the account (similar to howBatchinner transactions are processed atomically).Bountyis provided in theTransactionSaved, that amount is transferred from theTransactionSaved.Ownerto theTransactionExecute.Account.9. Transaction:
TransactionCancel9.1. Fields
TransactionTypestringUInt16TransactionExecute).AccountstringAccountIDTransactionHashstringUInt2569.2. Failure Conditions
TransactionSavedobject that corresponds withTransactionHash/Transaction.9.3. State Changes
TransactionSavedobject is deleted.10. Security
TransactionSave.TransactionSavedobject is single-use.11. Rationale
By separating the definition of a transaction from its execution, the ledger enables workflows that would otherwise require complex off-ledger orchestration, such as conditional execution, multi-actor coordination, or repeated actions with stable semantics.
One major decision was to allow either a hash of the transaction data on-ledger or the actual transaction. This allows multiple usecases, both those that require the transaction remain secret and those that anyone can release.
The introduction of a bounty mechanism was chosen as a lightweight incentive structure to encourage third parties (relayers) to execute scheduled transactions on behalf of the originator. This can be used to avoid reliance on external coordination or trust between accounts, and leverages the ledger’s native accounting to directly reward executors.
In other ecosystems, comparable features appear as “meta-transactions” or “intents” (e.g., in Ethereum’s ERC-4337 account abstraction or StarkNet’s transaction batching). These systems often include relayer markets, bundlers, or fee-sponsorship models. This spec deliberately takes a narrower approach: it does not change fee logic, multisignature, or transaction semantics. Instead, it extends the ledger’s object model in a way that feels natural to the XRPL: declarative, minimal, and enforceable by consensus rules.
11.1. Alternate Designs
The best usecase of this design will be for trading on the DEX and various kinds of stop orders. So one alternate design would be to narrow the scope of this to just offers, which could simplify the implementation greatly, since the offer could be directly placed instead of via a separate transaction. But it has a tradeoff of greatly limiting the scope of what is doable with the design.
n+1. Open Questions
Bountybe modifiable?Appendix
Appendix A: FAQ
A.1: Is this compatible with On-Chain Multisign?
It should be.
Beta Was this translation helpful? Give feedback.
All reactions