conradoqg / naivecoin

A cryptocurrency implementation in less than 1500 lines of code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Open internet communication

milanobrtlik opened this issue · comments

Hello,

i understand that this implementation is not ready for production. Still, I wonder how nodes communicate with each other on an open Internet without knowing their IP addresses. You need DHT with network identification or something else?

You can read here how Bitcoin does that.

In summary, the Bitcoin node needs to know at least one other node or a DNS service, from there it gets more peers and connects to them.

Naivecoin does not have a DNS service for discovery since it's a simple implementation and if someone decides to put it into production, at the beginning, it will not need a DNS since the nodes does more or less the same function.

Best

I agree that this question does not belong to the implementation of naivecoin. I'm just curious how nodes on the internet will know they belong to the same network. Maybe i should check P2P chat examples first.

They exchange a version ID in Bitcoin and an ID on Ethereum, that way they know if they belong to the same network.

I made a little research. Im totally confused with that P2P over nodejs, which is actually not P2P, because it needs some discovery method. Can you please make example for P2P networking?

I think that if there is a third party connecting the nodes together, the network can simply be turned off by turning off taht third party.

Is there a solution where nodes can connect themselves? Without help from outside?

Not sure. Maybe someone could give me ideas on how to do that and at the same time not increasing the coin complexity.