CLI Tool to remove unwanted connections from your Chia Node based on Geo IP Location.

chia-bouncer

Release CI License GO

really

Tiny CLI tool to remove unwanted connections from your Chia Node based on the Geo IP Location (Country). The Tool is written in golang and acts more like a command line wrapper around chia show... and the cli tool geoiplookup

Getting started

Pre-requisites

  • Linux, MacOS (never tried it on Windows)
  • git installed
  • go 1.16 installed
  • chia is installed
  • geoiplookup is installed (see below for installation instructions)

Installation

Clone the repository

git clone https://github.com/St3ffn/chia-bouncer.git
cd chia-bouncer

Build the binary

go build

The tool geoiplookup is required to perform the Geo IP Location lookup. Ubuntu 18 and Ubuntu 20 users can simply install it via:

sudo apt-get install geoip-bin

The installed package contains a database which is pretty old. To update it, download the newest from here and unpack to /usr/share/GeoIP

wget https://dl.miyuru.lk/geoip/dbip/country/dbip4.dat.gz
gunzip dbip4.dat.gz
sudo mv dbip4.dat /usr/share/GeoIP/GeoIP.dat

You can check the age of the Geo IP Location database by running

geoiplookup localhost -v
   GeoIP Country Edition: DBIPLite-Country-CSV_20210401 converted to legacy DB with sherpya/geolite2legacy by miyuru.lk
   ...

Now you are ready to go.

Usage

If your chia executable is located in $HOME/chia-blockchain/venv/bin/chia, you can simply run:

# assumes chia executable is located in $HOME/chia-blockchain/venv/bin/chia
# removes all connections from mars
> chia-bouncer mars

To specify a custom path to your chia executable use --chiaexec or -e

# custom defined chia executable
# removes all connections from "elon on mars"
> chia-bouncer -e /home/steffen/chia-blockchain/venv/bin/chia elon on mars

You can also add another filter to remove all nodes which have a lower or equal down speed (in MiB) than specified. This will be independent of the location filter. It can be done via --down-threshold or -d.

# custom defined chia executable
# remove all connections with down speed lower or equal than 1.52 MiB
# removes all connections from "elon on mars"
> chia-bouncer -e /home/steffen/chia-blockchain/venv/bin/chia -d 1.52 elon on mars

Call with --help or -h to see the help page

> chia-bouncer -h

NAME:
   chia-bouncer - remove unwanted connections from your Chia Node based on Geo IP Location.

USAGE:
   chia-bouncer [-e CHIA-EXECUTABLE] [-d DOWN-THRESHOLD] LOCATION
   chia-bouncer -e /chia-blockchain/venv/bin/chia -d 0.2 mars

DESCRIPTION:
   Tool will lookup connections via 'chia show -c', get ip locations via geoiplookup and remove nodes from specified LOCATION via 'chia show -r'

GLOBAL OPTIONS:
   --chia-exec CHIA-EXECUTABLE, -e CHIA-EXECUTABLE     CHIA-EXECUTABLE. normally located inside the bin folder of your venv directory (default: $HOME/chia-blockchain/venv/bin/chia)
   --down-threshold DOWN-THRESHOLD, -d DOWN-THRESHOLD  DOWN-THRESHOLD defines the additional filter for minimal down speed in MiB for filtering. (default: not active)
   --help, -h                                          show help (default: false)

COPYRIGHT:
   GNU GPLv3

Verification

If you are on Linux or MacOS and you want the see the locations for the current connections you can use the following:

# go chia directory
cd chia-blockchain
# enable venv
. ./activate
# calls chia to show all connections, filter for FULL_NODE, print the ip, 
# print the IP and call geoiplookup command with ip, replace string "GeoIP Country Edition" with ""
chia show -c | grep FULL_NODE | awk '{print $2}' | xargs -I {} sh -c 'echo {} $(geoiplookup {})' | sed 's! GeoIP Country Edition!!'

Integration

The script can easily be integrated with cron. Simply open the users crontab via crontab -e and add the following line.

# run chia-bouncer every 2 hours and remove all connections from mars
0 */2 * * * /PATH/TO/chia-bouncer mars

Kind gestures

If you like the tool, and you are open for a kind gesture. Thanks in advance.

  • XCH Address: xch18s8r9v4kpwdx2y8jks5ma4g2rmff0h9dtr5nkc6zmnk5kj6v0faqer6k9v
Similar Resources

Ethereum 2.0 node multiplexer between consensus and execution

The Minority Client Run the minority client! ~Danny Ryan and/or Tim Beiko As of writing, Ethereum has multiple client implementations, but Geth / go-e

Dec 23, 2022

The go-to Bitcoin Node (BN) Go library.

go-bitcoin Go wrapper for bitcoin RPC RPC services Start by creating a connection to a bitcoin node b, err := New("rcp host", rpc port, "rpc usernam

Feb 13, 2022

A fully validating Bitcoin node with Utreexo support

btcd btcd is an alternative full node bitcoin implementation written in Go (golang). This project is currently under active development and is in a Be

Dec 21, 2022

An ATNA (Audit Trail and Node Authentication) Cloud Backup Utility

An ATNA (Audit Trail and Node Authentication) Cloud Backup Utility

ATNA Vault ATNA Vault allows you to maintain a secure long-term archive for all your IHE audit messages. IHE vendors who can provide "filter forward"

Mar 13, 2022

Btc-globe - Visualize Bitcoin node locations using golang

Btc-globe - Visualize Bitcoin node locations using golang

btc-globe Visualize Bitcoin nodes by location using Golang

Jan 19, 2022

A phoenix Chain client based on the go-ethereum fork,the new PoA consensus engine is based on the VRF algorithm.

Phoenix Official Golang implementation of the Phoenix protocol. !!!The current version is for testing and developing purposes only!!! Building the sou

Apr 28, 2022

Tool for monitoring your Ethereum clients. Client-agnostic as it queries the standardized JSON-RPC APIs

Tool for monitoring your Ethereum clients. Client-agnostic as it queries the standardized JSON-RPC APIs

e7mon Tool for monitoring your Ethereum clients. Client-agnostic as it queries the standardized JSON-RPC APIs. However, the execution client should be

Dec 20, 2022

The minilock file encryption system, ported to pure Golang. Includes CLI utilities.

The minilock file encryption system, ported to pure Golang. Includes CLI utilities.

Go-miniLock A pure-Go reimplementation of the miniLock asymmetric encryption system. by Cathal Garvey, Copyright Oct. 2015, proudly licensed under the

Nov 28, 2022
Simply realtime chia log analyzer for chia coin (XCH) farmers
Simply realtime chia log analyzer for chia coin (XCH) farmers

Chia log analyzer Simply realtime chia log analyzer Howto run on Linux Download binary from the releases assets (chia-log-analyzer.go-linux-amd64 ) Yo

Jul 30, 2022
chia-blockchain some function implement in golang

gochia chia-blockchain some function implement in golang Package bls-signatures implement blspy Usage? Now we can use it to generate plot memo and id,

May 27, 2022
generate a chia address by public key, chia公钥生成地址

chia-address-generator This repo is a hack way to generate an address from publicKey. So it's not a good enough way to use it in prod, use it just for

Mar 9, 2022
Tooling to validate HTTPS Certificates and Connections Around Web 🕷️
Tooling to validate HTTPS Certificates and Connections Around Web 🕷️

Cassler - SSL Validator Tool If your read fast, it's sounds like "Cassia Eller" Tooling to validate HTTPS Certificates and Connections Around Web ??️

Sep 14, 2022
A full node Bitcoin (BSV) implementation written in Go

bsvd bsvd is a full node Bitcoin (BSV) implementation written in Go (golang). This project is a port of the bchd codebase to Bitcoin (BSV). It provide

Dec 25, 2022
HTTP API for a BitClout node
HTTP API for a BitClout node

BitClout is a blockchain built from the ground up to support a fully-featured social network. Its architecture is similar to Bitcoin, only it supports complex social network data like profiles, posts, follows, creator coin transactions, and more.

Dec 24, 2022
BitClout core node
BitClout core node

About BitClout BitClout is a blockchain built from the ground up to support a fully-featured social network. Its architecture is similar to Bitcoin, o

Dec 22, 2022
collection of tools to gleam insights from a full bitclout node's data
collection of tools to gleam insights from a full bitclout node's data

bitcloutscripts collection of tools to gleam insights from a full bitclout node's data bitcloutscripts $ ./bcs bcs posts # print all posts

Jul 11, 2021
Celer cBridge relay node implementation in Golang

cBridge Relay Node Official implementation of cBridge relay node in Golang. Prerequisites Prepare Machine To run a cBridge relay node, it is recommend

Sep 27, 2022
Go Implementation of the Spacemesh protocol full node. 💾⏰💪
Go Implementation of the Spacemesh protocol full node. 💾⏰💪

A Programmable Cryptocurrency go-spacemesh ?? ⏰ ?? Thanks for your interest in this open source project. This repo is the go implementation of the Spa

Dec 29, 2022