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

Additional Node HTTP Endpoints #142

Open
tynes opened this issue Apr 10, 2019 · 4 comments
Open

Additional Node HTTP Endpoints #142

tynes opened this issue Apr 10, 2019 · 4 comments
Labels
discussion issue - discussions node-http part of the codebase

Comments

@tynes
Copy link
Contributor

tynes commented Apr 10, 2019

Overview

edited 5/30/19

A high priority TODO is migrating the RPCs to HTTP to allow for more flexibility. This should be fairly straight forward to accomplish since most of the code has already been written and just needs to be adapted to using the HTTP resources instead of the RPC resources.

Proposal

Additional Endpoints to be added:

RPC HTTP
getnameinfo GET /name/:name
getnamebyhash GET /name/hash/:hash
getnameresource GET /resource/name/:name
getnameresourcebyhash GET /resource/hash/:hash
getnameproof GET /proof/name/:name
gtetnameproofbyhash GET /proof/hash/:hash
grindname GET /grind?size=int

sendrawclaim already is implemented as POST /claim

This work has been started here:

Previous Issues mentioning this include #12, #126

tynes pushed a commit to tynes/hsd that referenced this issue Apr 30, 2019
This ports the node RPC getnameinfo to the
HTTP endpoint GET /info/name/:name and
includes a simple test.

See RPC implementation here:
https://github.com/handshake-org/hsd/blob/b32c27bbb05e69b86c0e80aea3ecc394c5589186/lib/node/rpc.js#L2313

Issue can be found here:
handshake-org#142
@wi-ski
Copy link
Contributor

wi-ski commented May 4, 2019

Quick Question!

This guy: getnamebyhash has route shaped like GET /name/hash/:hash

Top level resource being "name" feels right to me.

However, the other calls have a different shape!

  1. getnameinfo
    • GET /info/name/:name
    • "Info" top level
  2. getnameresource
    • GET /resource/name/:name
    • "Resource" top level
  3. getnameproof
    • GET /proof/name/:name
    • "Proof" top level

Would you be opposed to something more rest-ish? Like:

  1. getnameinfo
    • GET /name/info/:name
    • "Name" top level
    • Route param :name end of the path.
  2. getnameresource
    • GET /name/resource/:name
    • "Name" top level
    • Route param :name end of the path.
  3. getnameproof
    • GET /name/proof/:name
    • "Name" top level
    • Route param :name end of the path.
  4. grindname
    • GET /name/grind?size=int
    • "Name" top level
  5. getnamebyhash
    • GET /name/hash/:hash
    • "Name" top level
    • Route param :hash end of the path.
    • Hash is hex encoded.

@tynes
Copy link
Contributor Author

tynes commented May 31, 2019

@wi-ski Thanks for your suggestions.

What do you think of the edits made to the original post? The API is being structured this way to keep it similar to the rest of the codebase.

See this endpoint:

https://github.com/handshake-org/hsd/blob/master/lib/node/http.js#L159

// UTXO by address
GET /coin/address/:address

Since a coin is synonymous with a UTXO, the resource being fetched is the top level resource and then how its being fetched is the next level resource. We would like to try to maintain consistency within the codebase.

@wi-ski
Copy link
Contributor

wi-ski commented Jun 30, 2019

Yesss - gotcha. Makes sense, ill make those changes to #168

@wi-ski
Copy link
Contributor

wi-ski commented Jun 30, 2019

Note: gtetnameproofbyhash => gettnameproofbyhash (spelling)

@nodech nodech added discussion issue - discussions node-http part of the codebase and removed discussion labels Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion issue - discussions node-http part of the codebase
Projects
None yet
Development

No branches or pull requests

3 participants