Skip to content

Cron

[Source]

(Added by the Cron amendment.)

A Cron object represents a scheduled Hook execution created by a CronSet transaction. The Cron engine automatically inserts pseudo-transactions of type Cron into the ledger when scheduled executions are due.

{
"Owner": "rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm",
"OwnerNode": "0000000000000000",
"StartTime": 816348759,
"RepeatCount": 3,
"DelaySeconds": 120,
"PreviousTxnID": "5463C6E08862A1FAE5EDAC12D70ADB16546A1F674930521295BC082494B62924",
"PreviousTxnLgrSeq": 6,
"LedgerEntryType": "Cron",
"index": "49647F0D748DC3FE26BDACBC57F251AADEFFF391403EC9BF87C97F67E9977FB0"
}

A Cron object has the following fields:

FieldJSON TypeInternal TypeRequired?Description
OwnerStringAccountIDYesThe account that owns the scheduled Hook execution. This is the account that will be invoked when the cron executes.
OwnerNodeStringUInt64YesA hint indicating which page of the owner’s directory links to this object, in case the directory consists of multiple pages. Note: The object does not contain a direct link to the owner directory containing it, since that value can be derived from the Owner.
StartTimeNumberUInt32YesRipple Epoch timestamp when the first execution should occur. Use 0 for immediate execution. See Specifying Time for details.
RepeatCountNumberUInt32YesNumber of times the cron should execute. Can be extended via subsequent CronSet transactions. Maximum 256 per transaction, but can be extended beyond this limit.
DelaySecondsNumberUInt32YesTime interval in seconds between each execution. Maximum of 31,536,000 seconds (365 days).
PreviousTxnIDStringHash256YesThe identifying hash of the transaction that most recently modified this object.
PreviousTxnLgrSeqNumberUInt32YesThe [index of the ledger][Ledger Index] that contains the transaction that most recently modified this object.
LedgerEntryTypeStringUInt16YesThe value 0x0061, mapped to the string Cron, indicates that this object is a Cron object.

The ID of a Cron object is the SHA-512Half of the following values, concatenated in order:

  • The Cron space key (0x0076)
  • The timestamp of the StartTime field
  • The randomized AccountID of the Owner field

When a cron is ready to execute, the Cron engine inserts a pseudo-transaction of type Cron into the ledger. This pseudo-transaction contains an Owner field referencing the originating Hook account. The scheduled Hook will be invoked automatically at the specified intervals without requiring external triggers.

Hook developers must enable collect calls (hsfCOLLECT flag) on their Hooks, as the Owner constitutes a weak transactional stakeholder (TSH) when the Cron pseudo-transaction executes.