Coder Social home page Coder Social logo

dnsseed's Introduction

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

DB
--

The PDNS DB should be the default one according to the PDNS docs
http://doc.powerdns.com/generic-mypgsql-backends.html
Additionally, a low query-cache should be set so that new nodes are always
being returned, and gmysql-any-query should be set to
select content,ttl,prio,type,domain_id,name from records where name='%s' order by rand() limit 10

The bitcoin db should be as follows:

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

-- Database: `bitcoin`

CREATE TABLE IF NOT EXISTS `nodes` (
  `ipv4` int(11) NOT NULL,
  `port` smallint(5) unsigned NOT NULL DEFAULT '8333',
  `last_check` timestamp NULL DEFAULT NULL,
  `accepts_incoming` bit(1) NOT NULL DEFAULT b'0',
  `version` int(11) DEFAULT NULL,
  `last_seen` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `first_up` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`ipv4`,`port`),
  KEY `last_check` (`last_check`),
  KEY `last_seen` (`last_seen`)
);

Running
-------

To bootstrap call php bitcoin-scan.php (the ip of a known-good node)
ie
php bitcoin-scan.php `dig +short bluematt.me`
warning: this node will end up in the database, so call a node by its public ip
followed by repeated calls to php bitcoin-scan-net.php which will fill the dbs
quite quickly.
bitcoin-scan-net.php should also be put on an appropriate cron job, checking
to make sure it isnt already running (which would just duplicate effort)

Bugs/Todo/etc
-------------
TODO: I didnt bother with setting up PDNS to simply pull from the bitcoin db, which
is probably more ideal than its own separate db simply becaues I already have a pdns
db and server configured.
This could be achieved using the appropriate gmysql-*-query settings in pdns.conf

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.