|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Cleanup nimbus directories if they already exist. |
| 4 | +rm -rf /home/user/data |
| 5 | + |
| 6 | +# Refer: https://nimbus.guide/keys.html |
| 7 | +# Running a nimbus VC involves two steps which need to run in order: |
| 8 | +# 1. Importing the validator keys |
| 9 | +# 2. And then actually running the VC |
| 10 | +tmpkeys="/home/validator_keys/tmpkeys" |
| 11 | +mkdir -p ${tmpkeys} |
| 12 | + |
| 13 | +for f in /home/validator_keys/keystore-*.json; do |
| 14 | + echo "Importing key ${f}" |
| 15 | + |
| 16 | + # Read password from keystore-*.txt into $password variable. |
| 17 | + password=$(<"${f//json/txt}") |
| 18 | + |
| 19 | + # Copy keystore file to tmpkeys/ directory. |
| 20 | + cp "${f}" "${tmpkeys}" |
| 21 | + |
| 22 | + # Import keystore with the password. |
| 23 | + echo "$password" | |
| 24 | + /home/user/nimbus_beacon_node deposits import \ |
| 25 | + --data-dir=/home/user/data \ |
| 26 | + /home/validator_keys/tmpkeys |
| 27 | + |
| 28 | + # Delete tmpkeys/keystore-*.json file that was copied before. |
| 29 | + filename="$(basename ${f})" |
| 30 | + rm "${tmpkeys}/${filename}" |
| 31 | +done |
| 32 | + |
| 33 | +# Delete the tmpkeys/ directory since it's no longer needed. |
| 34 | +rm -r ${tmpkeys} |
| 35 | + |
| 36 | +echo "Imported all keys" |
| 37 | + |
| 38 | +# Now run nimbus VC |
| 39 | +exec /home/user/nimbus_validator_client \ |
| 40 | + --data-dir=/home/user/data \ |
| 41 | + --beacon-node="http://charon:3600" \ |
| 42 | + --doppelganger-detection=false \ |
| 43 | + --metrics \ |
| 44 | + --metrics-address=0.0.0.0 \ |
| 45 | + --payload-builder=true \ |
| 46 | + --distributed |
0 commit comments