Schedule Transaction
Overview
A scheduled transaction is a type of transaction that allows you to publicly collect all the required signatures on the network. For example, Transaction A requires signatures from Alice, Bob, and Carol. Alice can schedule and sign Transaction A using the schedule transaction. Alice also specifies an expiry time for Transaction A during creation. Once the schedule transaction is successfully executed and posted on the network Alice can call Bob and Carol to sign the transaction. Bob and Carol can sign the schedule transaction by submitting a schedule sign transaction.
Transaction A will automatically execute once it receives the minimum required signatures. However, if the required signatures are not received by the specified expiry time, Transaction A will not execute. Alice can optionally set the transaction to execute automatically at its expiry time. In this case, even if all required signatures are applied to the transaction, the transaction will wait until the expiry time to execute.
Unlike other Hedera transactions, this one allows you to queue a transaction for future execution (up to two months into the future). This feature is ideal for transactions that require multiple signatures and would benefit from being submitted on-chain.
The transaction types that can be scheduled in a schedule transaction as of Hedera Services Release 0.57 are the following:
TransferTransaction
TokenMintTransaction
TokenBurnTransaction
AccountCreateTransaction
AccountUpdateTransaction
FileUpdateTransaction
SystemDeleteTransaction
SystemUndeleteTransaction
FreezeTransactions
ContractExecuteTransaction
ContractCreateTransaction
ContractUpdateTransaction
ContractDeleteTransaction
Transaction Throttles
Schedule transactions are throttled based on the transaction they contain. For example, a scheduled transaction containing the transaction type of “CryptoTransfer” would be throttled as defined here.
Creating a Schedule Transaction
When a schedule transaction is created, the following information will need to be specified in the ScheduleCreateTransaction
.
Scheduled Transaction ID
The Transaction ID of the transaction that needs to be scheduled. You will need to create the transaction that you would like to schedule prior to creating the schedule transaction. Once you have created the transaction you want to schedule, you will need to specify that transaction ID in this field.
Admin Key
Setting an admin key on a schedule transaction allows the user to cancel or delete the schedule transaction, if needed. This key is optional to set. If this key is not set upon creation, the transaction cannot be deleted.
Expiration Time
The expiration time is a timestamp for specifying when the transaction should be evaluated for execution and then expire. The maximum allowed value is 62 days (5356800 seconds).
Scheduled Transactions will execute at the earliest available consensus time after their expiration time on a best-effort basis.
Wait for Expiry
The default behavior for a scheduled transaction is to automatically execute when the required number signatures for the transaction are received . If the transaction should wait for the specified expiry time to send the transaction to the network, you can optionally enable the wait_for_expiry flag.
When set to true, the transaction will be evaluated for execution at expiration_time instead of when all required signatures are received.
When this flag is set to false, the transaction will execute immediately after sufficient signatures are received
Payer Account ID
The account ID of the account responsible for paying the transaction fees of the scheduled transaction. This field is optional. If not set, the transaction fee payer for the schedule transaction defaults to the transaction fee payer account of the scheduled transaction.
Schedule Memo
Publicly visible text that is stored with the schedule transaction and can be viewed in a network explorer up to 100 bytes and does not include the zero byte.
Signing and Submitting a Schedule Transaction
Before submitting your scheduled transaction, you must sign it with the key of the account responsible for paying the schedule transaction fees and, optionally, the key of the transaction fee payer account for the scheduled transaction, if specified. Additionally, if your signature is required for the scheduled transaction, you can sign the ScheduleCreateTransaction
using that key.
After a ScheduleCreateTransaction
successfully executes, the receipt will include the schedule ID and the scheduled transaction ID. The schedule ID is a unique identifier used to reference the created schedule transaction. The scheduled transaction ID represents the transaction scheduled by the schedule transaction. Scheduled transaction IDs include a ?scheduled
flag at the end (e.g., 0.0.1234@1615422161.673238162?scheduled
), indicating it is a scheduled transaction. This ID inherits the valid start time and the account ID from the original schedule transaction.
You can request the current state of a schedule transaction by querying the network for ScheduleGetInfoQuery
using the schedule ID. The request will return the following information:
Schedule ID
Account ID that created the schedule transaction
Account ID that paid for the creation of the scheduled transaction
Transaction body of the transaction that was scheduled
Transaction ID for the transaction that was scheduled
Current list of signatures
Admin key (if any)
Expiration time
The timestamp of when the transaction was deleted, if true
Signing the Scheduled Transaction
After the schedule transaction is submitted, the scheduled transaction becomes available for on-chain signing. Required parties can use a ScheduleSignTransaction
to add their signatures to the scheduled transaction. Once the minimum number of signatures is collected, the transaction will automatically execute, unless it is configured to wait until the expiry timestamp.
Scheduled Transaction Record
Once the schedule transaction successfully executes, the transaction record is made available. To get the transaction record for the scheduled transaction after successful execution, you can do the following:
Poll the network for the specified scheduled transaction ID. Once the schedule transaction executes the scheduled transaction successfully, request the record for the scheduled transaction using the scheduled transaction ID.
Query a Hedera mirror node for the scheduled transaction ID.
Run your own mirror node and query for the scheduled transaction ID.
Deleting a schedule transaction
A schedule transaction can be deleted if an admin key was set during its creation. If no admin key was set, the schedule transaction cannot be deleted.
Tutorial/Examples
FAQ
Last updated