read.cash Log in
@phil.wilson more from that month

Bitcoin Cash Seeding

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. Example: >$ dig reddit.com ; <<>> DiG 9.10.6 <<>> reddit.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52932 ;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 512 ;; QUESTION SECTION: ;reddit.com. IN A ;; ANSWER SECTION: reddit.com. 245 IN A 151.101.1.140 reddit.com. 245 IN A 151.101.65.140 reddit.com. 245 IN A 151.101.129.140 reddit.com. 245 IN A 151.101.193.140 ;; Query time: 44 msec ;; SERVER: 61.9.194.49#53(61.9.194.49) ;; 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 `reddit.com. 245 IN A 151.101.65.140` 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",                           "+short",                           "seed.bitcoinabc.org",                           "seed-abc.bitcoinforks.org",                           "btccash-seeder.bitcoinunlimited.info",                           "seed.bchd.cash"]         let pipe = Pipe()         task.standardOutput = pipe         task.launch()         let data = pipe.fileHandleForReading.readDataToEndOfFile()         if let addresses = String(data: data, encoding: .utf8) {             print(addresses)         } This will print out a list of the IP addresses vended by those seeding domains Example: 47.254.132.156 138.197.209.186 95.217.91.182 96.61.84.171 136.244.71.247 35.195.113.76 45.32.244.156 198.199.125.113 159.89.230.79 104.236.161.94 206.189.119.159 Give it a try and see if it helps you with whatever project you're coding up. Keep on hacking

No comments yet

Log in to join in Reading is open to everyone. Replying needs an account.