Title: pchMessageBytes Post by: barrysty1e on September 03, 2016, 11:57:59 PM Hi all,
I was reading a while back regarding the way the Bitcoin/Satoshi clients talk to each other; it seems that they first send a version-type packet, and if the other client sends a version that is too low, or with different parameters that do not match (for example pchMessageBytes); the client will not respond whatsoever. Is there any known way to get a remote node to effectively reveal its unique pchMessageBytes? Besides bruteforcing/pattern scanning (as there are 256^4 or 4,294,967,296 different combinations). Please don't reply if its simply 'why do you want to do that'. james Title: Re: pchMessageBytes Post by: achow101 on September 04, 2016, 12:18:26 AM What do you mean by "pchMessageBytes"? I can't find that anywhere (grepped the entire source).
There is nothing in the protocol that makes a node deliberately disconnect from and refuse to connect to a node that uses an old version number. Nodes will instead just not send the new message types. Also, there are no unique bytes that must be kept secret in any of the messages. Title: Re: pchMessageBytes Post by: cr1776 on September 04, 2016, 12:21:33 AM I think he's talking about code in net.cpp
What do you mean by "pchMessageBytes"? I can't find that anywhere (grepped the entire source). There is nothing in the protocol that makes a node deliberately disconnect from and refuse to connect to a node that uses an old version number. Nodes will instead just not send the new message types. Also, there are no unique bytes that must be kept secret in any of the messages. Title: Re: pchMessageBytes Post by: barrysty1e on September 04, 2016, 12:23:39 AM Its quite a standard component of every Bitcoin-clone out there (https://github.com/search?q=pchMessageStart&type=Code (https://github.com/search?q=pchMessageStart&type=Code)).
Its 4 bytes that are broadcast in each P2P frame; basically makes sure that only the same type client/peers talk. Title: Re: pchMessageBytes Post by: achow101 on September 04, 2016, 12:27:53 AM Its quite a standard component of every Bitcoin-clone out there (https://github.com/search?q=pchMessageStart&type=Code (https://github.com/search?q=pchMessageStart&type=Code)). Ahh, you mean the magic bytes which identify the network it uses.Its 4 bytes that are broadcast in each P2P frame; basically makes sure that only the same type client/peers talk. The easiest way to see what the magic bytes are is to just connect to the node. The first 4 bytes that they send are the magic bytes. The messages of every altcoin based on Bitcoin are basically the same format, so it should be fairly trivial to get the magic bytes as they are the first four bytes of every message. Title: Re: pchMessageBytes Post by: cr1776 on September 04, 2016, 12:31:11 AM Its quite a standard component of every Bitcoin-clone out there (https://github.com/search?q=pchMessageStart&type=Code (https://github.com/search?q=pchMessageStart&type=Code)). Its 4 bytes that are broadcast in each P2P frame; basically makes sure that only the same type client/peers talk. Knight was looking for "pchMessageBytes" as you'd asked about, not "pchMessageStart" and pch messages are all over net.cpp It is a magic number used to identify the network. E.g. So alt-coins and other software that forks Bitcoin (e.g., think name coin or twister as examples) don't confuse block chains. So you are querying another server to see what alt/fork they are and want to see the magic bytes they are using to determine that. Edit: look here https://en.bitcoin.it/wiki/Protocol_documentation#Message_structure Title: Re: pchMessageBytes Post by: barrysty1e on September 04, 2016, 12:35:45 AM Its quite a standard component of every Bitcoin-clone out there (https://github.com/search?q=pchMessageStart&type=Code (https://github.com/search?q=pchMessageStart&type=Code)). Ahh, you mean the magic bytes which identify the network it uses.Its 4 bytes that are broadcast in each P2P frame; basically makes sure that only the same type client/peers talk. The easiest way to see what the magic bytes are is to just connect to the node. The first 4 bytes that they send are the magic bytes. The messages of every altcoin based on Bitcoin are basically the same format, so it should be fairly trivial to get the magic bytes as they are the first four bytes of every message. Please read, and understand my first post. A node does not broadcast these bytes; unless another node (running identical netcode) sends these same bytes (and version info) first. If i connect to an altcoin node on its P2P port, it will sit there and say nothing until a timeout occurs. https://i.imgur.com/cOhSskR.png just found a random bitcoin node, hit it using telnet/raw (on 8333)... connects, and sits there, til timeout. does anyone know how to get a given node to voluntarily spit out its pchMessageBytes? Quote Knight was looking for "pchMessageBytes" as you'd asked about, not "pchMessageStart" and pch messages are all over net.cpp pchMessageStart[0] = 0xf8; pchMessageStart[1] = 0xb5; pchMessageStart[2] = 0x03; pchMessageStart[3] = 0xdf; yes; a seasoned programmer would instantly know what i'm referring to. bytes, four of them. Title: Re: pchMessageBytes Post by: achow101 on September 04, 2016, 01:05:15 AM Please read, and understand my first post. Looking at the code (https://github.com/achow101/bitcoin/blob/master/src/main.cpp#L6166), it seems that no there is no way to force a response from the node. If it receives the wrong magic bytes, it will not respond.A node does not broadcast these bytes; unless another node (running identical netcode) sends these same bytes (and version info) first. If i connect to an altcoin node on its P2P port, it will sit there and say nothing until a timeout occurs. <img snip> just found a random bitcoin node, hit it using telnet/raw (on 8333)... connects, and sits there, til timeout. does anyone know how to get a given node to voluntarily spit out its pchMessageBytes? Quote Knight was looking for "pchMessageBytes" as you'd asked about, not "pchMessageStart" and pch messages are all over net.cpp pchMessageStart[0] = 0xf8; pchMessageStart[1] = 0xb5; pchMessageStart[2] = 0x03; pchMessageStart[3] = 0xdf; yes; a seasoned programmer would instantly know what i'm referring to. bytes, four of them. Title: Re: pchMessageBytes Post by: barrysty1e on September 04, 2016, 01:15:06 AM Quote How does a seasoned programmer (or anyone) know that pchMessageStart means pchMessageBytes? They mean two different things. pchMessageStart means the start of the message. pchMessageBytes means the bytes of the message, including the start. pchMessageStart[] is the name of the array the bytes are held in. pchMessage's Bytes or as you prefer 'Magic numbers' are a relatively standard concept of making sure crosstalk doesnt happen between any type of standalone node (Paging Channel Host); this occurs across all other types of networks. When a host is advertising itself to another host; does it advertise its pchMessageBytes or pchMessageStart(s)? C'mon guys. Anyway, enough of being an arsehole. If you want to have a mess around with how the peers talk, checkout https://github.com/sebicas/bitcoin-sniffer (https://github.com/sebicas/bitcoin-sniffer). I've found that some implementations do 'talk' with incorrect pchMessageBytes.. however, some get flatout ignored if the PROTOCOL_VERSION is too low. Still after a definitive answer, anyone? Title: Re: pchMessageBytes Post by: achow101 on September 04, 2016, 01:26:13 AM Quote How does a seasoned programmer (or anyone) know that pchMessageStart means pchMessageBytes? They mean two different things. pchMessageStart means the start of the message. pchMessageBytes means the bytes of the message, including the start. pchMessageStart[] is the name of the array the bytes are held in. pchMessage's Bytes or as you prefer 'Magic numbers' are a relatively standard concept of making sure crosstalk doesnt happen between any type of standalone node (Paging Channel Host); this occurs across all other types of networks. When a host is advertising itself to another host; does it advertise its pchMessageBytes or pchMessageStart(s)? C'mon guys. Anyway, enough of being an arsehole. If you want to have a mess around with how the peers talk, checkout https://github.com/sebicas/bitcoin-sniffer (https://github.com/sebicas/bitcoin-sniffer). I've found that some implementations do 'talk' with incorrect pchMessageBytes.. however, some get flatout ignored if the PROTOCOL_VERSION is too low. Still after a definitive answer, anyone? I think you have a few options here. You can guess what the bytes are by virtue of the port number. Most coins use unique port numbers and you can then search through various altcoin source codes to find the ones that use the same port and then test their respective magic bytes. Or you can somehow get a node to connect to you. Title: Re: pchMessageBytes Post by: barrysty1e on September 04, 2016, 06:37:34 AM Quote How does a seasoned programmer (or anyone) know that pchMessageStart means pchMessageBytes? They mean two different things. pchMessageStart means the start of the message. pchMessageBytes means the bytes of the message, including the start. pchMessageStart[] is the name of the array the bytes are held in. pchMessage's Bytes or as you prefer 'Magic numbers' are a relatively standard concept of making sure crosstalk doesnt happen between any type of standalone node (Paging Channel Host); this occurs across all other types of networks. When a host is advertising itself to another host; does it advertise its pchMessageBytes or pchMessageStart(s)? C'mon guys. Anyway, enough of being an arsehole. If you want to have a mess around with how the peers talk, checkout https://github.com/sebicas/bitcoin-sniffer (https://github.com/sebicas/bitcoin-sniffer). I've found that some implementations do 'talk' with incorrect pchMessageBytes.. however, some get flatout ignored if the PROTOCOL_VERSION is too low. Still after a definitive answer, anyone? I think you have a few options here. You can guess what the bytes are by virtue of the port number. Most coins use unique port numbers and you can then search through various altcoin source codes to find the ones that use the same port and then test their respective magic bytes. Or you can somehow get a node to connect to you. seem to have missed the point of the post fella. i'll repost and try again. |