Giter Site home page Giter Site logo

mita23456 / hermez-node Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hermeznetwork/hermez-node

0.0 0.0 0.0 4.16 MB

Hermez node Go implementation

License: GNU Affero General Public License v3.0

Shell 0.09% Go 98.56% Makefile 0.33% PLpgSQL 1.02% Dockerfile 0.01%

hermez-node's Introduction

hermez-node Go Report Card Test Status Lint Status GoDoc

Go implementation of the Hermez node.

Developing

To contribute to this codebase you must follow the branch model and development flow.

Go version

The hermez-node has been tested with go version 1.14

Build

  • Build the binary in the local environment for you current OS and check the current version:
$ make
$ ./dist/heznode version
  • Build the binary in a docker container for all supported OS and check the current version (only docker needed):
$ make docker-build
$ ./dist/heznode_<LOCAL_OS>_amd64/heznode version
  • Build the binary in the local environment for all supported OS using Goreleaser and check the current version:
$ make goreleaser
$ ./dist/heznode_<LOCAL_OS>_amd64/heznode version

Run

First you must edit the default/template config file into cmd/heznode/cfg.buidler.toml, there are more information about the config file into cmd/heznode/README.md

After setting the config, you can build and run the Hermez Node as a synchronizer:

$ make run-node

Or build and run as a coordinator, and also passing the config file from other location:

$ MODE=sync CONFIG=cmd/heznode/cfg.builder.toml make run-node

To check the useful make commands:

$ make help

Run as a service

$ sudo make install

After, update the config file manually at /etc/hermez/config.toml

$ sudo service heznode start

To check status

$ sudo service heznode status

To stop

$ sudo service heznode stop

If you just kill the process systemd will restart without asking.

Unit testing

Running the unit tests requires a connection to a PostgreSQL database. You can run PostgreSQL with docker easily this way:

$ make run-database-container

Afterward, run the tests:

$ make test

There is an extra temporary option that allows you to run the API server using the Go tests. It will be removed once the API can be properly initialized with data from the synchronizer. To use this, run:

$ make test-api-server

It is also possible to run the tests with an existing PostgreSQL server, e.g.

$ PGHOST=someserver PGUSER=hermez2 PGPASSWORD=secret make test

Lint

All Pull Requests need to pass the configured linter.

To run the linter locally, first, install golangci-lint.
Afterward, you can check the lints with this command:

$ make gocilint

Usage

Node

See cmd/heznode/README.md

Proof Server

The node in mode coordinator requires a proof server (a server capable of calculating proofs from the zkInputs). There is a mock proof server CLI at test/proofserver/cmd for testing purposes.

Usage of test/proofserver/cmd:

USAGE:
    go run ./test/proofserver/cmd OPTIONS

OPTIONS:
  -a string
        listen address (default "localhost:3000")
  -d duration
        proving time duration (default 2s)

Also, the Makefile commands can be used to run and stop the proof server in the background:

$ make run-proof-mock
$ make stop-proof-mock

/tmp as tmpfs

For every processed batch, the node builds a temporary exit tree in a key-value DB stored in /tmp. It is highly recommended that /tmp is mounted as a RAM file system in production to avoid unnecessary reads a writes to disk. This can be done by mounting /tmp as tmpfs; for example, by having this line in /etc/fstab:

tmpfs			/tmp		tmpfs		defaults,noatime,mode=1777	0 0

hermez-node's People

Contributors

ed255 avatar arnaucube avatar arnaubennassar avatar mfcastellani avatar arr552 avatar laisolizq avatar pantani avatar mikelle avatar toniramirezm avatar marioidival avatar jeffprestes avatar stunndard avatar obrezhniev avatar tclemos avatar albertoelias avatar krlosmata avatar pedrovsg avatar eduadiez avatar jbaylina avatar invocamanman avatar jleebee 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.