Hey! I am trying to transfer funds from account1 to account2. Account1 has 50Algos Account2 has 20Algos but i am getting this error overspend, I realized that the amount the error says i try to spend, its a fee

This is the screenshot for an error i got.

def create_transaction():
    form = TransferForm(request.form)
    if request.method == 'POST' and form.validate():
        sender = form.sender.data
        receiver = form.receiver.data
        amount = (form.amount.data)

    # Debugging
        params = algod_client.suggested_params()
        params.flat_fee = True
        params.fee = 1000
        print(params, params.fee)
        unsigned_txn = PaymentTxn(sender,  params, receiver,  amount, None)
        #return unsigned_txn
    # End

            signed_txn = unsigned_txn.sign(mnemonic.to_private_key(session['passphrase']))

        except WrongChecksumError:
            return {"passphrase": "Checksum error"}
        except ValueError:
            return {"passphrase": "unknown word in the passphrase"}
        except WrongMnemonicLengthError: 
            return {"passphrase": "Incorrect size of the passprase"}
        transaction_id = algod_client.send_transaction(signed_txn)

        return transaction_id

Above code its my function that create transaction. Where am I getting it wrong?

thank you in advance


I suspect that the node you’re connected to haven’t caught up yet.