<p>I'm trying to send a protocol version message to my node on port 8333. I found <a href="https://bitcoindev.network/bitcoin-wire-protocol/" rel="nofollow noreferrer">this site</a> that explains how to send a version message from the command line. I have a C++ app that is creating the message, but I thought I would try sending it from the command line before trying to do it in my C++ application.</p>
<p>I'm on a local network sending the message from 192.168.1.44 to the node at 192.168.1.47. The node is running Bitcoin Core 23.0.</p>
<p>According to the site linked above, the following command can be used to send a version message and print the verack that it receives. Instead, it pauses for a few seconds and prints nothing.</p>
<pre><code>echo -en &quot;f9beb4d976657273696f6e00000000005a000000365c501771110100010000000000000091211e6300000000010000000000000000000000000000000000ffffc0a8012f208d010000000000000000000000000000000000ffffc0a8012c208daabbccddeeff11350454657374d87f0b0000&quot; | xxd -r -p | nc 192.168.1.47 8333 -i 2 | xxd
</code></pre>
<p>Here is a breakdown of the most recent message I've tried to send:</p>
<pre><code>f9beb4d9
76657273696f6e0000000000
5a000000
365c5017

71110100
0100000000000000
91211e6300000000
010000000000000000000000000000000000ffffc0a8012f208d

010000000000000000000000000000000000ffffc0a8012c208d
aabbccddeeff1135
0454657374
d87f0b00

00
</code></pre>
<p>Here is what each of the above lines is supposed to be:</p>
<pre><code>Mainnet byte sequence
&quot;version&quot; padded with zeroes
Length of payload (little endian)
Payload checksum (1st 4 bytes of double SHA256 converted to little endian)

Version 70001 (little endian)
NODE_NETWORK service
Timestamp (little endian)
Recipient address/port = 192.168.1.47:8333

Sender address/port = 192.168.1.44:8333
Nonce (random)
User agent = &quot;Test&quot;
Last block received = 753624 (little endian)

Relay = false
</code></pre>
<p>My <code>bitcoin.conf</code> file contains:</p>
<pre><code>txindex=1
server=1
rpcbind=192.168.1.47:8901
rpcallowip=192.168.1.44
rpcuser=username
rpcpassword=xxxxxxxx
</code></pre>
<p>Is there something that needs to be added to bitcoin.conf?</p>
<p>Is there something wrong with the version message I am trying to send?</p>
<p>What else could the problem be?</p>

CC BY-SA 4.0
2022-09-11T18:54:03.953Z
Try adding "debug=net" to your bitcoin.conf, restart bitcoind, try your command again, and see if anything relevant appears in the debug.log file.
Pieter Wuille
CC BY-SA 4.0
2022-09-11T19:23:26.173Z
It added a line in debug.log that looks like this: `76890:2022-09-11T19:16:25Z connection from 192.168.1.44:36780 accepted`. However, it did not return a verack to the command I ran on the command line. I also noticed that while the command was waiting, an Unroutable Inbound peer with the same ip address appeared in bitcoin-qt and disappeared when the command finally finished.
Zephyrus
CC BY-SA 4.0
2022-09-11T19:36:49.610Z
Looking at some line in debug.log that came after that, I see a `Wrong checksum` message that shows the same 4-byte checksum that I sent. Going to look at it more carefully in a bit, but that's a big clue.
Zephyrus
CC BY-SA 4.0
2022-09-11T21:35:45.350Z
FWIW, the phrase "1st 4 bytes of double SHA256 converted to little endian" is meaningless. SHA256 outputs 32 bytes, the first 4 of those are the checksum. Bitcoin does in some places interpret the SHA256 output bytes as numbers (in particular, in block hashes when determining PoW), but there are no numbers involved here - just bytes.
Pieter Wuille
CC BY-SA 4.0
2022-09-11T22:05:41.890Z
And that was my incorrect assumption, that those 4-bytes was interpreted as a number and needed to be converted to little endian. Commenting those lines out fixed the problem.
Zephyrus
<protocol><peers><peer-discovery>
Protocol version message is ignored by node
Zephyrus
# Protocol version message is ignored by node

(Asked by: username_0 on 2022-09-11)

I'm trying to send a protocol version message to my node on port 8333. I found this site that explains how to send a version message from the command line. I have a C++ app that is creating the message, but I thought I would try sending it from the command line before trying to do it in my C++ application.
I'm on a local network sending the message from 192.168.1.44 to the node at 192.168.1.47. The node is running Bitcoin Core 23.0.
According to the site linked above, the following command can be used to send a version message and print the verack that it receives. Instead, it pauses for a few seconds and prints nothing.
echo -en "f9beb4d976657273696f6e00000000005a000000365c501771110100010000000000000091211e6300000000010000000000000000000000000000000000ffffc0a8012f208d010000000000000000000000000000000000ffffc0a8012c208daabbccddeeff11350454657374d87f0b0000" | xxd -r -p | nc 192.168.1.47 8333 -i 2 | xxd

Here is a breakdown of the most recent message I've tried to send:
f9beb4d9
76657273696f6e0000000000
5a000000
365c5017

71110100
0100000000000000
91211e6300000000
010000000000000000000000000000000000ffffc0a8012f208d

010000000000000000000000000000000000ffffc0a8012c208d
aabbccddeeff1135
0454657374
d87f0b00

00

Here is what each of the above lines is supposed to be:
Mainnet byte sequence
"version" padded with zeroes
Length of payload (little endian)
Payload checksum (1st 4 bytes of double SHA256 converted to little endian)

Version 70001 (little endian)
NODE_NETWORK service
Timestamp (little endian)
Recipient address/port = 192.168.1.47:8333

Sender address/port = 192.168.1.44:8333
Nonce (random)
User agent = "Test"
Last block received = 753624 (little endian)

Relay = false

My bitcoin.conf file contains:
txindex=1
server=1
rpcbind=192.168.1.47:8901
rpcallowip=192.168.1.44
rpcuser=username
rpcpassword=xxxxxxxx

Is there something that needs to be added to bitcoin.conf?
Is there something wrong with the version message I am trying to send?
What else could the problem be?

**Tags:** protocol, peers, peer-discovery

> **Comments:**
> **username_1**: Try adding "debug=net" to your bitcoin.conf, restart bitcoind, try your command again, and see if anything relevant appears in the debug.log file.  
> **username_0**: It added a line in debug.log that looks like this: `76890:2022-09-11T19:16:25Z connection from 192.168.1.44:36780 accepted`. However, it did not return a verack to the command I ran on the command line. I also noticed that while the command was waiting, an Unroutable Inbound peer with the same ip address appeared in bitcoin-qt and disappeared when the command finally finished.  
> **username_0**: Looking at some line in debug.log that came after that, I see a `Wrong checksum` message that shows the same 4-byte checksum that I sent. Going to look at it more carefully in a bit, but that's a big clue.  
> **username_1**: FWIW, the phrase "1st 4 bytes of double SHA256 converted to little endian" is meaningless. SHA256 outputs 32 bytes, the first 4 of those are the checksum. Bitcoin does in some places interpret the SHA256 output bytes as numbers (in particular, in block hashes when determining PoW), but there are no numbers involved here - just bytes.  
> **username_0**: And that was my incorrect assumption, that those 4-bytes was interpreted as a number and needed to be converted to little endian. Commenting those lines out fixed the problem.  

---

## 0 answers

