Skip to content

Transfer Tokens

This guide will walk you through the process of transferring tokens on ParallelChain Mainnet / Testnet.

Creating Transaction with a Transfer Command

To create a transaction, you first need to know the nonce of your account, which is an account-related entity required to submit a transaction. Here's how to check your account's nonce using pchain_client:

./pchain_client query nonce --address <YOUR_ACCOUNT_ADDRESS>
./pchain_client.exe query nonce --address <YOUR_ACCOUNT_ADDRESS>

When you run this command, you'll see the output of your account's nonce value, like this:


Next, to transfer tokens from your account to someone else's account using pchain_client, you need to create a transaction file containing one transfer command first.

./pchain_client transaction create \
--nonce <NONCE> \
--gas-limit <GAS_LIMIT> \
--max-base-fee-per-gas <MAX_BASE_FEE_PER_GAS> \
--priority-fee-per-gas <PRIORITY_FEE_PER_GAS> \
transfer \
--recipient <RECIPIENT_ADDRESS> \
./pchain_client.exe transaction create `
--nonce <NONCE> `
--gas-limit <GAS_LIMIT> `
--max-base-fee-per-gas <MAX_BASE_FEE_PER_GAS> `
--priority-fee-per-gas <PRIORITY_FEE_PER_GAS> `
transfer `
--recipient <RECIPIENT_ADDRESS> `

A file with the name tx.json will be saved in the current directory if the destination flag is not specified. If you want to store the transaction file in your preferred location, specify the path with your preferred file name and JSON extension under the destination flag.

Please note that max-base-fee-per-gas had to be at least 8.

Make sure to replace

  • <NONCE> with your account's nonce value;
  • <GAS_LIMIT> with the gas limit of the transaction;
  • <MAX_BASE_FEE_PER_GAS> with the maximum base fee you want to pay;
  • <PRIORITY_FEE_PER_GAS> with the priority fee you want to pay;
  • <RECIPIENT_ADDRESS> with the recipient's account address;
  • <AMOUNT_TO_TRANSFER> with the number of tokens you want to transfer;

Submitting Transaction

./pchain_client transaction submit --file <PATH_TO_TRANSACTION_FILE> --keypair-name <KEYPAIR_NAME>
./pchain_client transaction submit `
--keypair-name <KEYPAIR_NAME>

After submitting the transaction to RPC successfully, you should receive a message that describes the content of the transaction. The transaction hash in the content will be useful later on when you want to check its status. Still, transactions may fail for various reasons. We suggest you test the transaction and estimate the gas used in the testnet.

Querying Transaction

You can check the transaction status using pchain_client with the following command:

./pchain_client query tx --hash <TRANSACTION_HASH> 
./pchain_client.exe query tx --hash <TRANSACTION_HASH>

Make sure to replace <TRANSACTION_HASH> with the transaction hash that you want to check.

Creating Transaction with Multiple Transfer Commands

You may append an extra transfer transaction with pchain_client. After creating a transaction with single transfer command in the last tutorial, instead of submitting the transaction, you can append extra command on the tx.json generated by pchain_client.

./pchain_client transaction append \
transfer \
--recipient <RECIPIENT_ADDRESS> \
./pchain_client.exe transaction append `
transfer `
--recipient <RECIPIENT_ADDRESS> `

Currently, if you construct a transaction with pchain_client, the fields nonce, gas limit, max base fee per gas and priority fee per gas are already filled in after calling command create. You need to manually change the transaction JSON file if you want to change them:

After chaining up commands you are satisfied with, you can submit the transaction as you did in a single command transaction.