Author

Topic: Nodes talking, sockets or over http (Read 245 times)

legendary
Activity: 1624
Merit: 2481
August 10, 2018, 08:31:48 AM
#6
Btw, how does nodes send the data? is there any format (in bitcoin?) for example, json or xml?


The message structure is:
  • 4 byte which define mainnet/testnet
  • 12 byte command
  • 4 byte length
  • 4 byte checksum
  • X byte payload

You can read more about the structure / possible values in the protocol documentation (https://en.bitcoin.it/wiki/Protocol_documentation#Common_structures).
member
Activity: 142
Merit: 13
August 10, 2018, 03:33:58 AM
#5
Btw, how does nodes send the data? is there any format (in bitcoin?) for example, json or xml?
copper member
Activity: 75
Merit: 0
August 08, 2018, 09:02:29 PM
#4
If you are starting out with node.js then sockets.io is a good place to start.  It’s pretty easy to create listeners on any port you want. If you are just learning basics then creating a REST api over http is an ok place to learn but won’t support anything major.  When you need to start moving blocks across nodes that are in the multi megabyte size range then http will fall apart on you.  IP*Works has some great socket libraries if you want to build something major, but it’s kind of expensive. 
member
Activity: 142
Merit: 13
August 08, 2018, 10:01:09 AM
#3
Thanks for your answer.

Well the idea was to built a small webserver into the node so they don't need to have a web server running apart.

Actually, it's just curiosity, and im not building anything. I've started some months ago a CryptoCurrency written in node.JS and I was using HTTP protocol for sending/receiving info, but I'm thinking to switch to C++. Anyway, just doing this for fun and learn more.
legendary
Activity: 1624
Merit: 2481
August 08, 2018, 09:56:29 AM
#2
I know that (at least in bitcoin) nodes talk to each other opening sockets to communicate if I'm not wrong.

Each piece of software on a PC has to open a socket to communicate with a network.



What If I would create a cryptocurrency, but communicating over HTTP protocol, for example using JSON post request. I know that this would be potentially slower due to an extra layer of the HTTP protocol.

I don't see any pro argument for building a cryptocurrency on top of HTTP. You would just require everyone to additionally run a web server to be able to communicate with the network.
There is no necessity for something like this.



But could it work?

Well, theoretically you can do each communication over HTTP but this doesn't give you any advantage. Just disadvantages.



Would it make sense?

No, note at all. At least not in my eyes.

What exactly were you trying to do? Which problem of BTC are you trying to solve with this method?
member
Activity: 142
Merit: 13
August 08, 2018, 09:44:59 AM
#1
Hello, I have a question, I know that (at least in bitcoin) nodes talk to each other opening sockets to communicate if I'm not wrong. What I've seen so far this is like a standard for other cryptocurrencies. What If I would create a cryptocurrency, but communicating over HTTP protocol, for example using JSON post request. I know that this would be potentially slower due to an extra layer of the HTTP protocol.

But could it work?
Would it make sense?
Jump to: