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?
Asked
Active
Viewed 5,002 times
1 Answers
3
The easiest way to get peer information is via the JSON RPC interface has a command getpeerinfo. Each peer returns a JSON object containing peer IP address info, connection time, version and subversion of the client.
You would probably be interested in this: Bitcoind API
Edit: Although this is not a way to read the database I presume that the data feeding the peers.dat file is pulled from both the IRC channels and the DNS seeds. If you reported data on those nodes, you could use this data in combination with logs from the debug file to perhaps learn how your node discovered its peers.

Mark S.
- 2,710
- 14
- 23
"2013-12-30 03:05:34 Added 1 addresses from xxx.xxx.xxx.xxx: 62 tried, 14738 new"
– Konstantin Dec 30 '13 at 03:07