Overspend account

Hello everyone, I am trying to develop my first transaction on the algorithm blockchain.
I created an account with the following address: 3YQ4XKUUELUN64C3PSV5BIF42BWOQ6V76X55IYHIJDOM6DRBO6A2A2BFVU.
I have funded it and I can find the financing transaction and the account balance processed by AlgorandExplorer but when i run the function:

account_info = algod_client.account_info (my_address)
    print ("Account Balance: {} microAlgos" .format (account_info.get ("amount")))

I get as result: account balance: 0 microAlgos
and then the transaction with the function:

txid = algod_client.send_transaction (signed_txn)

fails to succeed, obviously returning an error like:

transaction W44Y2ZHU6A3TBWPOQ2QFO5Y244JW6KQJY4PN7QPEJ255WMVIAIYQ: overspend (account 3YQ4XKUUELUN64C3PSV5BIF42BWOQ6V76X55IYHIJDOM6DRBO6A2A2BFVU

would anyone be able to tell me why despite my balance of 20 algos is present on algorithand explorer and my account has been funded, do I get these results? thank you very much for helping

  1. are you sure algod_client is connected to testnet?
  2. are you sure your transaction does not attempt to send more than 20 algos?

try to go to www.a-wallet.net, in the settings set the testnet, import the account and try to do the transaction

1 Like

I imported my account and set up testnet, but I always get the same overspend error.
My code is this:

import json

import base64

from algosdk import account, mnemonic

from algosdk.v2client import algod

from algosdk.future.transaction import PaymentTxn

def generate_algorand_keypair():

    private_key, address = account.generate_account()

    print("My address: {}".format(address))

    print("My private key: {}".format(private_key))

    print("My passphrase: {}".format(mnemonic.from_private_key(private_key)))

def first_transaction_examples(private_key, my_address):

    algod_address = "http://localhost:4001"

    algod_token = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

    algod_client = algod.AlgodClient(algod_token, algod_address)

    print("my address : {}".format(my_address))

    account_info = algod_client.account_info(my_address)

    print("Account Balance: {} microAlgos".format(account_info.get("amount")))

    params = algod_client.suggested_params()

    #params.flat_fee = True

    #params.fee = 1000

    receiver = "HZ57J3K46JIJXILONBBZOHX6BKPXEM2VVXNRFSUED6DKFD5ZD24PMJ3MVA"

    note = "Hello WOrld".encode()

    unsigned_txn = PaymentTxn(my_address, params, receiver, 10, None, note)

    signed_txn = unsigned_txn.sign(private_key)

    txid = algod_client.send_transaction(signed_txn)

    print("sucesfully sent transaction with txID : {}".format(txid))

    try:

        confirmed_txn = wait_for_confirmation(algod_client, txid, 4)

    except Exception as err:

        print(err)

        return

    print("Transaction information : {}".format(

             json.dumps(confirmed_txn, indent = 4)))

    print("Decode note : {}".format(base64.b64decode(

             confirmed_txn["txn"]["txn"]["note"].decode())))

    account_info = algod_client.account_info(my_address)

    print("Account balance: {} microAlgos".format(account_info.get('amount')))

def wait_for_confirmation(client, transaction_id, timeout):

    start_round = client.status()["last-round"]+1

    current_round = start_round

    while current_round < start_round + timeout :

        try:

            pending_txn = client.pending_transaction_info(transaction_id)

        except Exception:

            print(err)

            return

        if pending_txn.get("confirmed-round", 0) > 0:

            return pending_txn

        elif pending_txn["pool-error"]:

            raise Exception (

            'pool error: {}'.format(pending_txn["pool-error"]))

            client.status_after_block(current_round)

            current_round += 1

        raise Exception("pending tx not found in timeout rounds, timeout value = : {}".format(timeout))


It is because the local algod instance has not synced and is unaware of your actual balance.

do goal network status to see if your node is caught up.

can you clarify in more detail, both how to use the goal network status command and how to synchronize local algod instance? Thank you

I’m assuming you want to be on TestNet, as 3YQ4XKUUELUN64C3PSV5BIF42BWOQ6V76X55IYHIJDOM6DRBO6A2A2BFVU has 20 Algos only on TestNet.

Assuming that:

Then just run

goal node status

You should see something like:

Last committed block: 17202780
Time since last block: 3.4s
Sync Time: 0.0s
Last consensus protocol: https://github.com/algorandfoundation/specs/tree/bc36005dbd776e6d1eaf0c560619bb183215645c
Next consensus protocol: https://github.com/algorandfoundation/specs/tree/bc36005dbd776e6d1eaf0c560619bb183215645c
Round for next consensus protocol: 17202781
Next consensus protocol supported: true
Last Catchpoint:
Genesis ID: testnet-v1.0
Genesis hash: SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=

importantly:

If one of the first two conditions is not satisfied, wait until they are (the last committed block should increase regularly - if it does not, please post, you have another issue).
If your node is NOT archival, you can speed up the process using fast catchup: Install a node - Algorand Developer Portal

If the last condition (Genesis ID) is not satisfied, then you’re not on TestNet. To switch network, see Switch Networks - Algorand Developer Portal

1 Like