Skip to content
This repository was archived by the owner on May 29, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@ HOST_UID=$(id -u)
HOST_GID=$(id -g)
export HOST_UID HOST_GID

# Used by geth setup in docker-compose
# used by docker-compose to define data paths
export DOCKER_CONFIGS=${PRJ_ROOT}/docker/configs
export DOCKER_LOCAL_DATA=${PRJ_ROOT}/.local/docker/data

# used by geth setup in docker-compose
export GETH_NETWORK_ID=1214
export GETH_ACCOUNT_PASSWORD=!Pa55word

# Used by Avalanche
# AVALANCHEGO_EXEC_PATH - already defined in flake.nix
# export AVALANCHEGO_VERSION=$(avalanchego --version | awk -F' ' '{print $1}' | awk -F '/' '{print $2}')
# AVALANCHE_SUBNET_EVM_PATH - already defined in flake.nix
# export AVALANCHE_SUBNET_EVM_VERSION=$(subnet-cli --version | awk -F' ' '{print $3}')
# export AVALANCHE_CLI_DIR="$HOME/.avalanche-cli" # do NOT change this directory as avalanche-cli as this path is harcoded
# erigon
export ERIGON_DATA=${DOCKER_LOCAL_DATA}/erigon

# prysm
export PRYSM_CHECKPOINT=${DOCKER_CONFIGS}/prysm/checkpoints
export PRYSM_DATA=${DOCKER_LOCAL_DATA}/prysm

# allow local .envrc overrides
[[ -f .envrc.local ]] && source_env .envrc.local

# ensure local data directories exist
mkdir -p ${PRYSM_DATA}
mkdir -p ${ERIGON_DATA}
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,9 @@ node_modules/
##############################
## Binaries
##############################
/out
/out

##############################
## Docker
##############################
/.local/
13 changes: 11 additions & 2 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,14 @@ nix-check:

# Cleans all outputs
clean:
rm -rf result*
alias c := clean
rm -rf ./result*
alias c := clean

# Alias docker-compose up
up:
mkdir -p $PRYSM_DATA $ERIGON_DATA
docker-compose up -d

# Alias for docker-compose down
down:
docker-compose down --remove-orphans -v
15 changes: 7 additions & 8 deletions docker-compose.yml → docker-compose.eth1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ networks:

services:
nats:
image: nats:2.8.3-alpine
container_name: nats
volumes:
- ./docker/nats/:/etc/nats:ro
build:
context: docker/images/nats
ports:
- "4222:4222" # client connections
- "6222:6222" # routing port for clustering
Expand All @@ -24,7 +23,7 @@ services:
geth-bootnode:
container_name: geth-bootnode
build:
context: docker/geth
context: docker/images/geth
args:
- ACCOUNT_PASSWORD=${GETH_ACCOUNT_PASSWORD}
command:
Expand All @@ -39,7 +38,7 @@ services:
geth-miner:
container_name: geth-miner
build:
context: docker/geth
context: docker/images/geth
depends_on:
- geth-bootnode
command:
Expand All @@ -54,7 +53,7 @@ services:
geth-rpc-1:
container_name: geth-rpc-1
build:
context: docker/geth
context: docker/images/geth
depends_on:
- geth-bootnode
command:
Expand Down Expand Up @@ -95,7 +94,7 @@ services:
geth-rpc-2:
container_name: geth-rpc-2
build:
context: docker/geth
context: docker/images/geth
depends_on:
- geth-bootnode
command:
Expand Down Expand Up @@ -133,7 +132,7 @@ services:
geth-rpc-3:
container_name: geth-rpc-3
build:
context: docker/geth
context: docker/images/geth
depends_on:
- geth-bootnode
command:
Expand Down
116 changes: 116 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
version: "3.8"

configs:
genesis.ssz:
file: ${PRYSM_CHECKPOINT}/genesis.ssz

networks:
tethys:
name: tethys
driver: bridge
ipam:
config:
- subnet: 172.16.254.0/28

services:
prysm:
image: gcr.io/prysmaticlabs/prysm/beacon-chain:v3.0.0
restart: unless-stopped
user: "${HOST_UID}:${HOST_GID}"
command: --datadir=/data/sepolia
--rpc-host=0.0.0.0
--monitoring-host=0.0.0.0
--execution-endpoint=http://erigon:8551
--sepolia
--jwt-secret=/erigon-data/sepolia/jwt.hex
--accept-terms-of-use
--genesis-state=/genesis.ssz
--grpc-gateway-host="0.0.0.0"
--grpc-gateway-corsdomain='*'
--checkpoint-sync-url=https://sepolia.checkpoint-sync.ethdevops.io
--genesis-beacon-api-url=https://sepolia.checkpoint-sync.ethdevops.io
networks:
- tethys
ports:
- "3500:3500"
- "13000:13000"
- "12000:12000/udp"
volumes:
- type: bind
source: "${ERIGON_DATA}"
target: /erigon-data
- type: bind
source: "${PRYSM_DATA}"
target: /data
depends_on:
- "erigon"
mem_swappiness: 0
configs:
- genesis.ssz

erigon:
image: otterscan/erigon:v2022.08.03-otterscan
restart: unless-stopped
user: "${HOST_UID}:${HOST_GID}"
command: erigon
--chain=sepolia
--datadir=/erigon-data/sepolia
--torrent.download.slots=7
--http.api="eth,web3,net,erigon,ots"
--ws
--http.corsdomain="*"
--http.addr="0.0.0.0"
--http.vhosts='*'
--authrpc.addr="erigon"
--authrpc.vhosts="erigon"
networks:
- tethys
ports:
- "8545:8545"
- "30303:30303/tcp"
- "30303:30303/udp"
- "42069:42069/tcp"
- "42069:42069/udp"
volumes:
- type: bind
source: "${ERIGON_DATA}"
target: /erigon-data
mem_swappiness: 0

otterscan:
image: otterscan/otterscan:v2022.04.01-otterscan
restart: unless-stopped
networks:
- tethys
ports:
- "3000:80"
depends_on:
- "prysm"
- "erigon"

nats:
build:
context: docker/images/nats
ports:
- "4222:4222" # client connections
- "6222:6222" # routing port for clustering
- "8222:8222" # http management port for information reporting
networks:
- tethys

proxy:
image: 41north/tethys-proxy:dev
restart: unless-stopped
depends_on:
- nats
networks:
- tethys
ports:
- "8080:8080"
command:
- eth
- --log-level=debug
environment:
NATS_URL: ns://nats:4222
ETH_NETWORK_ID: 11155111 # sepolia
ETH_CHAIN_ID: 11155111
Binary file added docker/configs/prysm/checkpoints/genesis.ssz
Binary file not shown.
2 changes: 1 addition & 1 deletion docker/geth/Dockerfile → docker/images/geth/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ethereum/client-go:v1.10.11
FROM ethereum/client-go:v1.10.23

ARG ACCOUNT_PASSWORD

Expand Down
3 changes: 3 additions & 0 deletions docker/images/nats/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM nats:2.8.4-alpine

COPY nats-server.conf /etc/nats/nats-server.conf
52 changes: 52 additions & 0 deletions nix/pkgs/prysm/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
lib,
buildGoModule,
fetchFromGitHub,
}:
buildGoModule rec {
pname = "prysm";
version = "3.0.0";

src = fetchFromGitHub {
owner = "prysmaticlabs";
repo = pname;
rev = "v${version}";
sha256 = "sha256-Rjg+dHd6MxHy+ZQcPIx18VCzIvxqP3crvU9nF6DG8rs=";
};

vendorSha256 = "sha256-aaWCj3bucb81P3GjspOiFgUOoL2bygy2lmwmnG/W2a8=";

doCheck = false;

ldflags = [
"-s"
"-w"
"-X github.com/ava-labs/avalanchego/version.GitCommit=${src.rev}"
];

postInstall = ''
# Build directory should have this structure:
# See: https://github.com/ava-labs/avalanchego/blob/acd07505cd701dbd3832ca7aa301865fc0737839/config/config.go#L84
#
# build
# ├── avalanchego (the binary from compiling the app directory)
# └── plugins
# └── evm
mkdir -p $out/build/plugins

# Store bin inside build/ folder
mv $out/bin/main $out/build/${pname}

# For now, we symlink, but the idea is to give support to different plugins
ln -s $out/build/${pname} $out/bin/${pname}
'';

subPackages = ["main/main.go"];

meta = with lib; {
homepage = "https://www.avax.network/";
description = "Go implementation of an Avalanche node";
license = licenses.bsd3;
maintainers = with maintainers; [aldoborrero];
};
}