Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

synchronize peer and channel data in fiber network #787

Open
rabbitz opened this issue Sep 20, 2024 · 2 comments
Open

synchronize peer and channel data in fiber network #787

rabbitz opened this issue Sep 20, 2024 · 2 comments
Assignees

Comments

@rabbitz
Copy link

rabbitz commented Sep 20, 2024

Create or Update Fiber Peer

  • POST /api/v2/fiber/peers
  • request
    {
      "name": "test", # Peer alias
      "rpc_listening_addr": "http://127.0.0.1:8227",  # Peer listening address
      "peer_id": "QmVCtxcWjouWHyfsjzjJCP18YDdfiYfBMMqxKwF9wmB6CT"  # Peer ID
    }
  • response
    • If the peer_id validation succeeds, it returns 204 No Content.
    • If the peer_id validation fails, the response is as follows, where detail contains the error message returned by the RPC:
      [
        {
            "title": "fiber peer params invalid",
            "detail": "not support hash code at line 1 column 60",
            "code": 2010,
            "status": 404
        }
      ]

Peers list

  • GET /api/v2/fiber/peers
  • params
    • page # default is 1
    • page_size # default is 10
  • response
  {
     "data": {
         "fiber_peers": [
             {
                 "name": "test",
                 "peer_id": "QmVCtxcWjouWHyfsjzjJCP18YDdfiYfBMMqxKwF9wmB6CT",
                 "rpc_listening_addr": "http://127.0.0.1:8227",
                 "first_channel_opened_at": null,
                 "last_channel_updated_at": null,
                 "channels_count": 1,
                 "total_local_balance": "193800000000.0"
             }
         ]
     },
   "meta": {
           "total": 1,
           "page_size": 10
   }
 }

Peer detail

  • GET /api/v2/fiber/peers/{peer_id}
  • response
    {
        "data": {
            "peer_id": "QmVCtxcWjouWHyfsjzjJCP18YDdfiYfBMMqxKwF9wmB6CT",
            "rpc_listening_addr": "http://127.0.0.1:8227",
            "first_channel_opened_at": null,
            "last_channel_updated_at": null,
            "fiber_channels": [
              {
                  "peer_id": "QmdYroJM6VAmWGqRHa2GCEvxBTUE7Q4eW4gcm38M8foYxy",
                  "channel_id": "0xf6c9802ef1baeef8f18c0c15887652e76d97244388771c178e2929cee11c4e41",
                  "state_name": "CHANNEL_READY",
                  "state_flags": []
              },
              ...
          ]
        }
    }

Channel detail

  • GET /api/v2/fiber/channels/{channel_id}
  • response
    {
        "data": {
            "channel_id": "0xf74c5362e7b5639a936b67acd1e761b4693a063f3956e35bfc0875aabcf6e96f",
            "state_name": "CHANNEL_READY",
            "state_flags": [],
            "shutdown_at": null,
            "created_at": "2024-09-12T09:22:42.000+08:00",
            "updated_at": "2024-09-19T20:41:23.111+08:00",
            "local_balance": "193800000000.0",
            "offered_tlc_balance": "0.0",
            "remote_balance": "0.0",
            "received_tlc_balance": "0.0"
        }
    }
@Keith-CY
Copy link
Member

Keith-CY commented Sep 23, 2024

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
Copy link
Member

Frontend PR: Magickbase/ckb-explorer-frontend#426

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗 In Progress
Development

No branches or pull requests

2 participants