Create a schedule transaction
A ScheduleCreateTransaction
is a consensus node transaction that creates a schedule entity on the Hedera network. The entity ID for a schedule transaction is called a ScheduleID
. After successfully executing a schedule create transaction, you can retrieve the network assigned ScheduleID
by requesting the transaction receipt. The receipt also includes the scheduled transaction ID, which can be used to request the record of the scheduled transaction after its successful execution.
When creating a transaction to schedule you do not need to use .freezeWith(client)
method.
Example:
Refer to this page to view the types of transactions that can be scheduled.
Schedule Transaction Duplicate
If two users submit the same ScheduleCreateTransaction
, the first transaction to reach consensus will create the schedule ID.
For example, if User A and User B submit the same scheduled transaction and User A's transaction reaches consensus first, User B's transaction will return the status IDENTICAL_SCHEDULE_ALREADY_CREATED
. If User B is required to sign the scheduled transaction, they must submit and sign a ScheduleSignTransaction
to add their signature.
Schedule Transaction Deletion
To retain the ability to delete a schedule transaction, you will need to set the admin key field when creating a schedule transaction. The admin key will be required to sign the ScheduleDeleteTransaction
to delete the scheduled transaction from the network. If you do not assign an admin key during the creation of the schedule transaction, you will have an immutable schedule transaction.
Transaction Signing Requirements
The signature of the account paying for the creation of the schedule transaction
The signature of the payer account responsible for covering the execution fees of the scheduled transaction. For example, if you are scheduling a transfer transaction, the assigned transaction fee payer must provide a signature. If no transaction fee payer account is specified, the schedule's transaction fee payer account will be used by default to cover the execution fees.
The admin key signature, if set
You can optionally sign with any of the required signatures for the scheduled transaction. Freeze the schedule transaction and call the
.sign()
method to add signatures in this transaction.
Transaction Properties
Schedulable Transaction Body
The transaction body of the transaction that is being scheduled. Ex. Transfer Transaction
Admin Key
A key that can delete the schedule transaction prior to execution or expiration
Payer Account ID
The account which is going to pay the transaction fees for the execution of the scheduled transaction. If not populated, the account paying for the schedule transaction will be charged (optional).
Expiration Time
A timestamp for specifying when the transaction should be evaluated for execution and then expire (optional). The maximum allowed value is 62 days (5356800 seconds).
Wait for Expiry
Set the transaction to execute at the specified expiration time. The default behavior is to execute at the time the minimum number of signatures are received (optional).
Memo
Publicly visible information about the schedule entity, up to 100 bytes. No guarantee of uniqueness (optional).
Methods
setScheduledTransaction(<transaction>)
Transaction<?>
Required
setAdminKey(<key>)
Key
Optional
setPayerAccountId(<id>)
AccountId
Optional
setScheduleMemo(<memo>)
String
Optional
setExpirationTime(expirationTime)
Instant
Optional
setWaitForExpiry()
boolean
Optional
getAdminKey()
Key
Optional
getPayerAccountId()
AccountId
Optional
getScheduleMemo()
String
Optional
Last updated