You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何获取Near地址中系统转入余额的相关交易数据?

解决NEAR地址系统转入余额数据获取问题

针对opp_near_disc.near地址的系统转入余额无法通过常规交易查询获取的问题,可尝试以下方法:

  • 使用EXPERIMENTAL_get_account_changes接口
    该RPC方法会返回账户所有状态变更记录,包括协议层面的区块奖励、质押分红等系统转入操作,示例请求:

    curl --location 'http://10.213.67.4:1332' \
    --header 'Content-Type: application/json' \
    --data '{
      "jsonrpc": "2.0",
      "id": "dontcare",
      "method": "EXPERIMENTAL_get_account_changes",
      "params": {
        "account_id": "opp_near_disc.near",
        "from_block_height": 0,
        "to_block_height": "latest"
      }
    }'
    

    返回结果中的changes字段会包含每一笔余额变动的详细信息,包括系统转入的来源和金额。

  • 查询交易所在区块的完整变更记录
    系统转账可能和目标交易处于同一区块,属于区块内部的协议操作,需先通过tx接口获取交易所在区块高度,再用block接口查询区块的完整变更:

    1. 获取交易所属区块:
      curl --location 'http://10.213.67.4:1332' \
      --header 'Content-Type: application/json' \
      --data '{
        "jsonrpc": "2.0",
        "id": "dontcare",
        "method": "tx",
        "params": ["2EKtqebYzGMA6fMsXo7G2roKcxdT1ApbHPNDKo6KYUSq",
          "opp_near_disc.near"]
      }'
      
      提取结果中的block_height值。
    2. 查询区块完整变更:
      curl --location 'http://10.213.67.4:1332' \
      --header 'Content-Type: application/json' \
      --data '{
        "jsonrpc": "2.0",
        "id": "dontcare",
        "method": "block",
        "params": {
          "block_id": "替换为上述区块高度",
          "include_transactions": true,
          "include_changes": true
        }
      }'
      
      在返回的changes数组中查找opp_near_disc.near的余额增加记录。
  • 检查合约内部转账记录
    如果系统转入来自特定合约的内部逻辑(如质押分红、合约奖励),需调用对应合约的查询接口。例如质押合约通常会提供查询奖励历史的方法,可通过view_function接口调用:

    curl --location 'http://10.213.67.4:1332' \
    --header 'Content-Type: application/json' \
    --data '{
      "jsonrpc": "2.0",
      "id": "dontcare",
      "method": "view_function",
      "params": {
        "account_id": "合约地址",
        "method_name": "查询奖励的方法名",
        "args": {"account_id": "opp_near_disc.near"}
      }
    }'
    

    具体方法名需参考合约文档或源码。

  • 确认私有节点同步状态
    若你的私有节点未同步完整历史数据,会导致查询缺失。可通过以下接口检查同步状态:

    curl --location 'http://10.213.67.4:1332' \
    --header 'Content-Type: application/json' \
    --data '{
      "jsonrpc": "2.0",
      "id": "dontcare",
      "method": "status"
    }'
    

    对比sync_info.latest_block_height与主网最新高度,确保节点完全同步。

内容的提问来源于stack exchange,提问作者Swornatoya

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.20 19:02:23