Multisig Account Key
AccountKeyWeightedMultiSig is an account key type containing a threshold and WeightedPublicKeys which contains a list consisting of a public key and its weight.
In order for a transaction to be valid for an account associated with AccountKeyWeightedMultiSig, the following conditions should be satisfied: _ The weighted sum of the signed public keys should be larger than the threshold. _ The invalid signature should not be included in the transaction. * The number of signed public keys should be less than the number of weightedPublicKeys.
Import extend from web3py_ext to extend web3 to kaia web3
Import necessary utils from web3 and eth_account
Define a web3 connection using Web3.HTTPProvider and RPC endpoint
Also, you can change the provider URL from baobab to allthatnode
Define 3 diffent wallet from addresses and private keys using Account.from_key_pair
Create an empty transaction of type TxType.VALUE_TRANSFER. You can use empty_tx util to get a tx with default fields filled.
Create a transaction with from, to and value fields to transfer.
from: the sender's address, to: target address to receive kaia.
value field means how many kaia you want to send and you can use the Web3.to_peb utils to convert kaia to peb unit.
Use fill_transaction to add rest of the fields of the transaction like gas limit, Nonce, etc. You can print all the fields after this line if you want to see
Sign the transaction with the user1's private key
Sign the signed_tx with the user2 and user3 private keys
Sending the signed transaction to the network and waiting receipt until it is completely executed in the blockchain
Recover user1 address with Account.recover_transaction from signed transaction from user3