Giter Club home page Giter Club logo

chainnet's Introduction

ChainNet

Setup

Install dependencies:

$ sudo apt install protobuf-compiler 

Install go packages:

$ go install google.golang.org/protobuf/cmd/protoc-gen-go
$ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc

Increase UDP size to optimize P2P communication:

$ sudo sysctl -w net.core.rmem_max=7500000
$ sudo sysctl -w net.core.wmem_max=7500000

Configuration

Default configuration:

seed-nodes:                               # List of seed nodes
  - address: "seed-1.chainnet.yago.ninja"
    peer-id: "12D3KooWSQ5pAJW8mq5RpZjQLzyD5ikgyLoXWjJz8HfteW7jiyks"
    port: 9100
  - address: "seed-2.chainnet.yago.ninja"
    peer-id: "peerID-2"
    port: 8081
  - address: "seed-3.chainnet.yago.ninja"
    peer-id: "peerID-3"
    port: 8082

storage-file: "bin/miner-storage"         # File used for persisting the chain status
pub-key:                                  # Public wallet key encoded in base58, used for receiving mining rewards
  "aSq9DsNNvGhYxYyqA9wd2eduEAZ5AXWgJTbTG7ZBzTqdDQvpbDVh5j5yCpKYU6MVZ35PW9KegkuX1JZDLHdkaTAbKXwfx4Pjy2At82Dda9ujs8d5ReXF22QHk2JA"
mining-interval: "10m"                    # Interval between block creation

p2p:
  enabled: true                           # Enable or disable network communication
  identity:
    priv-key-path: "ecdsa-priv-key.pem"   # ECDSA peer private key path in PEM format (leave empty to generate a random identity)

  peer-port: 9100                         # Port used for network communication with other peers
  min-conn: 5                             # Minimum number of connections
  max-conn: 100                           # Maximum number of connections
  conn-timeout: "60s"                     # Maximum duration of a connection
  write-timeout: "20s"                    # Maximum duration of a write stream
  read-timeout: "20s"                     # Maximum duration of a read stream
  buffer-size: 4096                       # Read buffer size over the network

Build

Building the chainnet-node:

$ make node

Building the chainnet-miner node:

$ make miner

Building a chainnet-nespv wallet:

$ make nespv 

Running

Local

Running the chainnet-node:

$ ./bin/chainnet-node --config default-config.yaml

Running the chainnet-miner:

$ ./bin/chainnet-miner --config default-config.yaml

Running the chainnet-nespv wallet:

Remote nodes with Ansible

Running the chainnet-node on a remote node:

$ ansible-playbook -i ansible/hosts.ini ansible/deploy.yml -e "target=node config=../default-config.yaml"

Running the chainnet-miner on a remote node:

$ ansible-playbook -i ansible/hosts.ini ansible/deploy.yml -e "target=miner config=../default-config.yaml"

Run in Kubernetes

Deploy the helm chart:

$ helm install chainnet ./helm

Uninstall the helm chart:

$ helm uninstall chainnet

Generating node identities

Generate a ECDSA secp256r1 private key in PEM format:

$ openssl ecparam -name prime256v1 -genkey -noout -out ecdsa-priv-key.pem

Architecture

┌──────────────────┐                 ┌──────────────────┐
│                  │                 │                  │
│  ChainNet Node   ├────────────────►│  ChainNet Miner  │
│                  │                 │                  │
└──────────────────┘                 └──────────────────┘

chainnet's People

Contributors

yago-123 avatar dependabot[bot] avatar

Watchers

 avatar

chainnet's Issues

Implement OnBlockAddition function for p2p module

OnBlockAddition is called when a new block is added to the chain. Think and implement how this should be propagated to the other nodes via OnBlockAddition method.

Probably we need to implement the Gossip protocol from libp2p or we should notify all peers that we are conected to.

Adjust amount field in transactions

Right now we use Amount field as uint. For example in miner InitialCoinbaseReward the value must be adjusted to reflect the actual reward (multiply by X).

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.