Skip to content
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
23 changes: 11 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7
# Set up Docker Buildx for multi-arch support
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Build multi-arch image
uses: docker/setup-buildx-action@v4
# Build multi-arch image
- name: Build Docker image (multi-arch)
run: |
docker buildx create --use
docker buildx build --platform linux/amd64,linux/arm64 .
# Docker development
- name: Docker development
Expand All @@ -29,25 +28,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Enable Corepack
run: corepack enable
uses: actions/checkout@v7

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v7
with:
node-version: 20
node-version: 24

- name: Enable Corepack
run: corepack enable

- name: Install dependencies
run: yarn install
run: yarn install --immutable

# Lint and format and prettier
- name: Lint
run: yarn lint

- name: Prettier
run: yarn format
run: yarn format:check

# Build
- name: Build
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,27 @@ on:
jobs:
push-to-ghcr:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Login to GHCR
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

# Set up Docker Buildx for multi-arch support
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v4

# Build and push multi-arch Docker image
- name: Build and push Staking brain docker monorepo
uses: docker/build-push-action@v3
uses: docker/build-push-action@v7
with:
file: Dockerfile
push: true
Expand All @@ -37,17 +40,14 @@ jobs:
gh-release:
runs-on: ubuntu-latest
needs: push-to-ghcr
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v7

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.tag }}
release_name: Release v${{ github.event.inputs.tag }}
draft: false
prerelease: true
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ inputs.tag }}
run: gh release create "$RELEASE_TAG" --title "Release v$RELEASE_TAG" --prerelease --generate-notes
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ packages/brain/uiBuild

# Brain db
packages/brain/brain-db.json
packages/brain/builder-config-imported

# Keystores
packages/brain/keystores
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"jsxSingleQuote": false,
"trailingComma": "none",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"bracketSameLine": false,
"arrowParens": "always",
"endOfLine": "auto"
}
12 changes: 5 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
ARG DOCKER_IMAGE=node:20.17.0-alpine3.20
ARG DOCKER_IMAGE=node:24.21.0-alpine

# Build
FROM --platform=$TARGETPLATFORM ${DOCKER_IMAGE} AS build-stage
FROM ${DOCKER_IMAGE} AS build-stage

WORKDIR /app
COPY package.json yarn.lock tsconfig.json .yarnrc.yml ./
COPY packages packages

# Required to build with vite
RUN apk update && apk add --no-cache python3 py3-pip build-base
# Enable corepack to use modern package manager
RUN corepack enable

# Build but keep only production dependencies
RUN yarn install --immutable && \
yarn build && \
yarn clean:libraries && \
yarn workspaces focus --all --production
yarn workspaces focus @stakingbrain/brain --production

# Production
FROM --platform=$TARGETPLATFORM ${DOCKER_IMAGE}
FROM ${DOCKER_IMAGE}
ENV NODE_ENV=production
WORKDIR /app
COPY ./packages/brain/tls ./tls
Expand All @@ -36,4 +34,4 @@ COPY --from=build-stage /app/packages/ui/build ./uiBuild
COPY --from=build-stage /app/packages/brain/dist /app/packages/brain/dist
COPY --from=build-stage /app/packages/brain/package.json /app/packages/brain/package.json

CMD [ "node", "packages/brain/dist/index" ]
CMD [ "node", "packages/brain/dist/index.js" ]
8 changes: 4 additions & 4 deletions Dockerfile.brain.dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG DOCKER_IMAGE=node:20.17.0-alpine3.20
FROM --platform=$TARGETPLATFORM ${DOCKER_IMAGE} as build-stage
ARG DOCKER_IMAGE=node:24.21.0-alpine
FROM ${DOCKER_IMAGE} AS build-stage

ENV NODE_ENV=development
WORKDIR /app
Expand All @@ -13,6 +13,6 @@ RUN apk add --no-cache --virtual .build-deps \
curl \
&& rm -rf /var/cache/apk/*

RUN corepack enable && yarn set version berry
RUN corepack enable

ENTRYPOINT ["/bin/bash", "-c", "yarn && yarn build && yarn run dev"]
ENTRYPOINT ["/bin/bash", "-c", "yarn && yarn build && yarn run dev"]
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

Staking Brain is a critical logical component for Staking in DAppNode. It provides a user interface and a Launchpad API that allow manual and automatic keystore management. Designed to support not only solo stakers, but also DVT/LSD technologies, Staking Brain streamlines the staking process for all users.

Within the Dappnode environment, Staking Brain is incorporated into the Web3Signer packages (gnosis, mainnet, prater, lukso, holesky, hoodi). It ensures that user configurations for validators are reliably maintained. Please note that Staking Brain does not store keystores itself, but ensures their storage in the web3signer. It also maintains consistency between the validator service and web3signer service, as the validator must recognize all the pubkeys of validators whose keystores have been imported into the signer.
Within the Dappnode environment, Staking Brain is incorporated into the Web3Signer packages (gnosis, mainnet, lukso, hoodi). It ensures that user configurations for validators are reliably maintained. Please note that Staking Brain does not store keystores itself, but ensures their storage in the web3signer. It also maintains consistency between the validator service and web3signer service, as the validator must recognize all the pubkeys of validators whose keystores have been imported into the signer.

Supported `NETWORK` values are `mainnet`, `gnosis`, `lukso`, and `hoodi`. Retired testnets are rejected at startup. Update the network and corresponding client environment variables when moving an older deployment to a supported network; network names are not automatically remapped.

Each Web3Signer package includes four services:

Expand All @@ -26,7 +28,9 @@ The new functionalities that the StakingBrain brings are:

Follow these steps to develop with Staking Brain:

1. Connect to your DAppNode (which should be running an instance of web3signer and validator in a network, e.g., Prater).
Use Node.js 24 LTS (at least 24.11) and Yarn 4.18.1, pinned in `package.json`. Enable Corepack with `corepack enable`.

1. Connect to your DAppNode (which should be running an instance of web3signer and validator in a network, e.g., Hoodi).

2. Clone the repository:

Expand All @@ -37,9 +41,9 @@ git clone https://github.com/dappnode/StakingBrain
3. Set your current DAppNode staker config in `packages/brain/.env` :

```
NETWORK="prater"
_DAPPNODE_GLOBAL_EXECUTION_CLIENT_PRATER="goerli-erigon.dnp.dappnode.eth"
_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_PRATER="prysm-prater.dnp.dappnode.eth"
NETWORK="hoodi"
_DAPPNODE_GLOBAL_EXECUTION_CLIENT_HOODI="hoodi-geth.dnp.dappnode.eth"
_DAPPNODE_GLOBAL_CONSENSUS_CLIENT_HOODI="lighthouse-hoodi.dnp.dappnode.eth"
```

### A) Local development
Expand All @@ -52,10 +56,10 @@ yarn build
yarn dev
```

5.Access the KeyManager UI (e.g. Prater)
5.Access the KeyManager UI (e.g. Hoodi)

```
http://localhost/?network=prater&signerUrl=http://web3signer.web3signer-prater.dappnode:9000/
http://localhost:3000/
```

### B) Docker development
Expand All @@ -76,15 +80,15 @@ docker logs -f brain (To watch status)
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' brain
```

6. Access the KeyManager UI (e.g. Prater)
6. Access the KeyManager UI (e.g. Hoodi)

```
http://<obtainedIP>
```

### Development Recommendations

1. Connect to your DAppNode using SSH and stop the brain container of your Prater web3signer:
1. Connect to your DAppNode using SSH and stop the brain container of your Hoodi web3signer:

```
docker ps | grep brain
Expand Down
1 change: 0 additions & 1 deletion docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.9"
services:
brain:
build:
Expand Down
Loading
Loading