# create unsigned transaction
txn = transaction.ApplicationCreateTxn(
sender,
params,
on_complete,
approval_program,
clear_program,
global_schema,
local_schema,
extra_pages=extra_pages
)
msig = multisig()
# create a SignedTransaction object
multisig_transaction = MultisigTransaction(txn, msig)
# sign transaction
signed_txn = multisig_transaction.sign(private_key)
tx_id = signed_txn.transaction.get_txid()
# send transaction
client.send_transactions([signed_txn])
I keep getting a TypeError: 'int' object is not iterable
.
cusma
2
Yes, MultiSig Accounts have all the capabilities of any other Algorand Accounts.
Here is the Python example from MultiSig transactions documentation:
# create a multisig account
version = 1 # multisig version
threshold = 2 # how many signatures are necessary
msig = Multisig(version, threshold, [account_1, account_2])
print("Multisig Address: ", msig.address())
print("Please go to: https://bank.testnet.algorand.network/ to fund multisig account.", msig.address())
# input("Please go to: https://bank.testnet.algorand.network/ to fund multisig account." + '\n' + "Press Enter to continue...")
# Specify your node address and token. This must be updated.
algod_address = "" # ADD ADDRESS
algod_token = "" # ADD TOKEN
# Initialize an algod client
algod_client = algod.AlgodClient(algod_token, algod_address)
# get suggested parameters
params = algod_client.suggested_params()
# comment out the next two (2) lines to use suggested fees
params.flat_fee = True
params.fee = 1000
# create a transaction
sender = msig.address()
recipient = account_3
amount = 10000
note = "Hello Multisig".encode()
txn = PaymentTxn(sender, params, recipient, amount, None, note, None)
# create a SignedTransaction object
mtx = MultisigTransaction(txn, msig)
# sign the transaction
mtx.sign(private_key_1)
mtx.sign(private_key_2)
# send the transaction
txid = algod_client.send_raw_transaction(
encoding.msgpack_encode(mtx))
# wait for confirmation
try:
confirmed_txn = wait_for_confirmation(algod_client, txid, 4)
print("Transaction information: {}".format(
json.dumps(confirmed_txn, indent=4)))
print("Decoded note: {}".format(base64.b64decode(
confirmed_txn["txn"]["txn"]["note"]).decode()))
except Exception as err:
print(err)
1 Like