Skip to main content
A transaction that transfers HBAR and tokens between Hedera accounts. You can enter multiple transfers in a single transaction. The net value of HBAR between the sending accounts and receiving accounts must equal zero. For a CryptoTransferTransactionBody:
  • Max of 10 balance adjustments in its HBAR transfer list.
  • Max of 10 fungible token balance adjustments across all its token transfer list.
  • Max of 10 NFT ownership changes across all its token transfer list.
  • Max of 20 balance adjustments or NFT ownership changes implied by a transaction (including custom fees).
  • If you are transferring a token with custom fees, only two levels of nesting fees are allowed.
  • The sending account is responsible to pay for the custom token fees.
Transaction Fees
  • Please see the transaction and query fees table for the base transaction fee
  • Please use the Hedera fee estimator to estimate your transaction fee cost
Spender Account Allowances An account can have another account spend tokens on its behalf. If the delegated spender account is transacting tokens from the owner account that authorized the allowance, the owner account needs to be specified in the transfer transaction by calling one of the following:
  • addApprovedHbarTransfer()
  • addApprovedTokenTransfer()
  • addApprovedNftTransfer()
  • addApprovedTokenTransferWithDecimals()
The debiting account is the owner’s account when using this feature.
Note: The allowance spender must pay the fee for the transaction.
Transaction Signing Requirements
  • The accounts the tokens are being debited from are required to sign the transaction
    • If an authorized spender account is spending on behalf of the account that owns the tokens then the spending account is required to sign
  • The transaction fee-paying account is required to sign the transaction

Constructor

ConstructorDescription
new TransferTransaction()Initializes the TransferTransaction object

Transaction Properties

MethodTypeRequirement
addHbarTransfer(<accountId, amount>)AccountId, HbarRequired
addTokenTransfer(<tokenId, accountId, amount>)TokenId, AccountId, longOptional
addNftTransfer(<nftId, sender, receiver>)NftId, AccountId, AccountIdOptional
addTokenTransferWithDecimals(<tokenId, accountId, amount, decimals>)TokenId, AccountId, long, intOptional
addApprovedHbarTransfer(<ownerAccountId, amount>)AccountId, HbarOptional
addApprovedTokenTransfer(<tokenId, ownerAccountId, amount>)TokenId, AccountId, longOptional
addApprovedNftTransfer(<nftId, sender, receiver>)NftId, AccountId, AccountIdOptional
addApprovedTokenTransferWithDecimals(<tokenId, ownerAccountId, amount, decimals>)TokenId, AccountId, long, intOptional
setHighVolume(<highVolume>)booleanOptional
This transaction supports high-volume entity creation (HIP-1313) when the transfer auto-creates new accounts. Setting setHighVolume(true) routes the account-creation portion of the transfer through dedicated high-volume throttle capacity with variable-rate pricing. The transfer portion itself uses standard throttles regardless of this flag. Always pair this with setMaxTransactionFee() to cap your costs.
// Create a transaction to transfer 1 HBAR 
TransferTransaction transaction = new TransferTransaction()
     .addHbarTransfer(OPERATOR_ID, new Hbar(-1))
     .addHbarTransfer(newAccountId, evmAddress, new Hbar(1));

//Submit the transaction to a Hedera network
TransactionResponse txResponse = transaction.execute(client);

//Request the receipt of the transaction
TransactionReceipt receipt = txResponse.getReceipt(client);

//Get the transaction consensus status
Status transactionStatus = receipt.status;

System.out.println("The transaction consensus status is " +transactionStatus);

//Version 2.0.0

Get Transaction Values

MethodTypeDescription
getHbarTransfers()Map<AccountId, Hbar>Returns the HBAR transfers
getTokenTransfers()Map<TokenId, Map<AccountId, long>>Returns the token transfers
getTokenNftTransfers()Map<TokenId, List<TokenNftTransfer>>Returns the NFT transfers
getHighVolume()booleanReturns whether this transaction uses high-volume throttles
// Create a transaction 
CryptoTransferTransaction transaction = new CryptoTransferTransaction()
    .addSender(OPERATOR_ID, new Hbar(1)
    .addRecipient(newAccountId, new Hbar(1));

//Get transfers
List<Transfer> transfers = transaction.getTransfers();

//v2.0.0