Key length must be 58

Good morning,
I have created an application in teal that works correctly, everything works as it should but when once the smart contract is created I try to send a transaction of type: ApplicationNoOpTxn ()
I get error like: WrongKeyLengthError key length must be 58.

This happens only when my transaction contains the parameter of type “accounts” while if I remove that parameter the transactions all start as requested without giving problems.
Below I attach the code:

params = algod_client.suggested_params()

    params.flat_fee = True

    params.fee = 2000

    sender = account.address_from_private_key(user_private_key)

    argomento = ["add_escrow".encode("utf-8"), intToBytes(1)]

   

    acc = "VC7VDZKS7MQWN2X4BXPCOGF3LYPVVZMOQGL7MR2X63RSXRH7JKCOJL7IQY"

    # create unsigned transaction

    txn = transaction.ApplicationNoOpTxn(sender, params, app_id, app_args= argomento, accounts =acc )

    # sign transaction

    signed_txn = txn.sign(user_private_key)

    tx_id = signed_txn.transaction.get_txid()

    # send transaction

    algod_client.send_transactions([signed_txn])

    # wait confirmation

    wait_for_confirmation(algod_client, tx_id)

    print("SENT APPLICATION TRANSACTION WITH ID : ", tx_id)

    argomento2 = ["remove_escrow".encode("utf-8"), intToBytes(1)]

    acc2 = "ZOHDOWYQTKJPUXR7PPRSJFW4FRNIHZ2B74POKNSMSKCB56LZCMPTRIQ2N4"

    params2 = algod_client.suggested_params()

    params2.flat_fee = True

    params2.fee = 1000

    # create unsigned transaction

    txn2 = transaction.ApplicationNoOpTxn(sender, params2, app_id, app_args= argomento2)

    # sign transaction

    signed_txn2 = txn2.sign(user_private_key)

    tx_id2 = signed_txn2.transaction.get_txid()

    # send transaction

    algod_client.send_transactions([signed_txn2])

    # wait confirmation

    wait_for_confirmation(algod_client, tx_id2)

    print("SENT APPLICATION TRANSACTION WITH ID : ", tx_id2)

The second transaction starts while the first is being signed by this type of problem.
Could someone help me and explain how to correctly start the ApplicationNoOpTxn transaction with the accounts parameter inside it?
Thank you very much for helping !

Answered this in discord but for posterity the first ApplicationNoOpTxn was passing the acct string as the accts array, the fix was just wrapping acc in a list:

txn = transaction.ApplicationNoOpTxn(sender, params, app_id, app_args= argomento, accounts =[acc] )
1 Like