0

I am trying to get the recent IN transaction of the account while i try

web3.eth.getTransactionCount("0xF092966e7bcc2b5646e0F0c20A715584DB37cd4B").then(function(trans){
    console.log(trans);
});

This returns account transactions count.

I refer web3 documentation and refer net i found the script getTransactionsByAccount Common useful JavaScript snippets for geth

Is any another way to find IN transaction of the account using web3.js . Lastest last IN transaction is enough .

1 Answer 1

1

I think it would be easier and faster to use Amberdata.io. If you get a free api key then you can do the following to get the latest IN transaction.

It would look something like this:

curl \
  -X GET \
  -H "x-api-key: UAK000000000000000000000000demo0001" \
"https://web3api.io/api/v1/addresses/0xF092966e7bcc2b5646e0F0c20A715584DB37cd4B/transactions?to=0xF092966e7bcc2b5646e0F0c20A715584DB37cd4B&size=1"

The transactions are returned ordered by timestep. The to filters by a to address. In this case we want all transactions where the to address is the address we are querying and we want the first one so I put size=1. Although if you remove that you'll get every IN transaction.

Hope that helps! 😊

6
  • Thank you @foba . is amberdata api free of use ? Commented Dec 5, 2018 at 5:34
  • is any API for getting blocks between timestamp/date ? Commented Dec 5, 2018 at 5:51
  • 1
    Yup it is free to use! It's free and easy to get an api key.
    – foba
    Commented Dec 5, 2018 at 15:37
  • i am not able to find the limit of amberdata API . what is the limit for this API perday/perminute/persecond ? Commented Dec 6, 2018 at 12:57
  • 1
    As far I know there's currently no rate limit. Is it working for you?
    – foba
    Commented Dec 6, 2018 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.