Bitcoin Forum
May 05, 2024, 03:10:13 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Nodes talking, sockets or over http  (Read 222 times)
redigaffi (OP)
Member
**
Offline Offline

Activity: 142
Merit: 13


View Profile
August 08, 2018, 02:44:59 PM
 #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?

Earn Money With Skill while having fun, Answer this 6 questions and get a bonus when the project get's launched:

https://docs.google.com/forms/d/e/1FAIpQLSdCRubC4wu4seHYdDqiZDFsXizqaViUnOtE5sZcx3spjGc84A/viewform
1714878613
Hero Member
*
Offline Offline

Posts: 1714878613

View Profile Personal Message (Offline)

Ignore
1714878613
Reply with quote  #2

1714878613
Report to moderator
The grue lurks in the darkest places of the earth. Its favorite diet is adventurers, but its insatiable appetite is tempered by its fear of light. No grue has ever been seen by the light of day, and few have survived its fearsome jaws to tell the tale.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714878613
Hero Member
*
Offline Offline

Posts: 1714878613

View Profile Personal Message (Offline)

Ignore
1714878613
Reply with quote  #2

1714878613
Report to moderator
1714878613
Hero Member
*
Offline Offline

Posts: 1714878613

View Profile Personal Message (Offline)

Ignore
1714878613
Reply with quote  #2

1714878613
Report to moderator
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
August 08, 2018, 02:56:29 PM
Merited by Foxpup (3), achow101 (3), ABCbits (1)
 #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?

redigaffi (OP)
Member
**
Offline Offline

Activity: 142
Merit: 13


View Profile
August 08, 2018, 03:01:09 PM
 #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.

Earn Money With Skill while having fun, Answer this 6 questions and get a bonus when the project get's launched:

https://docs.google.com/forms/d/e/1FAIpQLSdCRubC4wu4seHYdDqiZDFsXizqaViUnOtE5sZcx3spjGc84A/viewform
Honour423
Copper Member
Newbie
*
Offline Offline

Activity: 75
Merit: 0


View Profile
August 09, 2018, 02:02:29 AM
 #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. 
redigaffi (OP)
Member
**
Offline Offline

Activity: 142
Merit: 13


View Profile
August 10, 2018, 08:33:58 AM
 #5

Btw, how does nodes send the data? is there any format (in bitcoin?) for example, json or xml?

Earn Money With Skill while having fun, Answer this 6 questions and get a bonus when the project get's launched:

https://docs.google.com/forms/d/e/1FAIpQLSdCRubC4wu4seHYdDqiZDFsXizqaViUnOtE5sZcx3spjGc84A/viewform
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
August 10, 2018, 01:31:48 PM
 #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).

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!