Problem with SDK

I’m get as response a loop with this error message: https://sdk-testnet.aepps.com/v2/transactions/th_2PTsdwb6YqSNXf5uPctLimcHUTWUZsig24kwU6BeD6GSDByXRd/info 404

Initialy, we think that was because we need to send all the funds in the sender account and it haven’t enough balance to cover fee and gas, but we verify that it have enough balance and the message persist

Can anybody help me?

2 Likes

Hi @sgcvzla.chain,

The transaction lifecycle is as follows:

  1. The user creates a transaction locally and signs it
  2. The user posts that transaction to a node. The node does some checks for the transaction, for example if the authentication is correct, if the nonce looks ok (it should be greater than the last used nonce but not too big). The amounts of the account are not checked at this point. If the transaction passes all tests - it enters the transaction pool, the node broadcasts it to his peers, they do similar checks and broadcast it to their peers and so on. If a check fails - a proper error is being returned to the SDK.
  3. Once the transaction reaches the generation leader, one tries including it in a block. This is when accounts’ balances are checked, the nonce must be last_nonce + 1 and so on. If the checks pass - the transaction gets included in a micro block and gets a block hash :slight_smile: If a check does not pass - the transaction is being postponed for a later block.
  4. If a transaction is not included a lot of times (256 generations by default), it gets kicked out of the transaction pool.

The error I am seeing from the URL above is

{"reason":"Transaction not found"}

This could happen in the following cases:

  • the transaction was never posted to a node
  • wrong transaction hash
  • the checks of step 2 above failed
  • the transaction had been invalid for some time (256 generations by default) and was garbage collected from the transaction pool

This is how the node works. Given just a hash to a missing transaction - this is the best I could do. If I had to do a wild guess, that would be the third bullet. Yet, it does not look like an SDK issue :slight_smile:

Hopefully that helps you.

5 Likes

Thanks @dimitar.chain

I am only using this sentence:


The red arrow is the line it’s failed

I don’t know what I’m doing wrong

Since this is a SDK question now, I summon @bruteforce.chain.

2 Likes

Can you provide also the data that you called the contract with or tx-hash. What does the logged error say?

By the way, this is a very low-level usage of the contract call.

You can use contract.methods.method_name(...args, { ...options}) instead

for example:
const transferTokens = await contract.methods.transfer(ak_123, 2)

3 Likes

Ok, thank you @bruteforce.chain, I will try and let you know the results

@bruteforce.chain, I tried the way you recommend me and get the following message:

Error: While calling postTransaction (body), POST to https://sdk-testnet.aepps.com/v2/transactions failed with 400: Invalid tx

1 Like

Since the checks failed, @sgcvzla.chain something is wrong with the transaction you produce…

1 Like

I solved the problem of my application by removing the call to the contract function, I am doing the calculations that I need in my application and I am only sending the funds from one account to another, it is not the most “decentralized” solution, but it works, we will continue studying and learning, to perform this contract implementation in a next version

1 Like