Post
Topic
Board Development & Technical Discussion
Re: HTTP bootstrapping ?
by
grondilu
on 26/12/2010, 10:48:54 UTC
The IP addresses are collected with a simple script like this:

netstat -an | grep 8333 | grep ESTA | awk '{print $5}' | cut -f1,2,3,4 -d"." > /tmp/bitcoin
(date | awk '{print "# " $0 " Bitcoin clients seen"}') >>/tmp/bitcoin


Oh this is cool. I confess I didn't know the commant netstat.

It could be cleaned a bit I think :

netstat -an |
awk '/8333/ && /ESTA/ { print $5 }' |
sed 's/:8333//' |
tee >(echo "# $(date) $(wc -l) Bitcoin clients seen.")



It's funny :  while I was starting bitcoin to test this,  I couldn't get any connection even after a few minutes.  It's just when I read a post about IRC bootstrapping that I have problems which bootstrapping.  How ironic...

PS.  You might consider adding a "Content-type" line in your script (assuming it's a CGI):

Code:
#!/bin/sh
echo "Content-type: text/plain"
echo
netstat -an |
awk '/8333/ && /ESTA/ { print $5 }' |
sed 's/:8333//' |
tee >(echo "# $(date) $(wc -l) Bitcoin clients seen.")


PS#2.  I like this idea a lot.  Especially since it's quite easy to install a mini http server such as thttpd for instance.
This makes me even dream of a full implementation of bitcoin via pure shell scripting.  The http server could also publish his blocks, that could be requested by giving the hash of the block via a simple HTTP GET request.