-3

I need to get all transactions from aa address on bsc. I tried bscscan api but it doesn't give everything like burning minting actions, they just give transfers , how can I get all transactions with web3 js or web3 py. I would appreciate if someone can help me

TylerH
  • 20,799
  • 66
  • 75
  • 101
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jan 17 '22 at 10:11

1 Answers1

0

You need scan all block and found that you need. This is very bad way. Other way -- you can use API

check etherscan.io api you can get a list of all transactions easily as an alternative

https://etherscan.io/apis

http://api.etherscan.io/api?module=account&action=txlist&address=0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae&startblock=0&endblock=99999999&sort=asc&apikey=YourApiKeyToken

and work with this answer. This is easy way, but no easy way to get all transaction via web3js or web3py.

But if you need only specified events -- that was much easy.

you need function getPastEvents

const START_BLOCK = 7700000;
const END_BLOCK = 7701000;
contract.getPastEvents("allEvents",
    {                               
        fromBlock: START_BLOCK,     
        toBlock: END_BLOCK // You can also specify 'latest'          
    })                              
.then(events => console.log(events))
.catch((err) => console.error(err));

You can set mint or burn events only.

https://web3js.readthedocs.io/en/v1.2.11/web3-eth-contract.html#getpastevents

lesnik
  • 76
  • 2