How to configure the rpc port and data storage path of your own node

Recently, ecological partners often consult us about searching transactions and node data storage through API.

They often encounter this kind of problem:

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

The return value is null .

Usually this is because your own node needs to open the persit_index configuration. When running the node by yourself, this configuration is easily overlooked.
The specific method is as follows:
The HTTP RPC port is specified by jsonrpc_tcp_port in the toml configuration file. Others include jsonrpc_ws_port, jsonrpc_tcp_port, jsonrpc_http_port, jsonrpc_local_tcp_port, jsonrpc_local_http_port. You can refer to the tethys.toml default configuration file provided in the release. The default data is stored in blockchain_db and storage_db under the running path (pwd). It can be configured separately through conflux_data_dir and block_db_dir in the configuration file. It should be noted that if you need to access the old receipt data, you need to set persist_tx_index to true.

Store transaction index to access historical data through RPC:

  1. Add persist_tx_index=true to the tethys.toml file
  2. conflux --config tethys.toml

Confirmation rules:

Our current judgment condition for confirming is different from that of Ethereum. RPC provides two interfaces for judging confirm.

  1. https://developer.conflux-chain.org/docs/conflux-doc/docs/json_rpc#cfx_getconfirmationriskbyhash

    When the return value /(2^256) <= 1/10^8 means confirmation, this is the probability of pivot chain switch

  2. https://developer.conflux-chain.org/docs/conflux-doc/docs/json_rpc#cfx_epochnumber
    This rpc passes the latest_confirmed parameter, and it returns the latest confirmed epoch. When this epoch is greater than or equal to the epoch of the exchange you are querying, it means it has been confirmed. This internal judgment logic is the same as the first one