ironfish icon indicating copy to clipboard operation
ironfish copied to clipboard

Add http support for RPC

Open h9-dev opened this issue 2 years ago • 7 comments

Summary

Add http support for RPC

Testing Plan

Run node with --rpc.tcp and access http://localhost:$rpcTcpPort+1. Example curl http://localhost:8021/node/getStatus.

Breaking Change

Is this a breaking change? If yes, add notes below on why this is breaking and what additional work is required, if any.

[ ] Yes
[x] No

h9-dev avatar Jun 21 '22 08:06 h9-dev

I think the current RPC interface of TCP and IPC is not very convenient to call with go,java and etc. This implementation base on HTTP , and streaming by websocket.

h9-dev avatar Jun 21 '22 11:06 h9-dev

This should go in their own adapters. I can move this code, or you can, if you have time.

NullSoldier avatar Jun 27 '22 15:06 NullSoldier

This should go in their own adapters. I can move this code, or you can, if you have time.

Glad to have this feature endorsed. We will refactor the code.

h9-dev avatar Jun 27 '22 16:06 h9-dev

Oh yeah, this is actually a very important feature that's on our roadmap. We're super glad to have this contribution.

NullSoldier avatar Jun 28 '22 18:06 NullSoldier

I'm planning to support standard JSON 2.0 compatible interface for ironfish rpc call over http. Should I open another PR here since there is a PR open for http request. I have opened a FIP for what I want to do JSONRPC

hairtail avatar Jul 01 '22 01:07 hairtail

Ok, I think we should port all of our adapters to use JSON RPC, I'm just not sure how it should work for our streaming responses. I'll have to look at the JSON RPC 2.0 spec. I'll comment on the FIP. Obviously an HTTP adapter won't support streaming responses.

NullSoldier avatar Jul 01 '22 17:07 NullSoldier

Ok, I think we should port all of our adapters to use JSON RPC, I'm just not sure how it should work for our streaming responses. I'll have to look at the JSON RPC 2.0 spec. I'll comment on the FIP. Obviously an HTTP adapter won't support streaming responses.

I recommend steaming to use the websocket, which is no problem in my PR.

It should be better if it can support JSON RPC 2.0, many other famous chains are using it.

h9-dev avatar Jul 03 '22 04:07 h9-dev

I'm gonna close this PR, but I'm gonna finish and port the HTTP portion here. When we finish it we'll give you some PR credit since my work is based off of yours. https://github.com/iron-fish/ironfish/pull/2423

NullSoldier avatar Oct 27 '22 06:10 NullSoldier