Why do I get the error: should have been authorized by XXX but was actually authorized by XXX

from algosdk.future import transaction
import algosdk

address1 = "TRUEABSJQIA52Y5E66UHYZ3RHSX4FMSOOPEY6WB7LD353X5OB4URPELTWU"
address2 = "NULLBVADAP7DFQPIXF6PFC5PCNOOTKVY46XV7Z3ABGV4N6NAVVJEICPKW4"
blankaddr = algosdk.logic.get_application_address(85231970)
print(blankaddr)

algod_client = algosdk.v2client.algod.AlgodClient(algod_address="https://node.testnet.algoexplorerapi.io", headers={"User-Agent": "algosdk"}, algod_token="")
print(f"{algod_client.suggested_params().min_fee/1000000}Algo is the current minfee")

suggested_params = algod_client.suggested_params()
suggested_params.fee = suggested_params.min_fee
suggested_params.flat_fee = True

txn1 = transaction.PaymentTxn(address1, suggested_params, address1, 0, rekey_to=blankaddr)
txn2 = transaction.PaymentTxn(address2, suggested_params, address2, 0, rekey_to=blankaddr)
secretkey = algosdk.mnemonic.to_private_key(input("25 word seed verified"))
secretkey1 = algosdk.mnemonic.to_private_key(input("25 word seed unverified"))
algod_client.send_transaction(txn1.sign(secretkey))
algod_client.send_transaction(txn2.sign(secretkey1))

I do apologize for my silly mistakes

txn1 should be signed by the private key of address-1
txn2 should be signed by the private key of address -2

if you get this error even after doing the same, then one of the accounts was rekey-ed to a different account.

1 Like

yeah I swear i have been doing that, thanks for your help though

Iā€™m honestly such an idiot I forgot I did it yesterday :slight_smile:
Thanks for your help