【问题标题】:Solana listen for new transactions on certain wallet (with Solana.py)Solana 监听特定钱包上的新交易(使用 Solana.py)
【发布时间】:2022-10-20 15:01:11
【问题描述】:

我需要从 python 代码中监听某个钱包上的新交易(solana 转账) 从这些交易中,我需要获取发件人的钱包以及转移了多少 solan

我还需要从某些钱包中获取交易(solana 转账)

我需要通过 solana 付款(在我的 react+django 中) web-app) 也许我的方法不是最正确的

在文档中我发现了accountSubscribelogsSubscribesignatureSubscribe ,但我不明白什么是签名、日志,我可以从我订阅的帐户中获得新的转账吗

async with connect("wss://api.devnet.solana.com") as websocket:
    # this code works with devnet, how can i subscribe on mainnet?
    await websocket.logs_subscribe()
    first_resp = await websocket.recv()
    print(f'{first_resp = }')
    subscription_id = first_resp.result
    print(f'{subscription_id = }')
    next_resp = await websocket.recv()
    print(next_resp)

【问题讨论】:

    标签: python payment solana solana-py


    【解决方案1】:

    一种可能的解决方法是使用getBlockHeightgetBlock 的组合查看最近的块,并检查其中的所有交易。

    为了改善这一点,脚本只能在检测到钱包公钥上的getBalance 发生变化时迭代块。


    我正在研究一个最小的示例,并尽快将其提供给这个答案。

    【讨论】:

      猜你喜欢
      • 2022-11-05
      • 2012-05-31
      • 2021-10-30
      • 1970-01-01
      • 1970-01-01
      • 2022-07-28
      • 1970-01-01
      • 2012-07-08
      • 2022-06-14
      相关资源
      最近更新 更多