Java implementation of Beacon Chain for Ethereum 2.0, and its Backend API and full Infrastructure.

Related tags

Spring Boot hailong
Overview

hailong

Build Status License Gitter chat

Implementation of the Ethereum 2.0 Beacon Chain.

Based on the (evolving) specification.

Build Instructions

Install Prerequisites

1) Java 11

Ubuntu: sudo apt install openjdk-11-jdk

MacOS: brew tap AdoptOpenJDK/openjdk && brew cask install adoptopenjdk11

Other systems: [https://adoptopenjdk.net/] is very helpful.

2) Gradle

Ubuntu:

  1. Download Gradle
wget https://services.gradle.org/distributions/gradle-5.0-bin.zip -P /tmp
sudo unzip -d /opt/gradle /tmp/gradle-*.zip
  1. Setup environment variables

Create gradle.sh in /etc/profile.d/

export GRADLE_HOME=/opt/gradle/gradle-5.0
export PATH=${GRADLE_HOME}/bin:${PATH}

Make gradle.sh executable and source the script

sudo chmod +x /etc/profile.d/gradle.sh
source /etc/profile.d/gradle.sh

OSX: brew install gradle

Build and Dist

To create a ready to run distribution:

bash <(curl -s https://raw.githubusercontent.com/DevelGao/hailong/master/scripts/clone-repo.sh)
cd hailong && ./gradlew distTar installDist

This will produce:

  • a fully packaged distribution in build/distributions
  • an expanded distribution, ready to run in build/install/hailong

Build and Test

To build, clone this repo and run with gradle like so:

bash <(curl -s https://raw.githubusercontent.com/DevelGao/hailong/master/scripts/clone-repo.sh)
cd hailong && ./gradlew

Or clone it manually:

git clone [email protected]:jrhea/eth2.0-spec-tests-template.git /tmp/eth2.0-spec-tests-template
git clone --recursive --template=/tmp/eth2.0-spec-tests-template [email protected]:DevelGao/hailong.git
cd hailong && ./gradlew

After a successful build, distribution packages will be available in build/distributions.

Other Useful Gradle Targets

Target Description
distTar Builds a full distribution in build/distributions (as .tar.gz)
distZip Builds a full distribution in build/distributions (as .zip)
installDist Builds an expanded distribution in build/install/hailong
distDocker Builds the develgao/hailong docker image

Run Multiple Hailong nodes

Prereqs:

  • tmux

After building with ./gradlew distTar, the simplest way to run is by using this command:

cd scripts && sh run.sh -n=[NUMBER OF NODES]

Help is available for this script as well:

sh run.sh -h
Runs a simulation of hailong with NODES nodes, where NODES > 0 and NODES < 256
Usage: sh run.sh [--numNodes, -n=NODES]  [--config=/path/to/your-config.toml] [--logging, -l=OFF|FATAL|WARN|INFO|DEBUG|TRACE|ALL]
                 [--help, -h]
- If config files are specifed for specific nodes, those input files will be used to
configure their respective nodes.
- If no logging option is specified, then INFO is the default

Run in Interop Mode

An interop script is provided to create a network with Hailong and a number of other clients.

Prereqs:

  • tmux
  • zcli
  • You will need to have at least one other client built on your machine for this to work

The simplest way to run in interop mode is by using this command:

cd scripts
sh interop.sh [validator_count] [owned_validator_start_index] [owned_validator_count] [start_delay]

Help is available for this script as well:

sh interop.sh 
Runs a multiclient testnet
Usage: sh interop.sh [validator_count] [owned_validator_start_index] [owned_validator_count] [start_delay]
Example: Run multiple clients in interop mode using static peering. 16 validators and all are assigned to Hailong
         sh interop.sh 16 0 16 10

Manual configuration

To configure it manually, set these options in the config.toml:

[interop]
genesisTime = 5778872 #seconds since 1970-01-01 00:00:00 UTC
ownedValidatorStartIndex = 0
ownedValidatorCount = 8
startState = "/tmp/genesis.ssz"
privateKey = 0x00 #libp2p private key associated with this node's peerID

[deposit]

numValidators = 16

Deposit Simulation

Click here for setup instructions

Code Style

We use Google's Java coding conventions for the project. To reformat code, run:

./gradlew spotlessApply

Code style will be checked automatically during a build.

Testing

All the unit tests are run as part of the build, but can be explicitly triggered with:

./gradlew test

Run Options

To view the run menu:

./gradlew run --args='-h'

hailong [OPTIONS] [COMMAND]

Description:

Run the Hailong beacon chain client and validator

Options:
  -c, --config=<FILENAME>   Path/filename of the config file
  -h, --help                Show this help message and exit.
  -l, --logging=<LOG VERBOSITY LEVEL>
                            Logging verbosity levels: OFF, FATAL, WARN, INFO,
                              DEBUG, TRACE, ALL (default: INFO).
  -V, --version             Print version information and exit.
Commands:
  transition  Manually run state transitions
  peer        Commands for LibP2P PeerID

Hailong is licensed under the Apache License 2.0

You can run the executable from the CLI with this command:

./gradlew run

Refer to config/config.toml for a set of default configuration settings.

To run with logging level set to DEBUG

./gradlew run --args='-l=DEBUG'

To profile and/or generate flow diagrams for Hailong:

Setup:

source hailong.env 

Run:

Terminal 1:

flow

Terminal 2:

./gradlew run -PgenerateFlow

Special thanks

YourKit for providing us with a free profiler open source license.

YourKit supports open source projects with innovative and intelligent tools for monitoring and profiling Java and .NET applications. YourKit is the creator of YourKit Java Profiler, YourKit .NET Profiler, and YourKit YouMonitor.

YourKit Logo

You might also like...

Hate, hate, hate, for Google and its crashtastic Pixel 6 Pro.

OpenCamera hack for Pixel 6 Pro The Pixel 6 Pro is an expensive phone. There seem to be a significant number of people whose P6Ps crash -- hard -- try

Nov 11, 2022

This is a Meme repo for fixed & Cleaned source of 'Better'Bungeecord but its not realy better code is trash!

#Fucking cleaned by CryCodes Disclaimer: Based of MD_5's Bungeecord (Fork of "BetterBungee") | I am not the owner of the code This repo is just for fu

Jan 2, 2022

Desafio Alura Challenge para backend. Criando uma API REST de controle de orçamento utilizando JAVA.

Desafio Alura Challenge para backend. Criando uma API REST de controle de orçamento utilizando JAVA.

Jun 16, 2022

JSON Web Token implementation for Java according to RFC 7519. Easily create, parse and validate JSON Web Tokens using a fluent API.

JWT-Java JSON Web Token library for Java according to RFC 7519. Table of Contents What are JSON Web Tokens? Header Payload Signature Features Supporte

Jul 10, 2022

This project contains a full example of an application developed using Spring Boot and GraphQL within the Java.

Spring boot GraphQL Example This project contains a full example of an application developed using GraphQL within the Java. The project includes a com

Jul 20, 2022

Desafio numero 015 correspondiente al finalización del curso 01 de la carrera Java Full Stack de la academia Desafío LATAM

DesafioFinalProgramacionBasicaJava Desafio numero 015 correspondiente al finalización del curso 01 de la carrera Java Full Stack de la academia Desafí

Feb 17, 2022

Team 2539's Java training, consisting of a series of projects that combine into a full robot code base.

Java Training Part 1 - Learning Java (Skip this part if you have taken AP Comp Sci) For learning Java, we currently recommend using codecademy, but mo

Aug 24, 2022

A simple live streaming mobile app with cool functionalities and time extension, and live chat. With a payment system integrated. Server is designed with socket.io to give you full flexibility.

A simple live streaming mobile app with cool functionalities and time extension, and live chat. With a payment system integrated. Server is designed with socket.io to give you full flexibility.

Video Live Streaming Platform Android A simple live streaming mobile app with cool functionalities and time extension, and live chat. With a payment s

Dec 16, 2022

Full Stack Employee Management Application Using ReactJS and Spring Boot

Full Stack Employee Management Application Using ReactJS and Spring Boot Tech We Used ReactJs Spring Boot MySql Database Spring Security REST API Feat

Nov 18, 2022
Owner
我是高天才!
我是高天才!
Mint 0.1.1 public release, HWID System removed. Feel free to use. (Note: for all of u thinking its ratted; its not.)

Mint By: zPrestige_ | ! zPrestige_#1514 | git Kambing | dragonhacker32_#3091 | git FB | FB#7334 | git ZenovJB | Zenov#0603 | git Support no support No

null 17 Dec 2, 2022
jedibot is an application that aims to do beneficial actions on the Ethereum blockchain for the DeFi ecosystem while earning a profit for the user.

jedibot is an application that aims to do beneficial actions on the Ethereum blockchain for the DeFi ecosystem while earning a profit for the user. These actions include maintaining the DAI peg, providing liquidity and liquidating undercollateralized assets.

我是高天才! 10 Feb 5, 2022
Object-Oriented and Immutable Java Chain of XSL Transformations

It's a chain of XSL transformations in Java. You add this to your pom.xml: <dependency> <groupId>com.yegor256</groupId> <artifactId>xsline</artifa

Yegor Bugayenko 12 Dec 15, 2022
A spring cloud infrastructure provides various of commonly used cloud components and auto-configurations for high project consistency

A spring cloud infrastructure provides various of commonly used cloud components and auto-configurations for high project consistency.

Project-Hephaestus 2 Feb 8, 2022
Search API with spelling correction using ngram-index algorithm: implementation using Java Spring-boot and MySQL ngram full text search index

Search API to handle Spelling-Corrections Based on N-gram index algorithm: using MySQL Ngram Full-Text Parser Sample Screen-Recording Screen.Recording

Hardik Singh Behl 5 Dec 4, 2021
In this course, we will learn how to build a complete full-stack web application using Spring boot as backend and React (React Hooks) as frontend

In this course, we will learn how to build a complete full-stack web application using Spring boot as backend and React (React Hooks) as frontend. We will use MySQL database to store and retrieve the data.

Ramesh Fadatare 43 Dec 22, 2022
There are two challenges one is to create a backend api the other is to create a frontend application to consume the public data api devall.

Sobre | Desafio | Resolução | Tecnologias | Execução | Itexto desafio tecnico Sobre os Desafios existem dois desafios um é criar uma api backend o out

fabricio S Miranda 1 Oct 18, 2021
A Graphics2D implementation targeting Skija as a backend.

SkijaGraphics2D Version 1.0.2, 4 August 2021 Overview SkijaGraphics2D is an implementation of Java2D's Graphics2D API that targets Skia via the Skija

David Gilbert 46 Dec 29, 2022
code to the rat i give to people if u want to change the webhook its in "src/main/java/github/quantizr/autogg/guis/gui" please just dont sell my rat :(

SkyblockRat My rats code join my discord! https://discord.gg/bbK6ndHqN6 i got tired of people asking "is it double hooked?!" so here is my rats code y

null 6 Dec 10, 2022
SecureDB is an extension for Ai2 Appinventor and its distros which stores the data in the form of key and value just like TinyDB but in a more secure manner.

SecureDB SecureDB is an extension for Ai2 Appinventor and its distros which stores data for your app in a secure format locally on user's device. Expl

Akshat Developer 3 Sep 24, 2022