Implementation of the Ethereum 2.0 Beacon Chain.
Based on the (evolving) specification.
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:
- Download Gradle
wget https://services.gradle.org/distributions/gradle-5.0-bin.zip -P /tmp
sudo unzip -d /opt/gradle /tmp/gradle-*.zip
- 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
To create a ready to run distribution:
bash <(curl -s https://raw.githubusercontent.com/PegaSysEng/artemis/master/scripts/clone-repo.sh)
cd artemis && ./gradlew distTar installDist
This will produce:
- a fully packaged distribution in
build/distributions
- an expanded distribution, ready to run in
build/install/artemis
To build, clone this repo and run with gradle
like so:
bash <(curl -s https://raw.githubusercontent.com/PegaSysEng/artemis/master/scripts/clone-repo.sh)
cd artemis && ./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]:PegaSysEng/artemis.git
cd artemis && ./gradlew
After a successful build, distribution packages will be available in build/distributions
.
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/artemis |
distDocker | Builds the pegasyseng/artemis docker image |
- 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 artemis 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
An interop script is provided to create a network with Artemis and a number of other clients.
- 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 Artemis
sh interop.sh 16 0 16 10
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
Click here for setup instructions
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.
All the unit tests are run as part of the build, but can be explicitly triggered with:
./gradlew test
To view the run menu:
./gradlew run --args='-h'
artemis [OPTIONS] [COMMAND]
Description:
Run the Artemis 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
Artemis 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 Artemis:
Setup:
source artemis.env
Run:
Terminal 1:
flow
Terminal 2:
./gradlew run -PgenerateFlow