8
2
In version 0.8.6 of Bitcoin, I see that peers.dat file is a custom database format declared in db.h:317 (class CAddrDB) and defined in dh.cpp:485. Any ideas on how I could go about reading the data from peers.dat with PHP or Python? I'd like to keep track of all peers that the bitcoin daemon sees and connects to. Or is there a better way?
Thanks, but that only lists the 8 peers I'm connected to. I know that peers.dat contains a lot more data than that because: 1) it's rather large file (almost 1MB) 2) I see messages like the following in the debug.log: "2013-12-30 03:05:34 Added 1 addresses from xxx.xxx.xxx.xxx: 62 tried, 14738 new" – Konstantin – 2013-12-30T03:07:45.457
"peers.dat is a flat file with a bitcoin-specific file format, unrelated to any database system." https://bitcointalk.org/index.php?topic=119525.msg1287284#msg1287284 looks like unless there's another implementation of it you would have to attempt to rebuild the code in the language you require.
– Mark S. – 2013-12-30T03:12:54.4231
I also found this: Bitnodes. I will investigate his code and learn from it. Thanks!
– Konstantin – 2013-12-30T04:02:47.747