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

Are 2 ports necessary? #14

Open
manix opened this issue Sep 16, 2017 · 4 comments
Open

Are 2 ports necessary? #14

manix opened this issue Sep 16, 2017 · 4 comments

Comments

@manix
Copy link

manix commented Sep 16, 2017

You can pass the http server app to the ws server and have it all work under 1 port. Is it purposely made to use 2 ports and why?

On second thought, why are websockets used at all? You can query the network via http, this will make the program even simpler and with less code which as I see is the main concern in this repo?

@adeora7
Copy link

adeora7 commented Nov 18, 2017

Websockets are needed. Although you can query the network via http but how will you broadcast to the network when you add a block. Constantly querying the network will be a very bad solution.

@ltearno
Copy link

ltearno commented Nov 19, 2017 via email

@lhartikk
Copy link
Owner

There is clear separation of concerns between the different ports.

The P2P port is for only peer to peer communication with other nodes. This port should be public to internet as other nodes should be able to connect to your node.

The other port (HTTP_PORT) is used only for controlling the node. It should not be public to the internet and only the user of the node should be able to access it.

This same kind of "architetcture" is used in all of the "well-known" blockchain implementations I know of (Bitcoin, Ethereum, Litecoin etc.)

@manix
Copy link
Author

manix commented Nov 20, 2017

@adeora7 you have /addPeer which could store peer addresses instead of creating a websocket client and then simply post there, you wouldn't need to do any kind of polling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants