Author

Topic: Checking Remote Node Availability (Read 2503 times)

newbie
Activity: 38
Merit: 0
February 10, 2016, 05:28:06 PM
#11
The services are documented in https://github.com/bitcoin/bitcoin/blob/605c17844ea32b6d237db6d83871164dc7d59dab/src/protocol.h#L227. I have increased the SOCKET_TIMEOUT from 15 to 30 for https://bitnodes.21.co/#join-the-network, so it's consistent with the timeout used by the crawler.
legendary
Activity: 1762
Merit: 1011
February 09, 2016, 10:09:28 AM
#10
Also, @disclosure, what is the SOCKET_TIMEOUT variable set to on your "check node" feature on the website? Is it 15 seconds like it is in the source code? I noticed that I was getting spotty results on the web version with detecting my nodes, as the inbound connection would show up as a peer in the debug window, but would seem to timeout before all the information was sent, causing a false negative on your page. After playing around some with the source code locally, it seemed to me that a higher socket timeout might be appropriate. Either that, or this was just a coincidence, and something else was causing the spotty detection of my nodes on your site.
legendary
Activity: 1762
Merit: 1011
February 08, 2016, 06:03:37 PM
#9
You can run the same tool used on Bitnodes locally to probe a Bitcoin client. Change the destination IP and port in https://github.com/ayeowch/bitnodes/blob/master/protocol.py#L505 and run python protocol.py. Feel free to modify the script to accept command-line argument, e.g. python protocol.py IP PORT as needed.


Does anyone know what the services number means that is returned by the bitnodes protocol.py handshake?


Btw, I was able to get this to work with Python on Windows. Here's what worked for me:

Install Python 2.7 from Python.org
Install VCForPython27.msi from Microsoft.com
Download and extract bitnodes-master from GitHub

Where you extracted it on your computer, run:
pip install -r requirements
pip install win_inet_pton

Finally, add "include win_inet_pton", without quotes, near the top of protocol.py with the rest of the include lines

Now, on the commandline, you can run "python protocol.py", without quotes, editing the code under the main function of protocol.py with the IP address and port, as necessary.
legendary
Activity: 1512
Merit: 1012
August 29, 2014, 07:38:28 AM
#8
Right, but how?

Like this :

Quote
2014-08-29 12:14:29 ProcessBlock: ACCEPTED
2014-08-29 12:15:44 CreateNewBlock(): total size 36332
2014-08-29 12:17:42 CreateNewBlock(): total size 94237
2014-08-29 12:19:40 CreateNewBlock(): total size 134848
2014-08-29 12:20:30 receive version message: /getaddr.bitnodes.io:0.1/: version 70001, blocks=313000
2014-08-29 12:21:39 CreateNewBlock(): total size 161266
2014-08-29 12:23:06 UpdateTip: new best=00000000000000002df72 progress=0.999997
2014-08-29 12:23:06 ProcessBlock: ACCEPTED
newbie
Activity: 38
Merit: 0
August 29, 2014, 01:15:23 AM
#7
You can run the same tool used on Bitnodes locally to probe a Bitcoin client. Change the destination IP and port in https://github.com/ayeowch/bitnodes/blob/master/protocol.py#L505 and run python protocol.py. Feel free to modify the script to accept command-line argument, e.g. python protocol.py IP PORT as needed.
copper member
Activity: 1498
Merit: 1528
No I dont escrow anymore.
August 29, 2014, 12:52:26 AM
#6
Why not just use?

Code:
nmap IP -p8333

I just tested it on my node I know is running and it returned:

Code:
PORT     STATE  SERVICE
8333/tcp open unknown

Nmap done: 1 IP address (1 host up) scanned in 0.28 seconds

Which is not an 100% answer, but easier to do.

The IP "next to it" returns state closed. I assume there is no node running Wink
legendary
Activity: 4214
Merit: 1313
August 28, 2014, 07:04:09 PM
#5
D&T beat me to it by mentioning addnode, but you could open the console, do an

addnode xxx.xxx.xxx.xxx add

Then you could look at something like this (assuming you are running *nix  (Unix, Linux, MacOS X):
netstat -an | grep "8333"


to show what IPs you are connected to.  Is the IP you were wondering about there?   (You might use "onetry" in the addnode too.)

You might want to do an
addnode xxx.xxx.xxx.xxx remove


when you are finished testing.

For automation, you might send the addnode automatically, then check the netstat with a shell script and grep, then remove that node.
donator
Activity: 1218
Merit: 1079
Gerald Davis
August 28, 2014, 06:47:51 PM
#4
There is no easy way to do this from a client.  You can use an entry in bitcoin.conf such as addnode=xxx.xxx.xxx.xxx to force a connection to a specific node.    Most likely is you want to do it in any automated manner you will need to custom code as this is pretty low level nuts and bolts and not exposed by clients.

At a protocol level you would send a outgoing "version" message to the remote node.  It should respond back with a version message.  If it does not then it is not reachable by inbound connection.
newbie
Activity: 10
Merit: 1
August 28, 2014, 04:35:32 PM
#3
Right, but how?

I have bitcoind running locally, and was looking for a way to do this using it as the client, but I don't see any methods/arguments for this specifically. Do I have to manually craft a request?
donator
Activity: 1218
Merit: 1079
Gerald Davis
August 28, 2014, 04:18:32 PM
#2
Attempt to connect to the node using the bitcoin protocol.
newbie
Activity: 10
Merit: 1
August 28, 2014, 04:17:47 PM
#1
At the bottom of this page there is a form that allows you to check if a Bitcoin node is up and responding: https://getaddr.bitnodes.io/

Can someone tell me how I can perform this same test against a remote node, without relying on this service?
Jump to: