Value Transfer
TxTypeValueTransfer is used when a user wants to send KAIA.
- As kaia provides multiple transaction types to make each transaction type serve a single purpose, TxTypeValueTransfer is limited to send KAIA to an externally owned account (EOA).
Fee Delegation
Import the ethers and @kaiachain/ethers-ext packages to add kaia features on ethers.js
Define sender address, sender private key and reciever address
Set up the provider with the specified kaia Baobab testnet URL. A provider in ethers is a read-only abstraction to access the blockchain data.
Also, you can change the provider URL from baobab to allthatnode
Create sender and fee payer wallets from private keys.
Declare transaction with the fields such as type, from, to, value.
Populating transaction with additional information with senderWallet.populateTransaction
Signing the transaction with the sender's private key
Send the transaction to blockchain using fee payer's wallet. Function sendTransactionAsFeePayer
adds a signature with FeePayer’s private key to the sender’s signature and transmits it to the blockchain network.
Wait for the transaction receipt.