Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get package ready for production #49

Merged
merged 1 commit into from
Feb 16, 2024
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @dappnode/package-mantainers
13 changes: 11 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,24 @@ jobs:
name: Build test
if: github.event_name != 'push'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: npx @dappnode/dappnodesdk build --skip_save

e2e-test:
runs-on: gnosis
needs: build-test
if: github.event_name != 'push'
name: End to end tests
steps:
- uses: actions/checkout@v4
- run: npx @dappnode/dappnodesdk@latest github-action test-end-to-end --errorLogsTimeout 120 --healthCheckUrl http://beacon-validator.nimbus-gnosis.dappnode:4500/eth/v1/beacon/genesis --network gnosis --environmentByService="{\"beacon-validator\":{\"CHECKPOINT_SYNC_URL\":\"https://checkpoint.gnosischain.com\"}}"

release:
name: Release
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Publish
run: npx @dappnode/dappnodesdk publish patch --dappnode_team_preset
env:
Expand Down
92 changes: 92 additions & 0 deletions DISCLAIMER.md

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions GETTING_STARTED.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
## Welcome to your eth2 client Nimbus-gnosis:
## Welcome to the Gnosis Chain Consensus Client: Nimbus

- Upload your keystores in the [web3signer-ui](http://ui.web3signer-gnosis.dappnode?signer_url=http://web3signer.web3signer-gnosis.dappnode:9000) (do not have web3singer yet? install it [here](http://my.dappnode/#/installer/web3signer-gnosis.dnp.dappnode.eth))
- Your keystores should now be managed in the Web3Signer's [New Staking Brain](http://brain.web3signer-gnosis.dappnode/)
- All Staking Management has a new home in the Comprehensive [StakersUI](http://my.dappnode/stakers/gnosis)
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# Nimbus DAppNode package (gnosis config)
# Nimbus Gnosis Dappnode package

**Nimbus gnosis ETH2.0 Beacon chain + validator**
**Nimbus ETH2.0 Beacon chain + validator**

Nimbus is a client implementation for both the consensus layer (eth2) and execution layer (eth1) that strives to be as lightweight as possible in terms of resources used. This allows it to perform well on embedded systems, resource-restricted devices -- including Raspberry Pis and mobile devices.
Nimbus is a client implementation for both the consensus layer (eth2) and execution layer (eth1) that strives to be as lightweight as possible in terms of resources used. This allows it to perform well on embedded systems, resource-restricted devices (including Raspberry Pis and mobile devices).

However, resource-restricted hardware is not the only thing Nimbus is good for. Its low resource consumption makes it easy to run Nimbus together with other workloads on your server (this is especially valuable for stakers looking to lower the cost of their server instances).

![avatar](nimbus-avatar.png)

| Updated | Champion/s |
| :----------------: | :-------------: |
| :heavy_check_mark: | @pablomendez_95 |
3 changes: 2 additions & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
ARG UPSTREAM_VERSION

FROM statusim/nimbus-eth2:multiarch-${UPSTREAM_VERSION}
FROM ghcr.io/gnosischain/gnosis-nimbus-eth2:${UPSTREAM_VERSION}

USER root
RUN apt update && apt install curl jq -y

COPY entrypoint.sh /usr/bin/entrypoint.sh
COPY auth-token /home/user/nimbus-eth2/build/data/auth-token
COPY jwtsecret.hex /jwtsecret

ENTRYPOINT [ "entrypoint.sh" ]
66 changes: 29 additions & 37 deletions build/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/bin/bash

CLIENT="nimbus"
NETWORK="gnosis"
VALIDATOR_PORT=3500
WEB3SIGNER_API="http://web3signer.web3signer-${NETWORK}.dappnode:9000"

DATA_DIR="/home/user/nimbus-eth2/build/data"
VALIDATORS_DIR="${DATA_DIR}/validators"
Expand All @@ -12,50 +10,41 @@ TOKEN_FILE="${DATA_DIR}/auth-token"
# Create validators dir
mkdir -p ${VALIDATORS_DIR}

WEB3SIGNER_RESPONSE=$(curl -s -w "%{http_code}" -X GET -H "Content-Type: application/json" -H "Host: beacon-validator.${CLIENT}-${NETWORK}.dappnode" "${WEB3SIGNER_API}/eth/v1/keystores")
HTTP_CODE=${WEB3SIGNER_RESPONSE: -3}
CONTENT=$(echo "${WEB3SIGNER_RESPONSE}" | head -c-4)
if [ "${HTTP_CODE}" == "403" ] && [ "${CONTENT}" == "*Host not authorized*" ]; then
echo "${CLIENT} is not authorized to access the Web3Signer API. Start without pubkeys"
elif [ "$HTTP_CODE" != "200" ]; then
echo "Failed to get keystores from web3signer, HTTP code: ${HTTP_CODE}, content: ${CONTENT}"
else
PUBLIC_KEYS_WEB3SIGNER=($(echo "${CONTENT}" | jq -r 'try .data[].validating_pubkey'))
if [ ${#PUBLIC_KEYS_WEB3SIGNER[@]} -gt 0 ]; then
echo "found validators in web3signer, starting vc with pubkeys: ${PUBLIC_KEYS_WEB3SIGNER[*]}"
for PUBLIC_KEY in "${PUBLIC_KEYS_WEB3SIGNER[@]}"; do
# Docs: https://github.com/status-im/nimbus-eth2/pull/3077#issue-1049195359
# create a keystore file with the following format
# {
# "version": "1",
# "description": "This is simple remote keystore file",
# "type": "web3signer",
# "pubkey": "0x8107ff6a5cfd1993f0dc19a6a9ec7dc742a528dd6f2e3e10189a4a6fc489ae6c7ba9070ea4e2e328f0d20b91cc129733",
# "remote": "http://127.0.0.1:15052",
# "ignore_ssl_verification": true
# }

echo "creating keystore for pubkey: ${PUBLIC_KEY}"
mkdir -p "${VALIDATORS_DIR}"/"${PUBLIC_KEY}"
echo "{\"version\": 1,\"description\":\"This is simple remote keystore file\",\"type\":\"web3signer\",\"pubkey\":\"${PUBLIC_KEY}\",\"remote\":\"${WEB3SIGNER_API}\",\"ignore_ssl_verification\":true}" >/home/user/nimbus-eth2/build/data/validators/${PUBLIC_KEY}/remote_keystore.json
done
fi
fi
case $_DAPPNODE_GLOBAL_EXECUTION_CLIENT_GNOSIS in
"nethermind-xdai.dnp.dappnode.eth")
HTTP_ENGINE="http://nethermind-xdai.dappnode:8551"
;;
"gnosis-erigon.dnp.dappnode.eth")
HTTP_ENGINE="http://gnosis-erigon.dappnode:8551"
;;
*)
echo "Unknown value for _DAPPNODE_GLOBAL_EXECUTION_CLIENT_GNOSIS: $_DAPPNODE_GLOBAL_EXECUTION_CLIENT_GNOSIS"
# TODO: this default value must be temporary and changed once there is more than 1 EC
HTTP_ENGINE="http://nethermind-xdai.dappnode:8551"
;;
esac

# Run checkpoint sync script if provided
[[ -n $CHECKPOINT_SYNC_URL ]] &&
/home/user/nimbus-eth2/build/nimbus_beacon_node trustedNodeSync \
/home/user/nimbus_beacon_node trustedNodeSync \
--network=${NETWORK} \
--trusted-node-url=${CHECKPOINT_SYNC_URL} \
--backfill=false \
--data-dir=//home/user/nimbus-eth2/build/data
[[ -n $WEB3_BACKUP_URL ]] && EXTRA_OPTS="--web3-url=${WEB3_BACKUP_URL} ${EXTRA_OPTS}"

exec -c /home/user/nimbus-eth2/build/nimbus_beacon_node \
#Apply graffiti limit to non-unicode characters
oLang=$LANG oLcAll=$LC_ALL
LANG=C LC_ALL=C
graffitiString=${GRAFFITI:0:32}
LANG=$oLang LC_ALL=$oLcAll

exec -c /home/user/nimbus_beacon_node \
--network=${NETWORK} \
--data-dir=${DATA_DIR} \
--tcp-port=$P2P_TCP_PORT \
--udp-port=$P2P_UDP_PORT \
--validators-dir=${VALIDATORS_DIR} \
--log-level=info \
--log-level=${LOG_TYPE} \
--rest \
--rest-port=4500 \
--rest-address=0.0.0.0 \
Expand All @@ -66,5 +55,8 @@ exec -c /home/user/nimbus-eth2/build/nimbus_beacon_node \
--keymanager-port=${VALIDATOR_PORT} \
--keymanager-address=0.0.0.0 \
--keymanager-token-file=${TOKEN_FILE} \
--graffiti=\"$GRAFFITI\" \
$EXTRA_OPTS
--graffiti="${graffitiString}" \
--jwt-secret=/jwtsecret \
--web3-url=$HTTP_ENGINE \
--suggested-fee-recipient="${FEE_RECIPIENT_ADDRESS}" \
$EXTRA_OPTS
1 change: 1 addition & 0 deletions build/jwtsecret.hex
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ad9cfdec75eceb662f5e48f5765701c17f51a5233a60fbcfa5f9e495fa99d17
29 changes: 18 additions & 11 deletions dappnode_package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"name": "nimbus-gnosis.dnp.dappnode.eth",
"version": "0.1.0",
"upstreamVersion": "v22.6.0",
"upstreamVersion": "v24.1.1",
"upstreamRepo": "status-im/nimbus-eth2",
"upstreamArg": "UPSTREAM_VERSION",
"architectures": ["linux/amd64"],
"shortDescription": "Nimbus gnosis ETH2.0 Beacon chain + validator",
"description": "nimbus-gnosis.public.dappnode.eth description",
"shortDescription": "Nimbus ETH2.0 Beacon chain + validator",
"description": "Nimbus is a client implementation that strives to be as lightweight as possible in terms of resources used. This allows it to perform well on embedded systems, resource-restricted devices -- including Raspberry Pis and mobile devices -- and multi-purpose servers.",
"type": "service",
"author": "DAppNode Association <[email protected]> (https://github.com/dappnode)",
"contributors": [
"pablo <[email protected]> (https://github.com/pablomendezroyo)",
"marce <[email protected]> (https://github.com/mgarciate)"
"marce <[email protected]> (https://github.com/mgarciate)",
"filoozom <[email protected]> (https://github.com/filoozom)"
],
"license": "GPL-3.0",
"repository": {
Expand All @@ -22,21 +23,27 @@
"url": "https://github.com/dappnode/DAppNodePackage-nimbus-gnosis/issues"
},
"requirements": {
"minimumDappnodeVersion": "0.2.51"
"minimumDappnodeVersion": "0.2.60"
},
"categories": ["Blockchain", "ETH2.0"],
"categories": ["Blockchain"],
"links": {
"ui": "http://ui.web3signer-gnosis.dappnode?signer_url=http://web3signer.web3signer-gnosis.dappnode:9000",
"ui": "http://brain.web3signer-gnosis.dappnode",
"homepage": "https://nimbus.team/",
"readme": "https://github.com/dappnode/DAppNodePackage-nimbus-gnosis",
"docs": "https://www.nimbusproject.org/docs"
"docs": "https://nimbus.guide"
},
"chain": {
"driver": "ethereum-beacon-chain",
"serviceName": "beacon-validator",
"portNumber": 4500
},
"dependencies": {
"web3signer-gnosis.dnp.dappnode.eth": "latest"
}
"warnings": {
"onRemove": "Make sure your StakersUI does not have this client selected! Double check in the Stakers Tab in the left NavBar"
},
"globalEnvs": [
{
"envs": ["EXECUTION_CLIENT_GNOSIS"],
"services": ["beacon-validator"]
}
]
}
14 changes: 7 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ services:
build:
context: ./build
args:
UPSTREAM_VERSION: v22.6.0
UPSTREAM_VERSION: v24.1.1
restart: unless-stopped
stop_grace_period: 1m
environment:
LOG_TYPE: INFO
HTTP_WEB3PROVIDER: "http://nethermind-xdai.dappnode:8545"
GRAFFITI: validating_from_DAppNode
WEB3_BACKUP: "https://rpc.gnosischain.com/"
P2P_TCP_PORT: 9106
P2P_UDP_PORT: 9106
CHECKPOINT_SYNC_URL: ""
EXTRA_OPTS: ""
FEE_RECIPIENT_ADDRESS: ""
ports:
- 9000/tcp
- 9000/udp
- "9106:9106/tcp"
- "9106:9106/udp"
volumes:
- "nimbus-gnosis-data:/home/user/nimbus-eth2/build/data"
- "nimbus-data:/home/user/nimbus-eth2/build/data"
image: "beacon-validator.nimbus-gnosis.dnp.dappnode.eth:0.1.0"
volumes:
nimbus-gnosis-data: {}
nimbus-data: {}
Binary file modified nimbus-avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading