Can I extract BSC transaction details programmatically without going through BscScan?

5k Views Asked by At

I would like to get the data that's displayed on BscScan programmatically, but their API seems quite limited, and I would like to avoid parsing HTML content to extract it.

I am wondering if I can find a REST API that exposes this data. Like if, for example, https://bsc-dataseed.binance.org exposes REST endpoints.

If I understand correctly, that URL should implement this spec: https://github.com/ethereum/execution-apis, and here: https://github.com/ethereum/execution-apis/blob/main/src/eth/transaction.json I can see eth_getTransactionByHash which sounds exactly like what I am looking for, but I am not sure how/if I can access this.

Thanks.

2

There are 2 best solutions below

0
On BEST ANSWER

You can use web3/ethers to get transaction receipt from node directly.

 // mainnet 
     const web3 = new Web3('https://bsc-dataseed1.binance.org:443');
// testnet
    const web3 = new Web3('https://data-seed-prebsc-1-s1.binance.org:8545');

And RPC endpoints for BSC: https://docs.binance.org/smart-chain/developer/rpc.html

0
On

A good jprc endpoint can be provided from web3api.com.

This page is created from the makers of bscscan and etherscan.

For what code lang do you need it? Can provide code for python!