Skip to content

Hnsnodes estimates the relative size of the Handshake peer-to-peer network by finding all of its reachable nodes, and is a fork of Bitnodes.

License

Notifications You must be signed in to change notification settings

htools-org/hnsnodes

Repository files navigation

Hnsnodes

Hnsnodes is a fork of Bitnodes modified to work with the Handshake network.

The default branch handshake is the one to be used. master is used to keep up with upstream changes.

To see what's changed, compare the branches: https://github.com/htools-org/hnsnodes/compare/master...handshake.

Not all features work, only crawl.py does. To use it,

# 1. Install python2 (preferably with a version manager like pyenv)
# 2. Install packages
pip install -r requirements.txt

# 3. Setup redis (if not localhost, change in utils.py)
docker run --name redis -p 6379:6379 -d redis

# 4. Register (free) and get an API key for geoip from https://www.maxmind.com
# and place it in `geoip/.maxmind_license_key`
# Then run this to download geoip db:
./geoip/update.sh

# 5. Create crawler config file from default and modify if needed
cp ./conf/crawl.conf.default ./conf/crawl.conf

# 6. Start crawler
python -u crawl.py conf/crawl.conf master

# It runs forever and keeps dumping the current list of reachable nodes
# in data/crawl/{timestamp}.json

# To pretty print as table or json objects, there's a script:
python scripts/parse-crawl-log.py       # help
python scripts/parse-crawl-log.py -t    # table
python scripts/parse-crawl-log.py -j    # json (array of objects)
python scripts/parse-crawl-log.py -jp   # json (prettified)

For more info, check out the Bitnodes' Wiki.

Huge thanks to bitnodes for creating and maintaining https://bitnodes.io/. Original readme below.


Bitnodes

Bitnodes estimates the relative size of the Bitcoin peer-to-peer network by finding all of its reachable nodes. The current methodology involves sending getaddr messages recursively to find all the reachable nodes in the network, starting from a set of seed nodes. Bitnodes uses Bitcoin protocol version 70001 (i.e. >= /Satoshi:0.8.x/), so nodes running an older protocol version will be skipped.

See Provisioning Bitcoin Network Crawler for steps on setting up a machine to run Bitnodes. The Redis Data contains the list of keys and their associated values that are written by the scripts in this project. If you wish to access the data, e.g. network snapshots, collected using this project, see API.

Links

CI

CircleCI

Setup

# Install pyenv dependencies
sudo apt update && sudo apt install make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

# Install pyenv
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
cd ~/.pyenv && src/configure && make -C src

# Append to ~/.bashrc
export PYENV_ROOT=$HOME/.pyenv
export PATH=$PYENV_ROOT/bin:$PATH
if command -v pyenv 1>/dev/null 2>&1; then
    eval "$(pyenv init -)"
fi

# Setup project
source ~/.bashrc
pyenv install 3.9.14
cd && git clone https://github.com/ayeowch/bitnodes.git && cd bitnodes
~/.pyenv/versions/3.9.14/bin/python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pytest

About

Hnsnodes estimates the relative size of the Handshake peer-to-peer network by finding all of its reachable nodes, and is a fork of Bitnodes.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published