Role-based Account Key
AccountKeyRoleBased represents a role-based key. If an account has an AccountKeyRoleBased object and the transaction type is one except account update, the validation process is done according to each roles like below:
Import extend from web3py_ext to extend web3 to kaia web3
Import necessary utils from eth_account, web3py_ext and cytools
Create a Web3 instance with the specified kairos testnet URL
Also, you can change the provider URL from kairos to quicknode.
Load 3 accounts from private key
Creating an empty transaction of type TxType.ACCOUNT_UPDATE. You can use empty_tx util to get a tx with default fields filled.
Merge additional fields like sender and keys into the empty tx by using the merge util.
In this case, the account key to update is the role-based key and the possible key type of each role is the legacy, public or multisig.
You can use the compressed_key util to set each role key. It will extract the compressed public key from the key
Use fill_transaction to add more params to transaction object like gas limit...
You can use the to_pretty util to print the formatted tx.
Sign the account update tx type. You must sign it with the loaded update_role account
Sending the signed transaction to the network and waiting receipt until it is completely executed in the blockchain