最近看常常遇到生态合作伙伴征询通过api查寻交易和节点数据寄存的问题

常呈现

{    "id": 1,    "jsonrpc": "2.0",    "result": null}

返回是null .

通常这种状况是须要本人的节点须要关上 persit_index 配置。而本人运行节点时,这个配置很容易疏忽。
具体方法如下:
HTTP RPC端口在toml配置文件里通过jsonrpc_tcp_port指定,其它还有jsonrpc_ws_port、jsonrpc_tcp_port、jsonrpc_http_port、jsonrpc_local_tcp_port、jsonrpc_local_http_port。能够参考release里提供的tethys.toml默认配置文件。默认的数据寄存在运行门路(pwd)下的blockchain_db和storage_db里。能够通过配置文件里的conflux_data_dir和block_db_dir别离配置。须要留神如果须要拜访老的receipt数据的话,须要把persist_tx_index设置为true.


存储交易索引,以便通过RPC拜访历史数据:

  1. 在tethys.toml文件减少 persist_tx_index=true
  2. conflux --config tethys.toml

确认规定:

咱们当初的是否确认的判断条件跟以太坊不一样,rpc提供了两个接口用于判断confirm

  1. https://developer.conflux-cha...

    当 返回值/(2^256) <= 1/10^8 示意确认,这个是pivot chain switch的概率

  2. https://developer.conflux-cha...

    这个rpc传参 latest_confirmed ,返回的就是最近的confirm的epoch,这个epoch大于等于你所查问交易所在的epoch时示意已被确认。这个外部判断逻辑跟第一条是一样的


相干资料库:

  • Conflux开发材料包
  • conflux-chain github
  • conflux-fans github