Class AccountCreateTransaction


public final class AccountCreateTransaction extends Transaction<AccountCreateTransaction>
  • Constructor Details

    • AccountCreateTransaction

      public AccountCreateTransaction()
      Constructor.
    • AccountCreateTransaction

      AccountCreateTransaction(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
    • AccountCreateTransaction

      AccountCreateTransaction(TransactionBody txBody)
      Constructor.
      Parameters:
      txBody - protobuf TransactionBody
  • Method Details

    • getKey

      @Nullable public Key getKey()
      Extract the key.
      Returns:
      the creating account's key
    • setKey

      Deprecated.
      The identifying key for this account. This key represents the account owner, and is required for most actions involving this account that do not modify the account itself. This key may also identify the account for smart contracts.

      This field is REQUIRED. This `Key` MUST NOT be an empty `KeyList` and MUST contain at least one "primitive" (i.e. cryptographic) key value.

      Parameters:
      key - the key for this account.
      Returns:
      this
    • setKeyWithAlias

      public AccountCreateTransaction setKeyWithAlias(Key key)
      Sets ECDSA private key, derives and sets it's EVM address in the background. Essentially does setKey(Key) + setAlias(EvmAddress)
      Parameters:
      key -
      Returns:
      this
    • setKeyWithAlias

      public AccountCreateTransaction setKeyWithAlias(Key key, Key ecdsaKey)
      Sets the account key and a separate ECDSA key that the EVM address is derived from. A user must sign the transaction with both keys for this flow to be successful.
      Parameters:
      key -
      ecdsaKey -
      Returns:
      this
    • setKeyWithoutAlias

      public AccountCreateTransaction setKeyWithoutAlias(Key key)
      Sets key where it is explicitly called out that the alias is not set
      Parameters:
      key -
      Returns:
      this
    • getInitialBalance

      public Hbar getInitialBalance()
      Extract the amount in hbar.
      Returns:
      the initial balance for the new account
    • setInitialBalance

      public AccountCreateTransaction setInitialBalance(Hbar initialBalance)
      An amount, in tinybar, to deposit to the newly created account.

      The deposited amount SHALL be debited to the "payer" account for this transaction.

      Parameters:
      initialBalance - the initial balance.
      Returns:
      this
    • getReceiverSignatureRequired

      public boolean getReceiverSignatureRequired()
      Is the receiver required to sign?
      Returns:
      is the receiver required to sign
    • setReceiverSignatureRequired

      public AccountCreateTransaction setReceiverSignatureRequired(boolean receiveSignatureRequired)
      A flag indicating the account holder must authorize all incoming token transfers.

      If this flag is set then any transaction that would result in adding hbar or other tokens to this account balance MUST be signed by the identifying key of this account (that is, the `key` field).
      If this flag is set, then the account key (`key` field) MUST sign this create transaction, in addition to the transaction payer.

      Parameters:
      receiveSignatureRequired - true to require a signature when receiving hbars.
      Returns:
      this
    • getProxyAccountId

      @Nullable @Deprecated public AccountId getProxyAccountId()
      Deprecated.
      with no replacement Extract the proxy account id.
      Returns:
      the proxy account id
    • setProxyAccountId

      @Deprecated public AccountCreateTransaction setProxyAccountId(AccountId proxyAccountId)
      Deprecated.
      with no replacement Set the ID of the account to which this account is proxy staked. Use `staked_id` instead.
      An account identifier for a staking proxy.
      Parameters:
      proxyAccountId - the proxy account ID.
      Returns:
      this
    • getAutoRenewPeriod

      @Nullable public Duration getAutoRenewPeriod()
      Extract the duration for the auto renew period.
      Returns:
      the duration for auto-renew
    • setAutoRenewPeriod

      public AccountCreateTransaction setAutoRenewPeriod(Duration autoRenewPeriod)
      Set the auto renew period for this account.

      A Hederaâ„¢ account is charged to extend its expiration date every renew period. If it doesn't have enough balance, it extends as long as possible. If the balance is zero when it expires, then the account is deleted.

      This is defaulted to 3 months by the SDK.

      Parameters:
      autoRenewPeriod - the auto renew period for this account.
      Returns:
      this
    • getMaxAutomaticTokenAssociations

      public int getMaxAutomaticTokenAssociations()
      Extract the maximum automatic token associations.
      Returns:
      the max automatic token associations
    • setMaxAutomaticTokenAssociations

      public AccountCreateTransaction setMaxAutomaticTokenAssociations(int amount)
      A maximum number of tokens that can be auto-associated with this account.
      By default this value is 0 for all accounts except for automatically created accounts (e.g. smart contracts), which default to -1.

      If this value is `0`, then this account MUST manually associate to a token before holding or transacting in that token.
      This value MAY also be `-1` to indicate no limit.
      This value MUST NOT be less than `-1`.

      Parameters:
      amount - the amount of tokens
      Returns:
      this
    • getAccountMemo

      public String getAccountMemo()
      Extract the account memo.
      Returns:
      the account memo
    • setAccountMemo

      public AccountCreateTransaction setAccountMemo(String memo)
      A short description of this Account.

      This value, if set, MUST NOT exceed `transaction.maxMemoUtf8Bytes` (default 100) bytes when encoded as UTF-8.

      Parameters:
      memo - the memo
      Returns:
      this
    • getStakedAccountId

      @Nullable public AccountId getStakedAccountId()
      ID of the account to which this account will stake
      Returns:
      ID of the account to which this account will stake.
    • setStakedAccountId

      public AccountCreateTransaction setStakedAccountId(@Nullable AccountId stakedAccountId)
      Set the account to which this account will stake
      Parameters:
      stakedAccountId - ID of the account to which this account will stake.
      Returns:
      this
    • getStakedNodeId

      @Nullable public Long getStakedNodeId()
      The node to which this account will stake
      Returns:
      ID of the node this account will be staked to.
    • setStakedNodeId

      public AccountCreateTransaction setStakedNodeId(@Nullable Long stakedNodeId)
      ID of the node this account is staked to.

      If this account is not currently staking its balances, then this field, if set, SHALL be the sentinel value of `-1`.
      Wallet software SHOULD surface staking issues to users and provide a simple mechanism to update staking to a new node ID in the event the prior staked node ID ceases to be valid.

      Parameters:
      stakedNodeId - ID of the node this account will be staked to.
      Returns:
      this
    • getDeclineStakingReward

      public boolean getDeclineStakingReward()
      If true, the account declines receiving a staking reward. The default value is false.
      Returns:
      If true, the account declines receiving a staking reward. The default value is false.
    • setDeclineStakingReward

      public AccountCreateTransaction setDeclineStakingReward(boolean declineStakingReward)
      If true, the account declines receiving a staking reward. The default value is false.
      Parameters:
      declineStakingReward - - If true, the account declines receiving a staking reward. The default value is false.
      Returns:
      this
    • getAlias

      @Nullable public EvmAddress getAlias()
      The bytes to be used as the account's alias.

      The bytes must be formatted as the calcluated last 20 bytes of the keccak-256 of the ECDSA primitive key.

      All other types of keys, including but not limited to ED25519, ThresholdKey, KeyList, ContractID, and delegatable_contract_id, are not supported.

      At most only one account can ever have a given alias on the network.

    • setAlias

      public AccountCreateTransaction setAlias(EvmAddress alias)
      The bytes to be used as the account's alias.

      The bytes must be formatted as the calcluated last 20 bytes of the keccak-256 of the ECDSA primitive key.

      All other types of keys, including but not limited to ED25519, ThresholdKey, KeyList, ContractID, and delegatable_contract_id, are not supported.

      At most only one account can ever have a given alias on the network.

      Parameters:
      alias - The ethereum account 20-byte EVM address
      Returns:
      this
    • setAlias

      public AccountCreateTransaction setAlias(String aliasEvmAddress)
      The ethereum account 20-byte EVM address to be used as the account's alias. This EVM address may be either the encoded form of the shard.realm.num or the keccak-256 hash of a ECDSA_SECP256K1 primitive key.

      A given alias can map to at most one account on the network at a time. This uniqueness will be enforced relative to aliases currently on the network at alias assignment.

      If a transaction creates an account using an alias, any further crypto transfers to that alias will simply be deposited in that account, without creating anything, and with no creation fee being charged.

      Parameters:
      aliasEvmAddress - The ethereum account 20-byte EVM address
      Returns:
      this
      Throws:
      IllegalArgumentException - when evmAddress is invalid
    • getHooks

      public List<HookCreationDetails> getHooks()
      Get the hook creation details for this account.
      Returns:
      a copy of the hook creation details list
    • addHook

      public AccountCreateTransaction addHook(HookCreationDetails hookDetails)
      Add a hook creation detail to this account.
      Parameters:
      hookDetails - the hook creation details to add
      Returns:
      this
    • setHooks

      public AccountCreateTransaction setHooks(List<HookCreationDetails> hookDetails)
      Set the hook creation details for this account.
      Parameters:
      hookDetails - the list of hook creation details
      Returns:
      this
    • build

      Build the transaction body.
      Returns:
      CryptoCreateTransactionBody
    • validateChecksums

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

      void initFromTransactionBody()
      Initialize from the transaction body.
    • 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<AccountCreateTransaction,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<AccountCreateTransaction>
    • 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<AccountCreateTransaction>