GithubHelp home page GithubHelp logo

pinkdiamond1 / 0dns Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 0chain/0dns

0.0 1.0 0.0 260 KB

A DNS service for 0Chain clients

License: MIT License

Shell 19.43% Go 76.88% Dockerfile 3.69%

0dns's Introduction

0dns

This service is responsible for connecting to the network and fetching all the magic blocks from the network which are saved in the DB. There is a Network API which can be used to get latest set of miners and sharders for the network using the magic block.

Table of Contents

Setup

Clone the repo and run the following command inside the cloned directory

./docker.local/bin/init.sh

Building and Starting the Node

If there is new code, do a git pull and run the following command

./docker.local/bin/build.sh

Run the container using

./docker.local/bin/start.sh

Point to another blockchain

You can point the server to any instance of 0chain blockchain you like, Just go to config (docker.local/config) and update the magic_block.json.

By default they are pointing to local network with 4 miners and 1 sharder

You have to get the magic block from the chain you want to connect and update the magic_block.json file.

It will use that file to extract miners and sharders value and use that for further operations.

Exposed APIs

0dns exposes:

Network API

{BASEURL}/network

This API can be used to fetch the latest set of miners and sharder to connect. GoSDK will also uses this API to fetch miner/sharders value on runtime.

Details: https://0chain.net/page-documentation.html#tag/BlockWorker/paths/~1network/get

Magic Block API

{BASEURL}/magic_block

This API can be used to fetch the latest magic block data from network.

Details: https://0chain.net/page-documentation.html#tag/BlockWorker/paths/~1magic_block/get

Config Changes

You can do other config changes as well in 0dns.yaml file itself, Like

  • Mongo DB connection URL, DB name and pool size
mongo:
  url: mongodb://mongodb:27017
  db_name: block-recorder
  pool_size: 2
  • Server port
port: 9091
  • Logging info level
logging:
  level: "info"
  console: false # printing log to console is only supported in development mode
  • Worker related config
worker:
  magic_block_worker: 5 # in seconds, Frequency to update magic block

Cleanup

Get rid of old data when the blockchain is restarted or if you point to a different network:

./docker.local/bin/clean.sh

Network issue

If there is no test network, run the following command

docker network create --driver=bridge --subnet=198.18.0.0/15 --gateway=198.18.0.255 testnet0

Troubleshooting

  1. When running locally, if http://localhost:9091/network is returning below. Some commands might fail.
{
  "miners": [
    "https://198.18.0.71/",
    "https://198.18.0.72/",
    "https://198.18.0.74/",
    "https://198.18.0.73/"
  ],
  "sharders": [
    "https://198.18.0.81/"
  ]
}

To fix the miner and sharder URLs so it works locally, update docker.local/config/0dns.yaml to disable both use_https and use_path (set to false).

0dns's People

Contributors

anish-squareops avatar avanaur avatar cnlangzi avatar fabiodmferreira avatar hm90121 avatar kishan-dhakan avatar krishnadeqode avatar m-s-a-c avatar manali-jain-squareops avatar noskillguy avatar rizary avatar service-0chain avatar shahnawaz-creator avatar sriep avatar stewartie4 avatar vinayakgautamops avatar yarikrevich avatar

Watchers

 avatar

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.