Skip to content

Signed JSONRPC 2.0 request scheme for pool API #10

@shazow

Description

@shazow

A vipnode-client who wants to participate in usage-metered pools will need to implement an additional protocol for reporting which nodes the client is connected to.

This is a rough draft of what this protocol would look like.

Requirements

  • vipnode_client: Request for a set of vipnodes that are ready for nodeID to connect.
  • vipnode_update: Periodic updates with details about connected peers to the vipnode pool.
  • (Optional) vipnode_register: Automatic registration flow to update nodeID <- address mapping.

Question: Does it make sense to use a vipnode_ RPC method prefix for these, or should it be something more general?

Considerations

Can be implemented as a push to, or a pull from, the vipnode pool. It can be implemented as a streaming API (e.g. websocket) or separate request/response (e.g. HTTPS).

Question: Assuming that the target audience for the protocol is mobile clients, it's probably a better idea to do client-initiated polling request/response for the sake of battery life?

For the sake of consistency with the rest Ethereum's RPC, the calls will be JSON-RPC 2.0.

Payloads must be signed and verified with the node key to avoid pools from being able to fake paid activity.

Request/Response Examples:

Warning: These are out of date. See discussion.

vipnode_client:

TODO

vipnode_update:

(From the client)

Request POST https://pool.vipnode.org/api with body:

{
  "jsonrpc": "2.0",
  "method": "vipnode_peers",
  "params": {
    "nodeID": "19b5013d2424...0738ac974f6",
    "timestamp": "1527609234005",
    "signature": "<Signature of subset of payload by private node key>",
    "peers": [
      {
        "nodeID": "1234abcd...dcba4321"
      },
      {
        "nodeID": "1234abcd...dcba4321"
      }
    ]
  },
  "id": 1
}

Response 200 from server with body:

{
  "jsonrpc": "2.0",
  "result": {
    "balance": "xxx"
  },
  "id": 1
}

Questions

  1. What other metadata do we need from the peers?
  2. Which subset of the payload should the signature sign? Should it include everything except the signature field, using a key-sorted deterministic JSON encoding?
  3. Should signature be a top-level field? This would allow us to only sign params without injecting a new key, but would it violate JSON-RPC 2.0 and make the implementation more difficult for some JSONRPC libraries?
  4. Do we need anything else from the vipnode-pool in the response?

vipnode_register:

TODO, some related notes here: #7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions