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).
Import extend from web3py_ext to extend web3 to kaia web3
Import necessary utils from eth_account, web3py_ext and cytoolz
Create a Web3 instance with the specified kairos testnet URL
Also, you can change the provider URL from kairos to quicknode
Load an account from private key
Load an account from private key
Create an empty transaction of type TxType.FEE_DELEGATED_VALUE_TRANSFER. You can use empty_tx util to get a tx with default fields filled.
Merge the additional fields like from, to and value into the empty tx by using the merge util.
You can use the Web3.to_peb util to convert decimal
Use fill_transaction to add more params to transaction object like gas limit...
Sign the value transfer tx by user's private key
Recover the signer's address from the signature in signed tx
Sign the value transfer tx by fee payer's private key
Recover the fee payer's address from the signature in signed tx
You can decode the RLP-encoded tx by the Account.decode_transaction util and if you want to make the output format pretty, use the to_pretty util
Send the tx to the blockchain. It will return the tx hash, which will be used to wait the receipt
The wait_for_transaction_receipt method returns the tx receipt if it is completed in the blockchain