Code Monkey home page Code Monkey logo

bitcoin-seeder's Introduction

bitcoin-seeder
==============

Bitcoin-seeder is a crawler for the Bitcoin network, which exposes a list
of reliable nodes via a built-in DNS server.

Features:
* regularly revisits known nodes to check their availability
* bans nodes after enough failures, or bad behaviour
* accepts nodes down to v0.3.19 to request new IP addresses from,
  but only reports good post-v0.3.24 nodes.
* keeps statistics over (exponential) windows of 2 hours, 8 hours,
  1 day and 1 week, to base decisions on.
* very low memory (a few tens of megabytes) and cpu requirements.
* crawlers run in parallel (by default 24 threads simultaneously).

REQUIREMENTS
------------

$ sudo apt-get install build-essential libboost-all-dev libssl-dev

USAGE
-----

Assuming you want to run a dns seed on dnsseed.example.com, you will
need an authorative NS record in example.com's domain record, pointing
to for example vps.example.com:

$ dig -t NS dnsseed.example.com

;; ANSWER SECTION
dnsseed.example.com.   86400    IN      NS     vps.example.com.

On the system vps.example.com, you can now run dnsseed:

./dnsseed -h dnsseed.example.com -n vps.example.com

If you want the DNS server to report SOA records, please provide an
e-mail address (with the @ part replaced by .) using -m.

COMPILING
---------

Compiling will require boost and ssl.  On debian systems, these are provided
by `libboost-dev` and `libssl-dev` respectively.

$ make

This will produce the `dnsseed` binary.

TESTING
-------

It's sometimes useful to test `dnsseed` locally to ensure it's giving good
output (either as part of development or sanity checking). You can inspect
`dnsseed.dump` to inspect all nodes being tracked for crawling, or you can
issue DNS requests directly. Example:

$ dig @:: -p 15353 dnsseed.example.com
       ^       ^    ^
       |       |    |__ Should match the host (-h) argument supplied to dnsseed
       |       |
       |       |_______ Port number (example uses the user space port; see below)
       |
       |_______________ Explicitly call the DNS server on localhost


RUNNING AS NON-ROOT
-------------------

Typically, you'll need root privileges to listen to port 53 (name service).

One solution is using an iptables rule (Linux only) to redirect it to
a non-privileged port:

$ iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-port 15353

If properly configured, this will allow you to run dnsseed in userspace, using
the -p 15353 option.

Another solution is allowing a binary to bind to ports < 1024 with setcap (IPv6 access-safe)

$ setcap 'cap_net_bind_service=+ep' /path/to/dnsseed

bitcoin-seeder's People

Contributors

c-otto avatar erkmos avatar jonasschnelli avatar laanwj avatar lclc avatar luke-jr avatar maaku avatar martindale avatar petertodd avatar r000n avatar recursive-rat4 avatar sickpig avatar sipa avatar sjors avatar thonkle avatar uhliksk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bitcoin-seeder's Issues

dnsseed does not get multiple addr from Bitcoin 0.12.0+

It seems that something in the Bitcoin protocol for version 0.12.0+ has changed in such a way that the dnsseeder only gets a single addr (AdvertiseLocal) from a node it connects to.

I have forced dnsseed to connect to specific nodes with version 0.11.2, 0.12.0 and 0.12.1 and dnsseed only got multiple addr from 0.11.2 while 0.12.0/0.12.1 simply closed the connection after sending one node.

This is the output while connecting to a 0.11.2 node

Starting seeder...done
Starting 96 crawler threads...done
[16-05-31 18:18:19] 0/1 available (0 tried in 1464711499s, 0 new, 1 active), 0 banned; 0 DNS requests, 4 db queries
5.196.75.28:8333      : SEND version
5.196.75.28:8333      : RECV version
5.196.75.28:8333      : SEND verack
5.196.75.28:8333      : done processing version
5.196.75.28:8333      : RECV verack
5.196.75.28:8333      : version 70002
5.196.75.28:8333      : SEND getaddr
5.196.75.28:8333      : done processing verack
5.196.75.28:8333      : RECV ping
5.196.75.28:8333      : done processing ping
5.196.75.28:8333      : RECV addr
5.196.75.28:8333      : got 1000 addresses
5.196.75.28:8333      : got address 37.233.101.132:8333
5.196.75.28:8333      : added address 37.233.101.132:8333 (#0)
[...]2000 lines removed [...]
5.196.75.28:8333      : got address 104.200.151.89:8333
5.196.75.28:8333      : added address 104.200.151.89:8333 (#129)
5.196.75.28:8333      : done processing addr
5.196.75.28:8333: GOOD!!!

And this is the output while connecting to a 0.12.x node

Starting seeder...done
Starting 96 crawler threads...done
[16-05-31 18:28:10] 0/1 available (0 tried in 1464712090s, 0 new, 1 active), 0 banned; 0 DNS requests, 4 db queries
95.170.95.133:8333    : SEND version
95.170.95.133:8333    : RECV version
95.170.95.133:8333    : SEND verack
95.170.95.133:8333    : done processing version
95.170.95.133:8333    : RECV verack
95.170.95.133:8333    : version 70012
95.170.95.133:8333    : SEND getaddr
95.170.95.133:8333    : done processing verack
95.170.95.133:8333    : RECV ping
95.170.95.133:8333    : done processing ping
95.170.95.133:8333    : RECV addr
95.170.95.133:8333    : got 1 addresses
95.170.95.133:8333    : got address 95.170.95.133:8333
95.170.95.133:8333    : added address 95.170.95.133:8333 (#1)
95.170.95.133:8333    : done processing addr
95.170.95.133:8333: GOOD!!!

As you can see it only gets one entry: the one it has connected to (AdvertiseLocal).

License missing

I can't find any indication under what license this is published. Please clarify.

Log is really strange

Any way to get this thing to use newline \n instead of a bunch of whitespace?

Starting 4 DNS threads for dnsseed.pigeoncoin.org on vps.pigeoncoin.org (port 53).......done
Starting seeder...done
Starting 96 crawler threads...done
                                                                                                                   [18-03-27 01:12:50] 0/85 available (                                                                                 [18-03-27 01:12:51] 0/125 available (0 tried in 1522113171s, 125 new,                                                  [18-03-27 01:12:52] 0/125 available (0 tried in 1522113172s, 125 new, 0 active), 0 banned; 0 DNS reque                                                                                                                                        [18-03-27 01:12                                                                                                        [18-03-27 01:12:55] 0/125 available (0 tried in                                                                         [18-03-27 01:12:56] 0/125 available (0 tried in 1522113176s, 61 new, 64 active                                         [18-03-27 01:12:57] 0/125 available (0 tried in 1522113177s, 45 new, 80 active), 0 banned; 0 DNS requests, 0 d                                                                                                                                 [18-03-27 01:12:59] 0/                                                                                                 [18-03-27 01:13:00] 0/125 available (0 tried in 152211                                                                 [18-03-27 01:13:01] 0/125 available (0 tried in 1522113181s, 0 new, 125 active), 0 ban                                 [18-03-27 01:13:02] 0/125 available (0 tried in 1522113182s, 0 new, 125 active), 0 banned; 0 DNS requests, 0 db querie                                                                                                                        [18-03-27 01:13:04] 0/125 avail                                                                                        [18-03-27 01:13:05] 0/125 available (0 tried in 1522113185s, 0 new, 125 active), 0 banned; 0 DNS requests, 0 db queries^C

crawler question

Why is it that I can only get less than 3,000 nodes every two hours when crawling against a seed node at a time? Sometimes even just 5000 nodes in one night.
1689937902697

Is this expression correct? It looks wrong..

if (idToInfo[ret].ignoreTill && idToInfo[ret].ignoreTill < now) {

Seems to me ignoreTill's intention is to ignore a node until some timepoint in the future. This expression appears to .. have the condition inverted, and only ignore nodes with ignoreTill in the past, and not ignore them if ignoreTill is in the future..

Does not listen port 53

Fresh Lbuntu 17.10 install in Virtual box. No error on compilation.

I run
sudo ./dnsseed -h dnsseed -n localhost -m test. -p 53
...
Starting 4 DNS threads for dnsseed on localhost (port 53).......done
...

but
nslookup dnsseed localhost
;; connection timed out; no server could be reached

Build error with gcc 13.2.0

I span up a new DigitalOcean VM running Ubuntu 23.10. Installed all requirements:

sudo apt-get install build-essential libboost-all-dev libssl-dev

My gcc version:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.2.0-4ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-XYspKM/gcc-13-13.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-XYspKM/gcc-13-13.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (Ubuntu 13.2.0-4ubuntu3) 
root@dnsseeder-main:~/litecoin-seeder# ls
Makefile  bitcoin.cpp  bitcoin.o   compat.h  db.h     dns.h  main.cpp     netbase.h     protocol.h   strlcpy.h  uint256.h  util.h
README    bitcoin.h    combine.pl  db.cpp    dns.cpp  dns.o  netbase.cpp  protocol.cpp  serialize.h  test.pl    util.cpp
root@dnsseeder-main:~/litecoin-seeder# nano netbase.h
root@dnsseeder-main:~/litecoin-seeder# g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.2.0-4ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-XYspKM/gcc-13-13.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-XYspKM/gcc-13-13.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (Ubuntu 13.2.0-4ubuntu3)

And trying to build fails with error:

$ make
g++ -std=c++11 -pthread -O3 -g0 -Wall -Wno-unused -Wno-sign-compare -Wno-reorder -Wno-comment -c -o dns.o dns.cpp
g++ -std=c++11 -pthread -O3 -g0 -Wall -Wno-unused -Wno-sign-compare -Wno-reorder -Wno-comment -c -o bitcoin.o bitcoin.cpp
g++ -std=c++11 -pthread -O3 -g0 -Wall -Wno-unused -Wno-sign-compare -Wno-reorder -Wno-comment -c -o netbase.o netbase.cpp
In file included from netbase.cpp:13:
strlcpy.h:27:15: error: ‘size_t strlcpy(char*, const char*, size_t)’ redeclared inline without ‘gnu_inline’ attribute
   27 | inline size_t strlcpy(char *dst, const char *src, size_t siz)
      |               ^~~~~~~
In file included from /usr/include/features.h:502,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/c++config.h:679,
                 from /usr/include/c++/13/bits/requires_hosted.h:31,
                 from /usr/include/c++/13/string:38,
                 from netbase.h:7,
                 from netbase.cpp:6:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:150:1: note: ‘size_t strlcpy(char*, const char*, size_t)’ previously defined here
  150 | __NTH (strlcpy (char *__restrict __dest, const char *__restrict __src,
      | ^~~~~
strlcpy.h:62:15: error: ‘size_t strlcat(char*, const char*, size_t)’ redeclared inline without ‘gnu_inline’ attribute
   62 | inline size_t strlcat(char *dst, const char *src, size_t siz)
      |               ^~~~~~~
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:167:1: note: ‘size_t strlcat(char*, const char*, size_t)’ previously defined here
  167 | __NTH (strlcat (char *__restrict __dest, const char *__restrict __src,
      | ^~~~~
make: *** [Makefile:8: netbase.o] Error 1

compile for Raspberry Pi 4

Is it possible to compile the code on a Raspberry Pi 4? I get the following build errors

g++ -pthread -O2 -o dnsseed dns.o bitcoin.o netbase.o protocol.o db.o main.o util.o -lcrypto
/usr/bin/ld: main.o: in function ThreadStats': main.cpp:(.text+0x584): undefined reference to __atomic_load_8'
/usr/bin/ld: main.o: in function GetIPList': main.cpp:(.text+0xe7c): undefined reference to __atomic_fetch_add_8'
/usr/bin/ld: main.o: in function main': main.cpp:(.text.startup+0x47c): undefined reference to __atomic_store_8'
collect2: error: ld returned 1 exit status
make: *** [Makefile:5: dnsseed] Error 1

thank you
Michel

Stack corruption

If a sufficient amount of AAAA records is associated with a DNS request, a buffer overflow will occur in write_record_aaaa; up to 11 bytes beyond the end of the output buffer can be overwritten.

Append this to dns.cpp:

const uint8_t addresses[19][20] = {
{ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0B, 0x04, 0x00, 0x00, 0x00, 0x04,  },
{ 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x24, 0x03, 0x00, 0x48, 0x00, 0x00, 0x1E, 0x03, 0x00, 0x00, 0x00, 0x31, 0xFF,  },
{ 0x04, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0xF6, 0xB7, 0xFF, 0xFF, 0xE1, 0xFF, 0xFF, 0xFC, 0x00, 0x00, 0xFF,  },
{ 0x06, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0xFA, 0xFF, 0x00, 0x00, 0xFF, 0xFF,  },
{ 0x04, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0xF6, 0xB7, 0xFF, 0xFF, 0xE1, 0xFF, 0xFF, 0xFC, 0x00, 0x00, 0xFF,  },
{ 0x06, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0xFA, 0xFF, 0x00, 0x00, 0xFF, 0xFF,  },
{ 0x04, 0x00, 0x00, 0x00, 0x03, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x3A, 0xFF, 0xFF, 0x24, 0x03, 0x00, 0x00, 0x00, 0x00, 0xFF,  },
{ 0x06, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0B, 0x04, 0x00, 0xFF, 0x08, 0x00,  },
{ 0x06, 0x00, 0x00, 0x00, 0x03, 0xFF, 0x00, 0x00, 0x30, 0x22, 0x3A, 0xFF, 0xFF, 0x24, 0x03, 0x00, 0x00, 0x00, 0x00, 0xFF,  },
{ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0x0B, 0x04, 0x00, 0x00, 0x00, 0x00,  },
{ 0x06, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x24, 0x03, 0x00, 0x48, 0x00, 0x00, 0x24, 0x03, 0x00, 0x00, 0x00, 0x00, 0xFF,  },
{ 0x06, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0xFA, 0xFF, 0x00, 0x00, 0xFF, 0xFF,  },
{ 0x06, 0x00, 0x00, 0x00, 0x03, 0xFF, 0x00, 0x00, 0x00, 0x02, 0x3A, 0xFF, 0xFF, 0x24, 0x03, 0x00, 0x00, 0x00, 0x00, 0xFF,  },
{ 0x04, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0B, 0x04, 0x00, 0xFF, 0x08, 0x00,  },
{ 0x06, 0x00, 0x00, 0x00, 0x03, 0xFF, 0x00, 0x00, 0x30, 0x22, 0x3A, 0xFF, 0xFF, 0x24, 0x03, 0x00, 0x00, 0x00, 0x00, 0xFF,  },
{ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0x0B, 0x04, 0x00, 0x00, 0x00, 0x00,  },
{ 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x24, 0x03, 0x00, 0x48, 0x00, 0x00, 0x24, 0x03, 0x00, 0x00, 0x00, 0x00, 0xFF,  },
{ 0x06, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0B, 0x04, 0x00, 0x00, 0x00, 0x00,  },
{ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCF, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A,  } };

int cb(void *opt, char *requested_hostname, addr_t *addr, int max, int ipv4, int ipv6) {
    uint32_t num = 0;
    while ( num < max && num < 19 ) {
        memcpy(&addr[num], addresses[num], 20);
        num++;
    }
    return num;
}

int main(void)
{
    const uint8_t in[] = {0x1B, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x23, 0x00,
                          0x7A, 0x08, 0x00, 0x00, 0xFF, 0x00, 0xFF};
    uint8_t out[BUFLEN];
    dns_opt_t opt;
    opt.port = 0;
    opt.datattl = 0;
    opt.nsttl = 0;
    opt.host = "";
    opt.ns = "";
    opt.mbox = "";
    opt.cb = cb;
    opt.nRequests = 0;
    dnshandle(&opt, in, sizeof(in), out);
    return 0;
}
$ g++ dns.cpp && ./a.out
*** stack smashing detected ***: <unknown> terminated
Aborted (core dumped)

DNSSEC

Brought up by @TheBlueMatt recently. Not sure what's involved for adding support.

question

Can I use this software and bind9 in one server together?

IPV4 only?

Can you only support IPV4 discovery, can you add IPV6 recognition?

Seed crash ('std::ios_base::failure[abi:cxx11])

./dnsseed -p 5353 -h seed.testnet.bitcoin.sprovoost.nl -n ec2-18-195-105-234.eu-central-1.compute.amazonaws.com -m [email protected] --testnet
Supporting whitelisted filters: 0x1,0x5,0x9,0xd
Using testnet.
Loading dnsseed.dat...done
Starting 4 DNS threads for seed.testnet.bitcoin.sprovoost.nl on ec2-18-195-105-234.eu-central-1.compute.amazonaws.com (port 5353).......done
Starting seeder...done
Starting 96 crawler threads...done
[18-01-21 21:19:44] 759/6834 available (6388 tried in 999s, 1 new, 445 active), 35701 banned; 26 DNS requests, 7 db queriesterminate called after throwing an instance of 'std::ios_base::failure[abi:cxx11]'
  what():  CAutoFile::write : write failed: iostream error
Aborted (core dumped)

dnsstats.log

Is there an easy way to use dnsseeder, without DNS ?

Hi,

I'm looking to use DNSseeder script ... without DNS. I don't have any DNS server.

I want to start crawling the network, by connecting it to 'localhost', a locally running Full Node. Possible ? How?

Thanks,

bitcoin-seeder not listening on IPv4

My fork of bitcoin-seeder is no longer working, but ti did initially. Upon troubleshooting I can see that it is not listening on IPv4, only IPv6. As my VPS only runs IPv4 I'm pretty sure this is why it's stopped working.

Is there a way to force it to only listen on IPv4?

[root@160398 ~]# netstat -nlp |grep 53
udp6 0 0 :::53 :::* 150/./dnsseed

Using this program on a private network

Hi

I have a private network and want to use the dns application to resolve known hosts. How do i tell it to only search my network?

I have three full nodes talking to eachother. Does the dns app run on a fullnode? How does it know to search starting from one of my addresses?

thanks!

Best
Dave

Seeds nodes on different port

I set up a sipa seeder and it is grabbing peers from a different coin that uses a different p2p port. Any recommendations for solving this?

Support TOR

Due to data-center operators (example: Hetzer) blocks/shutdowns of dns seeders (@schildback @jonasschnelli) because of alleged netscanning which can be against the datacenter TOC, support for crawling through TOR would be nice.

Seed only returns a single IP

I am trying to understand why the seeder is only returning one IP in my case while there are hundreds of nodes connected to it. Is there any additional debug that can be enabled to find more info? I uncommented all the printf's but im still not getting clear into on why more active peers aren't being identified and returned in the DNS query. Thx.

More info: https://bitcointalk.org/index.php?topic=3515046.new#new

how to setup nameservers correctly?

i want to run a dns seeder for bitcoin. i have registered a domain. How to setup nameservers pointing to dns seeder?

I currently have nameservers setup correctly with godaddy. I have added vps host ip address to register as a nameserver.

Type | Name | Value | TTL | Actions
-- | -- | -- | -- | --
A | @ | x.x.xxxx.x | 1 Hour | Edit
A | dnsseed | x.x.xxxx.x | 1 Hour | Edit
A | vps | x.x.xxxx.x | 1 Hour | Edit
NS | @ | ns59.domaincontrol.com | 1 Hour |  
NS | @ | ns60.domaincontrol.com | 1 Hour |  
NS | dnsseed | vps | 1 Hour

and i run

./dnsseed -h dnsseed.example.com -n vps.example.com
but when i check it, the dns seeder is NOT listening on port 53.
I run with ubuntu LTS 16 and i am running both daemon and dnseeder on the same machine.

This also not working

dig dnsseed.mydomain.com

$ dig dnsseed.example.org

; <<>> DiG 9.8.3-P1 <<>> dnsseed.example.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 3808
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

What is wrong here?
I have opened port 53 TCP/UDP

crawler: Collect Tor v3 and I2P addresses?

Tor v3 and I2P addresses are too large for DNS seeding, and it would be unnecessary in the first place (also because it is not possible/practical to access DNS over these networks).

However, it could still be useful to collect them for other purposes. For example, in the Bitcoin Core release process we use the text output of a DNS seeder as input for generating the hardcoded list of seeds. We are going to need some kind of crawler that supports these addresses.

License Question

Hi, what license is this seeder? Can I use this freely as open source or I have to pay someone?

Question

Hi!
Does the DNS return the list of IPs given by the below function?
void CAddrDb::GetIPs_(set& ips, uint64_t requestedFlags, int max, const bool* nets);
thankyou

Question about db.cpp -> GetIPs_

In db.cpp GetIPs_ there is a very strange code :
if (max > goodIdFiltered.size() / 2) max = goodIdFiltered.size() / 2; if (max < 1) max = 1;
Why do we return half of the good nodes ?

Nodes the seeder is tracking may not always persist to disk due to races between ThreadDumper and ThreadCrawler

If ThreadDumper wakes up to save to disk periodically, it may miss nodes that are otherwise good and won't save them to disk. This is because it basically is getting nodes to save to disk from CAddrDb from its two lists: ourId and unkId.

However, when the crawler threads run, they "take" IPs to check from the CAddrDb class. These nodes are temporarily "popped" off the internal lists ourId and/or unkId (only to be returned later once a good/bad result is determined by the crawler).

So if ThreadDumper wakes up while any crawlers are actively checking nodes.. those nodes won't get saved to disk. :'(

What's the meaning of variable "clientVersion"?

The variable "clientVersion" is compared with REQUIRE_VERSION(which is a protocol version) in the function IsGood,

if (clientVersion && clientVersion < REQUIRE_VERSION) return false;

while it is compared with 31900(which seems to be a client version v0.3.19) in the function GetBanTime.

if (clientVersion && clientVersion < 31900) { return 604800; }

I'm confused. What on earth should "clientVersion" be compared with? Client version or protocol version?
This is the output of bitcoin-cli.

$ bitcoin-cli getnetworkinfo
{
  "version": 170100,
  "subversion": "/Satoshi:0.17.1/",
  "protocolversion": 70015,
......
}

Looking forward reply. Thanks!

why this listenSocket code in a thread function

pthread_create(&threadDns, NULL, ThreadDNS, dnsThread[i])
may run many times?

bitcoin-seeder/dns.c

Lines 390 to 410 in d54f39a

if (listenSocket == -1) {
struct sockaddr_in6 si_me;
if ((listenSocket=socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP))==-1) {
listenSocket = -1;
return -1;
}
replySocket = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
if (replySocket == -1)
{
close(listenSocket);
return -1;
}
int sockopt = 1;
setsockopt(listenSocket, IPPROTO_IPV6, DSTADDR_SOCKOPT, &sockopt, sizeof sockopt);
memset((char *) &si_me, 0, sizeof(si_me));
si_me.sin6_family = AF_INET6;
si_me.sin6_port = htons(opt->port);
si_me.sin6_addr = in6addr_any;
if (bind(listenSocket, (struct sockaddr*)&si_me, sizeof(si_me))==-1)
return -2;
}

compiler error

I get this error in debian 8

make

gcc -pthread -std=c99 -O3 -g0 -march=native dns.c -Wall -c -o dns.o
g++ -std=c++11 -pthread -O3 -g0 -march=native -Wall -Wno-unused -Wno-sign-compare -Wno-reorder -Wno-comment -c -o bitcoin.o bitcoin.cpp
g++ -std=c++11 -pthread -O3 -g0 -march=native -Wall -Wno-unused -Wno-sign-compare -Wno-reorder -Wno-comment -c -o netbase.o netbase.cpp
In file included from /usr/include/boost/mpl/aux_/na_assert.hpp:23:0,
from /usr/local/include/boost/mpl/arg.hpp:25,
from /usr/local/include/boost/mpl/placeholders.hpp:24,
from /usr/local/include/boost/iterator/iterator_categories.hpp:17,
from /usr/local/include/boost/iterator/iterator_adaptor.hpp:14,
from /usr/local/include/boost/iterator/transform_iterator.hpp:12,
from /usr/include/boost/algorithm/string/case_conv.hpp:17,
from netbase.cpp:14:
/usr/local/include/boost/mpl/assert.hpp:28:41: fatal error: boost/mpl/aux_/config/gpu.hpp: No such file or directory
#include <boost/mpl/aux_/config/gpu.hpp>
^
compilation terminated.
Makefile:8: recipe for target 'netbase.o' failed
make: *** [netbase.o] Error 1

Seeds do not resolve from certain networks

A small number of Bitcoin Wallet for Android users are facing the problem that all three seed dns domains do not resolve. I file this issue to coordinate a debugging effort between the affected users and the operators of the seeds.

Bitcoin Wallet is using bitcoinj which uses standard Java API "InetAddress.getAllByName(seed)" for resolving. These three names are tried:

seed.bitcoin.sipa.be
dnsseed.bluematt.me
dnsseed.bitcoin.dashjr.org

If the issue surfaces, all three names cannot be resolved. Message in the log:

[PeerGroup STARTING] DnsDiscovery - Failed to look up DNS seeds from seed.bitcoin.sipa.be: java.net.UnknownHostException: Unable to resolve host "seed.bitcoin.sipa.be": No address associated with hostname

The affected users claim that at the same time there are not issues with other domains or any internet connectivity issues. They an reproduce the issue by moving back and forth an affected network.

Needless to say, DNS requests do not directly go to the seed dns servers but are relayed via the default DNS server if the network (usually set via DHCP). Its very well possible that an intermediate dns server modifies the request in a way the seeders do not understand. In the past, there was one such issue when certain DNS servers randomly camelcased the domain name in the request and the seeders were using case sensitive checks (violating the spec).

Since bitcoinj currently does not persist any peers across restarts or even parse address messages, failure to resolve any peer leads to being disconnected from the P2P network.

One app that might be helpful to debug issues on the Android side is DNS Lookup: https://play.google.com/store/apps/details?id=com.kodholken.dnslookup

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.