Pages:
Author

Topic: HTTP bootstrapping ? - page 2. (Read 6526 times)

legendary
Activity: 1596
Merit: 1100
December 26, 2010, 10:34:18 AM
#6
bitcoin maintains a database of P2P addresses.  Obtaining addresses via netstat is rather sub-optimal, when you could use bitcointools to extract addresses directly from the bitcoin database.

As to the larger point...

HTTP and DNS bootstrapping should be pursued.  Much more efficient than IRC.
newbie
Activity: 12
Merit: 0
December 26, 2010, 08:37:20 AM
#5
To have a full-blown Bitcoin client in shell scripting might be a bit difficult especially with the cryptographic aspect required (except if everything could be called from command line using OpenSSL...) but nothing is impossible.

Is it possible to use ECDSA with openssl ?  I've looked for this in the openssl manual page, but I haven't found anything apart from DSA and RSA.  Anyway indeed most of the parts of the program would be called with command line programs, especially cryptographic stuffs.

I think so to generate an EC key:
Code:
openssl ecparam -out ec_key.pem -name sect571k1  -genkey

and for signing something like this:
Code:
openssl dgst -sha1 -sign ec_key.pem -out filetobesigned.txt.signed filetobesigned.txt

and to verify the signature:
Code:
openssl dgst -sha1 -prverify ec_key.pem -signature filetobesigned.txt.signed filetobesigned.txt

But I don't know the exact elliptic curves used by Bitcoin. You can get the one supported
by OpenSSL by doing an:
Code:
openssl ecparam -list_curves

Is there a table of the EC properties used by Bitcoin somewhere? I suppose the easiest is
to read the source code...

My reply (being out of scope of the HTTP bootstrapping) should be under your new post
about the implementation of a Bitcoin client in shell scripting (https://bitcointalksearch.org/topic/a-full-shell-script-implementation-of-bitcoin-2461).


Hope this helps a little bit,


(PS.  you don't have to put a whole pipe in a same line.  The '|' character can end a line.)

I know but I suppose this shows my laziness when doing a paste into the forum ;-)
 
legendary
Activity: 1288
Merit: 1080
December 26, 2010, 07:20:47 AM
#4
To have a full-blown Bitcoin client in shell scripting might be a bit difficult especially with the cryptographic aspect required (except if everything could be called from command line using OpenSSL...) but nothing is impossible.

Is it possible to use ECDSA with openssl ?  I've looked for this in the openssl manual page, but I haven't found anything apart from DSA and RSA.  Anyway indeed most of the parts of the program would be called with command line programs, especially cryptographic stuffs.

(PS.  you don't have to put a whole pipe in a same line.  The '|' character can end a line.)
newbie
Activity: 12
Merit: 0
December 26, 2010, 07:02:21 AM
#3

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.")



Thanks for the cleanup.  I have also updated the code to get the current remote IP of my Bitcoin client
and added a correct Content-Type...

Reading a bit the code of the Bitcoin client, the client is using a simple trick to know its remote IP via
the IRC server (https://github.com/bitcoin/bitcoin/blob/master/irc.cpp#L333).

That's why I added another script http://btc.fo.vc/getip to get your current remote IP and add it
into the list and I'm finally sorting the IP addresses.

Code:
netstat -an | awk '/8333/ && /ESTA/ { print $5 }'
| cut -d. -f1,2,3,4  | (tee -a >(curl -s http://btc.fo.vc/getip))
| sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n | (tee >(echo "# $(date) $(wc -l) Bitcoin clients seen."))

The best would be to add an additional addip to merge all the IP announced by each clients with
some minimal control to avoid non-Bitcoin client to announce faked IP addresses via HTTP.

I think that seems reasonable to add HTTP bootstrapping into Bitcoin. Regarding the port used,
it seems that the current client pushing the information on the IRC channel is also pushing the
TCP port used. Is there a lot of Bitcoin clients using a different port than the standard one (8333)?


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.


To have a full-blown Bitcoin client in shell scripting might be a bit difficult especially with the cryptographic aspect required (except if everything could be called from command line using OpenSSL...) but nothing is impossible.

Have a nice day,

legendary
Activity: 1288
Merit: 1080
December 26, 2010, 05:48:54 AM
#2
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.
newbie
Activity: 12
Merit: 0
December 26, 2010, 05:00:38 AM
#1
Hi Everyone,

Reading a bit about the bootstrapping[1] of the P2P protocol, I was wondering
why the client is not including by default a HTTP bootstrap as an alternative to IRC (often
IRC is blocked or some antivirus/anti-malware products tag the Bitcoin application
to be suspicious just because of the IRC traffic).

For the test, I setup a page where I publish the IP seen by my Bitcoin client:

http://btc.fo.vc/ (accessible in IPv4 and IPv6[2])

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


and push on the remote server.

Until now, I didn't dig into the code of Bitcoin but I suppose including an alternative
bootstrap to the IRC  (and 8333) is not something unrealistic.

Let me know what you think.

adulau

[1] http://www.bitcoin.org/wiki/doku.php?id=network
[2] We never know, maybe Bitcoin will support IPv6 in the future
Pages:
Jump to: