Class ScheduleCreateTransaction


public final class ScheduleCreateTransaction extends Transaction<ScheduleCreateTransaction>
Create a new Schedule. #### Requirements This transaction SHALL create a new _schedule_ entity in network state.
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.
  • Constructor Details

    • ScheduleCreateTransaction

      public ScheduleCreateTransaction()
      Constructor.
    • ScheduleCreateTransaction

      ScheduleCreateTransaction(LinkedHashMap<TransactionId,LinkedHashMap<AccountId,Transaction>> txs) throws com.google.protobuf.InvalidProtocolBufferException
      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

      @Nullable public Instant getExpirationTime()
      Get the expiration time
      Returns:
      The expiration time
    • setExpirationTime

      public ScheduleCreateTransaction setExpirationTime(Instant expirationTime)
      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

      public ScheduleCreateTransaction setExpirationTime(Duration expirationTime)
      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

      public ScheduleCreateTransaction 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. 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

      @Nullable public AccountId getPayerAccountId()
      Get the payer's account ID.
      Returns:
      The payer's account ID
    • setPayerAccountId

      public ScheduleCreateTransaction setPayerAccountId(AccountId accountId)
      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

      public ScheduleCreateTransaction setScheduledTransaction(Transaction<?> transaction)
      Assign the transaction to schedule.
      Parameters:
      transaction - the transaction to schedule
      Returns:
      this
    • setScheduledTransactionBody

      ScheduleCreateTransaction setScheduledTransactionBody(SchedulableTransactionBody tx)
      Assign the transaction body to schedule.
      Parameters:
      tx - the transaction body to schedule
      Returns:
      this
    • getAdminKey

      @Nullable public Key getAdminKey()
      Extract the admin key.
      Returns:
      the admin key
    • setAdminKey

      public ScheduleCreateTransaction setAdminKey(Key key)
      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

      public String getScheduleMemo()
      Extract the schedule's memo.
      Returns:
      the schedule's memo
    • setScheduleMemo

      public ScheduleCreateTransaction setScheduleMemo(String memo)
      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

      void validateChecksums(Client client) throws BadEntityIdException
      Specified by:
      validateChecksums in class Transaction<ScheduleCreateTransaction>
      Throws:
      BadEntityIdException
    • getMethodDescriptor

      io.grpc.MethodDescriptor<Transaction,TransactionResponse> getMethodDescriptor()
      Description copied from class: Executable
      Called to direct the invocation of the query to the appropriate gRPC service.
      Specified by:
      getMethodDescriptor in class Executable<ScheduleCreateTransaction,Transaction,TransactionResponse,TransactionResponse>
    • onFreeze

      void onFreeze(TransactionBody.Builder bodyBuilder)
      Description copied from class: Transaction
      Called in Transaction.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:
      onFreeze in class Transaction<ScheduleCreateTransaction>
    • onScheduled

      void onScheduled(SchedulableTransactionBody.Builder scheduled)
      Description copied from class: Transaction
      Called in Transaction.schedule() when converting transaction into a scheduled version.
      Specified by:
      onScheduled in class Transaction<ScheduleCreateTransaction>