raiden-network / raiden-services

Development of the Raiden Monitoring and Pathfinding Services
MIT License
10 stars 18 forks source link

Build network visualization functionality in utils #9

Open err508 opened 6 years ago

err508 commented 6 years ago
err508 commented 6 years ago
GodzillaDaThrilla commented 6 years ago

Very interested in contributing on this front but need an API of some sort to providing the network data

palango commented 6 years ago

@GodzillaDaThrilla Do you have anything special in mind? What kind of data would you need?

GodzillaDaThrilla commented 6 years ago

@palango Whichever data the team feels is relevant I guess. I can do a pretty frontend with nice visualizations and all that but the intricacies of Raiden are beyond me so I'd need straightforward access to whichever data you'd like displayed.

palango commented 6 years ago

@GodzillaDaThrilla In a first step we can visualize the network, so we could provide you a list of nodes and a list of connections between them. In a next step we could then also display the channel status and channel properties such as deposits and withdrawals.

As the format I propose JSON and we could make that available from the PFS with a REST endpoint.

How does that sound to you?

GodzillaDaThrilla commented 6 years ago

JSON would be perfect - if someone could generate some sample data I can get to work, and once Red Eyes rolls around I'll have the frontend consume the API.

palango commented 6 years ago

The PFS won't be part of Red Eyes, but I'll generate some sample data for you as soon as possible.

GodzillaDaThrilla commented 6 years ago

Ah I see, no worries. I'll set up the visuals and whenever real-time JSON data becomes available it should be good to go. 👍

palango commented 6 years ago

@GodzillaDaThrilla , how does the following json schema look to you? Any information you're missing?

    {
        "token_address": "0xsomething",
        "num_nodes": 3,
        "num_channels": 4,
        "nodes": [
            "0xalbert",
            "0xberta",
            "0xceasar",
        ],
        "channels": [
            {
                "channel_identifier": "0xchannel",
                "status": "open",
                "participant1": "0xalbert",
                "participant2": "0xceasar",
                "deposit1": 100,
                "deposit2": 50,
                "withdraw1": 20,
                "withdraw2": 0,
            },
            ...
        ],
    }
GodzillaDaThrilla commented 6 years ago

Looks good just wondering how I might differentiate between token types. Thinking something like this but separated by token.

palango commented 6 years ago

@GodzillaDaThrilla For the token the tokens address should be enough, right?

I created some json for you, it is the same network as created in this fixture: https://github.com/raiden-network/raiden-pathfinding-service/blob/master/pathfinder/tests/fixtures/network_service.py#L19-L51

{
  "token_address": "0x82dd0e0eA3E84D00Cc119c46Ee22060939E5D1FC",
  "num_channels": 7,
  "num_nodes": 7,
  "nodes": [
    "0x415DEC8c24767C977B6a35DdCE9088d6B69AB784",
    "0xcd9946ecd9f9BCfcc80a0AF7b6AFe2c7995F8Cf3",
    "0x19d36ABD5B82eD0925177FbD3038ce7bCEa72A45",
    "0x57762FC6C61377a955bb42CfE8E43D94F5F53835",
    "0x5d0497c2642724d3e97578d15a1299Af30088063",
    "0x425Ae7433087C2e11D012E0835fA73e8Cea347be",
    "0x1B54A58A58Fbe9ABCf4aC13b733B10695b0484A9"
  ],
  "channels": [
    {
      "channel_identifier": 0,
      "participant1": "0x425Ae7433087C2e11D012E0835fA73e8Cea347be",
      "participant2": "0x19d36ABD5B82eD0925177FbD3038ce7bCEa72A45",
      "deposit1": 100,
      "deposit2": 50,
      "capacity1": 90,
      "capacity2": 60
    },
    {
      "channel_identifier": 1,
      "participant1": "0x19d36ABD5B82eD0925177FbD3038ce7bCEa72A45",
      "participant2": "0x1B54A58A58Fbe9ABCf4aC13b733B10695b0484A9",
      "deposit1": 40,
      "deposit2": 130,
      "capacity1": 130,
      "capacity2": 40
    },
    {
      "channel_identifier": 2,
      "participant1": "0x1B54A58A58Fbe9ABCf4aC13b733B10695b0484A9",
      "participant2": "0x5d0497c2642724d3e97578d15a1299Af30088063",
      "deposit1": 90,
      "deposit2": 10,
      "capacity1": 80,
      "capacity2": 20
    },
    {
      "channel_identifier": 3,
      "participant1": "0x5d0497c2642724d3e97578d15a1299Af30088063",
      "participant2": "0x415DEC8c24767C977B6a35DdCE9088d6B69AB784",
      "deposit1": 50,
      "deposit2": 50,
      "capacity1": 50,
      "capacity2": 50
    },
    {
      "channel_identifier": 4,
      "participant1": "0x425Ae7433087C2e11D012E0835fA73e8Cea347be",
      "participant2": "0x1B54A58A58Fbe9ABCf4aC13b733B10695b0484A9",
      "deposit1": 40,
      "deposit2": 80,
      "capacity1": 0,
      "capacity2": 120
    },
    {
      "channel_identifier": 5,
      "participant1": "0x19d36ABD5B82eD0925177FbD3038ce7bCEa72A45",
      "participant2": "0x415DEC8c24767C977B6a35DdCE9088d6B69AB784",
      "deposit1": 30,
      "deposit2": 40,
      "capacity1": 35,
      "capacity2": 35
    },
    {
      "channel_identifier": 6,
      "participant1": "0x57762FC6C61377a955bb42CfE8E43D94F5F53835",
      "participant2": "0xcd9946ecd9f9BCfcc80a0AF7b6AFe2c7995F8Cf3",
      "deposit1": 500,
      "deposit2": 750,
      "capacity1": 550,
      "capacity2": 700
    }
  ]
}
GodzillaDaThrilla commented 6 years ago

Sorry didn't see this until now, awesome. I'll have a shot over the weekend