The schedule created SHALL contain the `scheduledTransactionBody` to be executed.
If successful the receipt SHALL contain a `scheduleID` with the full identifier of the schedule created.
When a schedule _executes_ successfully, the receipt SHALL include a `scheduledTransactionID` with the `TransactionID` of the transaction that executed.
When a scheduled transaction is executed the network SHALL charge the regular _service_ fee for the transaction to the `payerAccountID` for that schedule, but SHALL NOT charge node or network fees.
If the `payerAccountID` field is not set, the effective `payerAccountID` SHALL be the `payer` for this create transaction.
If an `adminKey` is not specified, or is an empty `KeyList`, the schedule created SHALL be immutable.
An immutable schedule MAY be signed, and MAY execute, but SHALL NOT be deleted.
If two schedules have the same values for all fields except `payerAccountID` then those two schedules SHALL be deemed "identical".
If a `scheduleCreate` requests a new schedule that is identical to an existing schedule, the transaction SHALL fail and SHALL return a status code of `IDENTICAL_SCHEDULE_ALREADY_CREATED` in the receipt.
The receipt for a duplicate schedule SHALL include the `ScheduleID` of the existing schedule and the `TransactionID` of the earlier `scheduleCreate` so that the earlier schedule may be queried and/or referred to in a subsequent `scheduleSign`. #### Signature Requirements A `scheduleSign` transaction SHALL be used to add additional signatures to an existing schedule.
Each signature SHALL "activate" the corresponding cryptographic("primitive") key for that schedule.
Signature requirements SHALL be met when the set of active keys includes all keys required by the scheduled transaction.
A scheduled transaction for a "long term" schedule SHALL NOT execute if the signature requirements for that transaction are not met when the network consensus time reaches the schedule `expiration_time`.
A "short term" schedule SHALL execute immediately once signature requirements are met. This MAY be immediately when created. #### Long Term Schedules A "short term" schedule SHALL have the flag `wait_for_expiry` _unset_.
A "long term" schedule SHALL have the flag `wait_for_expiry` _set_.
A "long term" schedule SHALL NOT be accepted if the network configuration `scheduling.longTermEnabled` is not enabled.
A "long term" schedule SHALL execute when the current consensus time matches or exceeds the `expiration_time` for that schedule, if the signature requirements for the scheduled transaction are met at that instant.
A "long term" schedule SHALL NOT execute before the current consensus time matches or exceeds the `expiration_time` for that schedule.
A "long term" schedule SHALL expire, and be removed from state, after the network consensus time exceeds the schedule `expiration_time`.
A short term schedule SHALL expire, and be removed from state, after the network consensus time exceeds the current network configuration for `ledger.scheduleTxExpiryTimeSecs`. > Note >> Long term schedules are not (as of release 0.56.0) enabled. Any schedule >> created currently MUST NOT set the `wait_for_expiry` flag.
>> When long term schedules are not enabled, schedules SHALL NOT be >> executed at expiration, and MUST meet signature requirements strictly >> before expiration to be executed. ### Block Stream Effects If the scheduled transaction is executed immediately, the transaction record SHALL include a `scheduleRef` with the schedule identifier of the schedule created.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.hedera.hashgraph.sdk.Transaction
Transaction.SignableNodeTransactionBodyBytesNested classes/interfaces inherited from class com.hedera.hashgraph.sdk.Executable
Executable.GrpcRequest -
Field Summary
Fields inherited from class com.hedera.hashgraph.sdk.Transaction
customFeeLimits, DEFAULT_AUTO_RENEW_PERIOD, defaultMaxTransactionFee, DUMMY_ACCOUNT_ID, DUMMY_TRANSACTION_ID, frozenBodyBuilder, innerSignedTransactions, outerTransactions, publicKeys, regenerateTransactionId, signers, sigPairLists, sourceTransactionBody, transactionIdsFields inherited from class com.hedera.hashgraph.sdk.Executable
attemptedAllNodes, blockingUnaryCall, grpcDeadline, logger, maxAttempts, maxBackoff, minBackoff, nodeAccountIds, nodes, random, RST_STREAM -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Constructor. -
Method Summary
Modifier and TypeMethodDescription(package private) ScheduleCreateTransactionBody.Builderbuild()Build the correct transaction body.Extract the admin key.Get the expiration time(package private) io.grpc.MethodDescriptor<Transaction, TransactionResponse> Called to direct the invocation of the query to the appropriate gRPC service.Get the payer's account ID.Extract the schedule's memo.(package private) voidInitialize from the transaction body.booleanget the status of the waitForExpiry boolean(package private) voidonFreeze(TransactionBody.Builder bodyBuilder) Called inTransaction.freezeWith(Client)just before the transaction body is built.(package private) voidonScheduled(SchedulableTransactionBody.Builder scheduled) Called inTransaction.schedule()when converting transaction into a scheduled version.setAdminKey(Key key) A `Key` required to delete this schedule.setExpirationTime(Duration expirationTime) Overload: set the expiration time using a Duration value.setExpirationTime(Instant expirationTime) An optional timestamp for specifying when the transaction should be evaluated for execution and then expire.setPayerAccountId(AccountId accountId) An account identifier of a `payer` for the scheduled transaction.setScheduledTransaction(Transaction<?> transaction) Assign the transaction to schedule.(package private) ScheduleCreateTransactionAssign the transaction body to schedule.setScheduleMemo(String memo) A short description of the schedule.setWaitForExpiry(boolean waitForExpiry) When set to true, the transaction will be evaluated for execution at expiration_time instead of when all required signatures are received.(package private) voidvalidateChecksums(Client client) Methods inherited from class com.hedera.hashgraph.sdk.Transaction
addSignature, addSignature, batchify, buildAllTransactions, buildTransaction, doSchedule, estimateFee, freeze, freezeWith, fromBytes, fromScheduledTransaction, generateTransactionIds, getBatchKey, getDefaultMaxTransactionFee, getExecutionState, getHighVolume, getMaxTransactionFee, getRegenerateTransactionId, getRequiredChunks, getSignableNodeBodyBytesList, getSignatures, getSignaturesAtOffset, getTransactionBodySize, getTransactionHash, getTransactionHashPerNode, getTransactionId, getTransactionIdInternal, getTransactionMemo, getTransactionSize, getTransactionValidDuration, hash, isBatchedAndNotBatchTransaction, isFrozen, keyAlreadySigned, makeRequest, mapResponse, mapResponseStatus, onExecute, onExecuteAsync, regenerateTransactionId, requireNotFrozen, requireOneNodeAccountId, schedule, setBatchKey, setHighVolume, setMaxTransactionFee, setNodeAccountIds, setRegenerateTransactionId, setTransactionId, setTransactionMemo, setTransactionValidDuration, sign, signTransaction, signWith, signWithOperator, spawnBodyBuilder, toBytes, toString, wipeTransactionListsMethods inherited from class com.hedera.hashgraph.sdk.Executable
advanceRequest, checkNodeAccountIds, execute, execute, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, getGrpcRequest, getMaxAttempts, getMaxBackoff, getMaxRetry, getMinBackoff, getNodeAccountIds, getNodeForExecute, grpcDeadline, logTransaction, mergeFromClient, setGrpcDeadline, setLogger, setMaxAttempts, setMaxBackoff, setMaxRetry, setMinBackoff, setNodesFromNodeAccountIds, setRequestListener, setResponseListener, shouldRetryExceptionally
-
Constructor Details
-
ScheduleCreateTransaction
public ScheduleCreateTransaction()Constructor. -
ScheduleCreateTransaction
ScheduleCreateTransaction(LinkedHashMap<TransactionId, LinkedHashMap<AccountId, throws com.google.protobuf.InvalidProtocolBufferExceptionTransaction>> txs) Constructor.- Parameters:
txs- Compound list of transaction id's list of (AccountId, Transaction) records- Throws:
com.google.protobuf.InvalidProtocolBufferException- when there is an issue with the protobuf
-
-
Method Details
-
getExpirationTime
Get the expiration time- Returns:
- The expiration time
-
setExpirationTime
An optional timestamp for specifying when the transaction should be evaluated for execution and then expire. Defaults to 30 minutes after the transaction's consensus timestamp.Note: This field is unused and forced to be unset until Long Term Scheduled Transactions are enabled - Transactions will always expire in 30 minutes if Long Term Scheduled Transactions are not enabled.
- Parameters:
expirationTime- The expiration time- Returns:
this
-
setExpirationTime
Overload: set the expiration time using a Duration value.- Parameters:
expirationTime- The duration to be used as expiration time- Returns:
this
-
isWaitForExpiry
public boolean isWaitForExpiry()get the status of the waitForExpiry boolean- Returns:
- waitForExpiry boolean
-
setWaitForExpiry
When set to true, the transaction will be evaluated for execution at expiration_time instead of when all required signatures are received. When set to false, the transaction will execute immediately after sufficient signatures are received to sign the contained transaction. During the initial ScheduleCreate transaction or via ScheduleSign transactions. Defaults to false.Setting this to false does not necessarily mean that the transaction will never execute at expiration_time.
For Example - If the signature requirements for a Scheduled Transaction change via external means (e.g. CryptoUpdate) such that the Scheduled Transaction would be allowed to execute, it will do so autonomously at expiration_time, unless a ScheduleSign comes in to “poke” it and force it to go through immediately.
Note: This field is unused and forced to be unset until Long Term Scheduled Transactions are enabled. Before Long Term Scheduled Transactions are enabled, Scheduled Transactions will _never_ execute at expiration - they will _only_ execute during the initial ScheduleCreate transaction or via ScheduleSign transactions and will _always_ expire at expiration_time.
- Parameters:
waitForExpiry- Whether to wait for expiry- Returns:
this
-
getPayerAccountId
Get the payer's account ID.- Returns:
- The payer's account ID
-
setPayerAccountId
An account identifier of a `payer` for the scheduled transaction.This value MAY be unset. If unset, the `payer` for this `scheduleCreate` transaction SHALL be the `payer` for the scheduled transaction.
If this is set, the identified account SHALL be charged the fees required for the scheduled transaction when it is executed.
If the actual `payer` for the _scheduled_ transaction lacks sufficient HBAR balance to pay service fees for the scheduled transaction _when it executes_, the scheduled transaction SHALL fail with `INSUFFICIENT_PAYER_BALANCE`.- Parameters:
accountId- the payer's account ID- Returns:
this
-
setScheduledTransaction
Assign the transaction to schedule.- Parameters:
transaction- the transaction to schedule- Returns:
this
-
setScheduledTransactionBody
Assign the transaction body to schedule.- Parameters:
tx- the transaction body to schedule- Returns:
this
-
getAdminKey
Extract the admin key.- Returns:
- the admin key
-
setAdminKey
A `Key` required to delete this schedule.If this is not set, or is an empty `KeyList`, this schedule SHALL be immutable and SHALL NOT be deleted.
- Parameters:
key- the admin key- Returns:
this
-
getScheduleMemo
Extract the schedule's memo.- Returns:
- the schedule's memo
-
setScheduleMemo
A short description of the schedule.This value, if set, MUST NOT exceed `transaction.maxMemoUtf8Bytes` (default 100) bytes when encoded as UTF-8.
- Parameters:
memo- the schedule's memo- Returns:
this
-
build
Build the correct transaction body.- Returns:
builder
-
initFromTransactionBody
void initFromTransactionBody()Initialize from the transaction body. -
validateChecksums
- Specified by:
validateChecksumsin classTransaction<ScheduleCreateTransaction>- Throws:
BadEntityIdException
-
getMethodDescriptor
io.grpc.MethodDescriptor<Transaction,TransactionResponse> getMethodDescriptor()Description copied from class:ExecutableCalled to direct the invocation of the query to the appropriate gRPC service.- Specified by:
getMethodDescriptorin classExecutable<ScheduleCreateTransaction,Transaction, TransactionResponse, TransactionResponse>
-
onFreeze
Description copied from class:TransactionCalled inTransaction.freezeWith(Client)just before the transaction body is built. The intent is for the derived class to assign their data variant to the transaction body.- Specified by:
onFreezein classTransaction<ScheduleCreateTransaction>
-
onScheduled
Description copied from class:TransactionCalled inTransaction.schedule()when converting transaction into a scheduled version.- Specified by:
onScheduledin classTransaction<ScheduleCreateTransaction>
-