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 web3py_ext
Create a Web3 instance with the specified kaia Baobab testnet URL
Also, you can change the provider URL from baobab to allthatnode.
Define 3 different accounts using Account.from_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 keys to update is the mutisig key and each key inside contains a compressed public key and its weight. The compressed_key util 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 all 3 loaded accounts
Sending the signed transaction to the network and waiting receipt until it is completely executed in the blockchain