0

我想以编程方式获取 BscScan 上显示的数据,但他们的 API 似乎非常有限,我想避免解析 HTML 内容来提取它。

我想知道是否可以找到公开此数据的 REST API。例如,如果https://bsc-dataseed.binance.org公开 REST 端点。

如果我理解正确,该 URL 应该实现这个规范:https://github.com/ethereum/execution-apis,在这里:https://github.com/ethereum/execution-apis/blob/main/src/eth /transaction.json我可以看到 eth_getTransactionByHash,这听起来与我正在寻找的完全一样,但我不确定如何/是否可以访问它。

谢谢。

4

1 回答 1

1

您可以使用 web3/ethers 直接从节点获取交易收据。

 // 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');

BSC 的 RPC 端点:https ://docs.binance.org/smart-chain/developer/rpc.html

于 2021-11-24T07:10:42.567 回答