[Solved] [@aeternity/aepp-sdk v6.0.0] Errors while calling contract methods simultaneously on testnet

yes, I do think so

Hey Philipp. Hope you are doing fine.

I am wondering if there a reliable way to determine the next correct nonce right before contract call.

Consider the next example:

  1. A current account nonce is 1
  2. 5 transactions are in the mempool waiting to be mined.
  3. I want to call smart contract one more time, but I only know that the last nonce is 1 and incrementing it to 2 will not work, because we already have 5 transactions in the mempool. (Hence the nonce 2 is used already)

Can you advise some workaround for such case?

You could first fetch the current nonce of the account
e.g. https://testnet.aeternity.io/v2/accounts/ak_2VnwoJPQgrXvreUx2L9BVvd9BidWwpu1ASKK1AMre21soEgpRT

then look at the current mempool and filter relevant transactions there:
https://testnet.aeternity.io/v2/debug/transactions/pending

1 Like

Thank you. It worked for us.

However, on the main net, this URL does not work https://sdk-mainnet.aepps.com/v2/debug/transactions/pending and JS SDK aeternity.mempool() call returns 404 as well.

Do you have any idea why it happens?
Also, https://sdk-mainnet.aepps.com/v2/accounts/{pubkey}/transactions/pending always returns empty list of transactions.

Is there any other way to find out pending transactions coming from certain account?

you will need to host your own node for that, as you can see the endpoint includes debug these are not exposed by the hosted mainnet nodes usually

Thank you, Philipp

As I understand, JS sdk mempool() method uses this endpoint internally.

Is this correct using this endpoint in production at all?
If no, is there any other way to retrieve the mempool data?

Also, how can I enable this for our own node. It returns 404 by default. Is there a config entry responsible for that?

yes

sure you can use it in production, its just not intended to be “public” for nodes

you have to add

http:
  internal:
    port: 3113
    listen_address: 0.0.0.0
    debug_endpoints: true

to your aeternity.yaml

Thank you Philipp. I tried to apply those entries to the configuration on my localhost node in order to do some tests, but I couldn’t reach the localhost:3113/api, and no process in the system using the 3113 port. Node logs also seems to be quite clean. Is there anything else I should do in order to be able to access it?

Config:

http:
  internal:
    port: 3113
    listen_address: 0.0.0.0
    debug_endpoints: true

Config validation info:

=INFO REPORT==== 22-May-2020::06:41:23 ===
    validation: "/home/aeternity/.aeternity/aeternity/aeternity.yaml"
    result: [{ok,#{<<"chain">> =>
                       #{<<"garbage_collection">> => #{<<"enabled">> => true}},
                   <<"http">> =>
                       #{<<"internal">> =>
                             #{<<"debug_endpoints">> => true,
                               <<"listen_address">> => <<"0.0.0.0">>,
                               <<"port">> => 3113}}}}]

this will not be an endpoint, but the /v2/debug/ ones should be exposed there.

TBH this should work, maybe you can compare with this setup using docker-compose and see if this works for you, then find your way from there: aeternity-workshop/node-docker-setup at master · thepiwo/aeternity-workshop · GitHub

So it should be listening on 3113

Thank you. It is. I just had to expose the 3113 port from docker container.

1 Like