'Can I extract BSC transaction details programmatically without going through BscScan?
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.
Solution 1:[1]
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
Solution 2:[2]
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!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Peter Lai |
Solution 2 | andreassteiner |