【问题标题】:BSC Token ExplorerBSC 代币浏览器
【发布时间】:2021-05-22 17:29:42
【问题描述】:

我正在寻找一种解决方案,以在币安智能链上获取所有可用的和新的 BEP-20 代币。我尝试使用 web3py 分析所有事务并从输入字段中提取令牌,但看起来不正确。我尝试了 BSCscan API、Pancakeswap API 和 Web3py,但没有人提供那个端点。

这是我目前获取所有交易的解决方案:

from web3 import Web3
import time

web3 = Web3(Web3.HTTPProvider('https://bsc-dataseed.binance.org/'))

def handle_event(event):
    try:
        transaction = web3.eth.getTransactionReceipt(event)
        print ('\n****************TRANSACTION****************')
        print (transaction)
        print ('*******************************************\n')
    except:
        pass

def log_loop(event_filter, poll_interval):
    while True:
        for event in event_filter.get_new_entries():
            handle_event(event)
        time.sleep(poll_interval)

def main():
    transactions = web3.eth.filter('pending')
    log_loop(transactions, 1)

if __name__ == '__main__':
    main()

使用 transaction.input 和内部日志,我会看到转移的令牌...

顺便说一句:这里有没有人有一个可行的解决方案来从输入中提取令牌而不手动切片字符串?

有人知道获得所有 BEP-20 令牌的更好方法吗?我的目标类似于:https://poocoin.app/ape

【问题讨论】:

    标签: python blockchain ethereum binance binance-smart-chain


    【解决方案1】:

    我在 BitQuery API 上取得了成功 - 您可以免费使用它来处理 X 次请求:https://graphql.bitquery.io/ide/WQfM3F2ZSz

    以上链接适用于所有基于以太坊的新代币,但您可以查看共享查询或编写自己的查询以获取 BSC 代币。

    【讨论】:

      猜你喜欢
      • 2021-07-20
      • 1970-01-01
      • 2021-07-22
      • 2021-11-13
      • 1970-01-01
      • 2022-08-14
      • 2022-07-30
      • 2022-08-21
      • 2022-08-02
      相关资源
      最近更新 更多