Bitcoin Forum
August 16, 2018, 06:26:21 AM *
News: Latest stable version of Bitcoin Core: 0.16.2  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Nodes talking, sockets or over http  (Read 69 times)
redigaffi
Member
**
Offline Offline

Activity: 106
Merit: 10


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?
1534400781
Hero Member
*
Offline Offline

Posts: 1534400781

View Profile Personal Message (Offline)

Ignore
1534400781
Reply with quote  #2

1534400781
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1534400781
Hero Member
*
Offline Offline

Posts: 1534400781

View Profile Personal Message (Offline)

Ignore
1534400781
Reply with quote  #2

1534400781
Report to moderator
1534400781
Hero Member
*
Offline Offline

Posts: 1534400781

View Profile Personal Message (Offline)

Ignore
1534400781
Reply with quote  #2

1534400781
Report to moderator
bob123
Hero Member
*****
Offline Offline

Activity: 658
Merit: 526



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

Activity: 106
Merit: 10


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.
Honour423
Jr. Member
*
Offline Offline

Activity: 42
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
Member
**
Offline Offline

Activity: 106
Merit: 10


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?
bob123
Hero Member
*****
Offline Offline

Activity: 658
Merit: 526



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:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!