Magickbase / ckb-explorer-public-issues

CKB Explorer Issues
https://explorer.nervos.org/
3 stars 2 forks source link

synchronize peer and channel data in fiber network #787

Open rabbitz opened 2 months ago

rabbitz commented 2 months ago

Create or Update Fiber Peer

Peers list

Channel detail

Keith-CY commented 2 months ago

Need support from the Fiber Network team to add RPCs for retrieving peer list and channel-open/close transaction list.

RPCs are expected to be added in 2 weeks.

Keith-CY commented 2 months ago

Frontend PR: https://github.com/Magickbase/ckb-explorer-frontend/pull/426

rabbitz commented 1 month ago

Graph Nodes

Graph Node Detail

Graph Channels

Keith-CY commented 1 month ago

Now we have basic data from graph_nodes and graph_channels RPC(https://github.com/nervosnetwork/fiber/tree/main/src/rpc#graph_nodes), following aggregated data can be supported further:

  1. total capacity of a graph node: summarize capacity of channels bound to a graph node
  2. open/close transaction of a graph channel: each graph channel has its own channel_outpoint, where the funding is. The transaction generates the output is an open transaction, while the transaction consumes it is a close one
  3. tokens in a graph channel: udt_cfg_infos is returned in graph node, the token info can be retrieved from the explorer's database according to the type script
  4. token in a graph channel: udt_type_script is returned in graph channel, and the token info can be retrieved from the explorer's database according to the type script
  5. nodes connected to a graph node: remote nodes connected to a graph node can be aggregated from its graph channels, for now, only the node id/pub key is necessary.

cc @rabbitz

rabbitz commented 1 month ago
  1. Graph Node Enhancements:

    • add total_capacity to the node list and details for capacity stats
    • include udt_cfg_infos in the node list and details to show UDT info like full_name, symbol, decimal, and icon_file
    • add connected_node_ids to show connected node IDs
  2. Graph Channel Enhancements:

    • add open_transaction_hash for the opening transaction
    • include udt_cfg_info in the channel details to show UDT information
Keith-CY commented 1 month ago
  1. Graph Node Enhancements:

    • add total_capacity to the node list and details for capacity stats
    • include udt_cfg_infos in the node list and details to show UDT info like full_name, symbol, decimal, and icon_file
    • add connected_node_ids to show connected node IDs
  2. Graph Channel Enhancements:

    • add open_transaction_hash for the opening transaction
    • include udt_cfg_info in the channel details to show UDT information

total capacity, udt info and connected nodes have been added.

I found that open transaction of a channel can be located, while a channel belongs to a node, so we can have a open transaction list of a node

image

It should cover open transaction of all open/closed channels, and can be sorted by time. Following fields of a transaction are required:


Speaking of channels of a node, I'm not sure if closed channels are listed in the response. I hope we can get the list of closed channel, either by the current API or a new API.


For the graph nodes API, I hope a new field that count of open channels can be added


To display the share of each node, e.g. capacity/udt_amount of node / total capacity/udt_amount in fiber network, I hope there could be an API of amount of various assets, e.g.

{
  "capacity": "100000",
  "udts": [
    {
      "type_hash": "type hash of RUST",
      "decimal": "8",
      "amount": "1000000",
      "symbol": "RUST"
    }
  ]
}

@rabbitz

rabbitz commented 1 month ago
  1. Graph Node Enhancements:

    • add open_channels_count to the node list
    • in node details, replace open_transaction_hash with outpoint_info in channel data:
      "outpoint_info": {
      "tx_hash": "0xb5044450a8f93f3b78b4dda13eb4a60210107c67e6de780f990d6e1cae1c953c",
      "block_number": 14983532,
      "block_timestamp": 1729582163892,
      "transaction_fee": 920,
      "funding_capacity": "106200000000.0",
      "funding_udt_amount": null,
      "funding_address": "ckt1qpkx0zrlugq7urrc20ckstqtwlqwvg2qgnq4d364sf5njz52lfkhcqfc6qhc4l5luvc5k0ma2ts8f826mjyqqhc0p2l7w"
      }
    • add status param filter to node details (open by default; returns closed channels when set to closed)
  2. Graph Channel Enhancements:

    • add outpoint_info to the channel list
  3. every 5 minutes, check open_channels; if the funding_cell is consumed, mark the channel as closed.

Keith-CY commented 4 days ago

Feature request from Cell Studio

  1. Support searching fiber: channel id, node id, node name, pubkey, rpc address

cc @rabbitz

rabbitz commented 1 day ago

Feature request from Cell Studio

  1. Support searching fiber: channel id, node id, node name, pubkey, rpc address

cc @rabbitz

  1. Added filter parameter q to the graph node list, supporting exact matches on alias, peer_id, and node_id.
  2. /api/v1/suggest_queries now supports graph node quires.

Issues:

  1. graph channel does not return the channel_id, so filtering is not supported.
  2. node_id is the public key; filter by node_id is now supported.

https://github.com/rabbitz/ckb-explorer/commit/76d5f195b22677ce38a3748899136ba7c5a88152