Bitcoin Cash Seeding

0 49
Avatar for phil.wilson
Written by
1 month ago

To connect into the Bitcoin Cash network you need to first obtain at least one working IP address to a node that's already up and running.

The original Bitcoin client code used the IRC ( Internet Relay Chat ) channel #Bitcoin to make the client add its IP address into the channel and collect everyone else's IP addresses from there.

Over time additional channels were needed.

Once there were long-established members some developers added in DNS ( Domain Name System ) seeding and removed the IRC code.

These seeding domains would vend a list of IP addresses which were current the last time their node checked them.

A program which can be installed onto macOS and Ubuntu is called dig.

You can use it like so:

dig <domain name>

It will return information about that domain.


>$ dig

; <<>> DiG 9.10.6 <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52932
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1

; EDNS: version: 0, flags:; udp: 512
;			IN	A

;; ANSWER SECTION:		245	IN	A		245	IN	A		245	IN	A		245	IN	A

;; Query time: 44 msec
;; WHEN: Fri Feb 21 22:04:12 AEDT 2020
;; MSG SIZE  rcvd: 103

Within the ANSWER SECTION you'll see the domain names and their associated IP addresses 245 IN A

To be able to use this dig program from within your own program you can fire off a process which launches this program with any command-line parameters you'd like.

dig has a special command line flag called +short.

This will cull out everything except the IP address answers.

The following Swift language code snippet works on both macOS and Linux programs ( tested only on Ubuntu 19 and macOS Mojave )

        let task = Process()
        task.launchPath = "/usr/bin/env"
        task.arguments = ["dig",
        let pipe = Pipe()
        task.standardOutput = pipe
        let data = pipe.fileHandleForReading.readDataToEndOfFile()
        if let addresses = String(data: data, encoding: .utf8) {

This will print out a list of the IP addresses vended by those seeding domains


Give it a try and see if it helps you with whatever project you're coding up.

Keep on hacking

$ 0.00
Avatar for phil.wilson
Written by
1 month ago
Enjoyed this article?  Earn Bitcoin Cash by sharing it! Explain
...and you will also help the author collect more tips.


About us Rules What is Bitcoin Cash? Roadmap Affiliate program Get sponsored Self-host (PGP key) Reddit