-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdirk.yml
197 lines (193 loc) · 6.82 KB
/
dirk.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
x-logging: &logging
logging:
driver: "json-file"
options:
max-file: "3"
max-size: "100m"
services:
dirk:
image: attestant/dirk:${DIRK_DOCKER_TAG}
hostname: dirk-${MEV_HOST}
restart: unless-stopped
command: ["--base-dir=/config"]
ports:
- 13141:13141/tcp
volumes:
- ./config/dirk${DIRK_INSTANCE}.yml:/config/dirk.yml:ro
- ./config/certs:/config/certs:ro
- ./config/passphrases:/config/passphrases:ro
- dirk-data:/data
<<: *logging
create-wallet:
profiles: ["tools"]
image: wealdtech/ethdo:${ETHDO_DOCKER_TAG}
volumes:
- dirk-data:/data
command:
- --base-dir=/data/wallets
- wallet
- create
- --type=distributed
- --wallet=${WALLET_NAME}
create-accounts:
profiles: ["tools"]
image: wealdtech/ethdo:${ETHDO_DOCKER_TAG}
volumes:
- ./config/certs:/config/certs:ro
entrypoint: ["/bin/bash","-c"]
command:
- |
set -e
for (( i=${STARTACCOUNT}; i<=${ENDACCOUNT}; i++ )); do
/app/ethdo account create \
--remote=${DIRK1}.${DOMAIN}:13141 \
--server-ca-cert /config/certs/dirk_authority.crt \
--client-cert /config/certs/vouch${VOUCH_INSTANCE}.crt \
--client-key /config/certs/vouch${VOUCH_INSTANCE}.key \
--account=${WALLET_NAME}/val-$$i \
--signing-threshold=3 \
--participants=5
echo Created validator account $$i
done
create-depositdata:
profiles: ["tools"]
image: wealdtech/ethdo:${ETHDO_DOCKER_TAG}
volumes:
- ./config/certs:/config/certs:ro
- ./config/depositdata:/config/depositdata:rw
entrypoint: ["/bin/bash","-c"]
command:
- |
set -e
for (( i=${STARTACCOUNT}; i<=${ENDACCOUNT}; i++ )); do
/app/ethdo validator depositdata \
--depositvalue 32Ether \
--remote=${DIRK1}.${DOMAIN}:13141 \
--server-ca-cert /config/certs/dirk_authority.crt \
--client-cert /config/certs/vouch${VOUCH_INSTANCE}.crt \
--client-key /config/certs/vouch${VOUCH_INSTANCE}.key \
--validatoraccount ${WALLET_NAME}/val-$$i \
--launchpad \
--forkversion ${FORK_VERSION} \
--withdrawaladdress ${WITHDRAWAL_ADDRESS} > /config/depositdata/deposit-val-$$i.json
echo Created depositdata for validator $$i
done
verify-account:
profiles: ["tools"]
image: wealdtech/ethdo:${ETHDO_DOCKER_TAG}
volumes:
- ./config/certs:/config/certs:ro
entrypoint: ["/bin/bash","-c"]
command:
- |
set -e
account=${WALLET_NAME}/val-1
echo Verifying one account across five instances
echo All five should show 3/5 threshold for val-1, and matching
echo public key and participants. The withdrawal credentials
echo can be ignored.
echo
for host in ${DIRK1}.${DOMAIN} ${DIRK2}.${DOMAIN} ${DIRK3}.${DOMAIN} ${DIRK4}.${DOMAIN} ${DIRK5}.${DOMAIN}; do
/app/ethdo account info \
--remote=$$host:13141 \
--server-ca-cert /config/certs/dirk_authority.crt \
--client-cert /config/certs/vouch${VOUCH_INSTANCE}.crt \
--client-key /config/certs/vouch${VOUCH_INSTANCE}.key \
--account=$$account \
--verbose
echo
done
list-accounts:
profiles: ["tools"]
image: wealdtech/ethdo:${ETHDO_DOCKER_TAG}
volumes:
- ./config/certs:/config/certs:ro
entrypoint: ["/bin/bash","-c"]
command:
- |
/app/ethdo wallet accounts \
--wallet=${WALLET_NAME} \
--remote=${DIRK1}.${DOMAIN}:13141 \
--server-ca-cert /config/certs/dirk_authority.crt \
--client-cert /config/certs/vouch${VOUCH_INSTANCE}.crt \
--client-key /config/certs/vouch${VOUCH_INSTANCE}.key \
--verbose
sign-exits:
profiles: ["tools"]
image: wealdtech/ethdo:${ETHDO_DOCKER_TAG}
volumes:
- ./config/certs:/config/certs:ro
- ./config/exitmessages:/config/exitmessages:rw
entrypoint: ["/bin/bash","-c"]
command:
- |
apt-get update && apt-get install -y jq
__fail=0
__success=0
for (( i=${STARTACCOUNT}; i<=${ENDACCOUNT}; i++ )); do
/app/ethdo validator exit \
--json \
--remote=${DIRK1}.${DOMAIN}:13141 \
--server-ca-cert /config/certs/dirk_authority.crt \
--client-cert /config/certs/vouch${VOUCH_INSTANCE}.crt \
--client-key /config/certs/vouch${VOUCH_INSTANCE}.key \
--account=${WALLET_NAME}/val-$$i \
--connection=${CL1} >/config/exitmessages/exit-operation.json
__code=$?
if [[ $$__code -eq 0 ]]; then
echo Signed exit for validator account $$i
__index=$(jq -r .message.validator_index </config/exitmessages/exit-operation.json)
mv /config/exitmessages/exit-operation.json /config/exitmessages/$$__index-exit.json
(( __success+=1 ))
else
echo Could not sign exit for validator account $$i
(( __fail+=1 ))
fi
done
echo Successfully signed $$__success exits and failed on $$__fail
echo
echo Please run \"docker-compose run --rm encrypt-exits\" next.
echo They\'ll be in ./config/exits afterwards, encrypted with the password in .env
echo Please remember to delete the unencrypted files in ./config/exitmessages
encrypt-exits:
profiles: ["tools"]
image: lidofinance/validator-ejector:${EJECTOR_DOCKER_TAG}
volumes:
- ./config/exitmessages:/app/encryptor/input/:ro
- ./config/exits:/app/encryptor/output/:rw
environment:
- MESSAGES_PASSWORD=${EXIT_PASSPHRASE}
user: root
command: [ "node", "/app/dist/encryptor/encrypt.js"]
export-keys:
profiles: ["tools"]
image: wealdtech/ethdo:${ETHDO_DOCKER_TAG}
volumes:
- ./config/certs:/config/certs:ro
- ./keys:/app/keys
- dirk-data:/data
entrypoint: ["/bin/bash","-c"]
command:
- |
set -e
while true; do
read -srp "What is the passphrase to encrypt the backup? : " __passphrase
echo
read -srp "Please verify the passphrase : " __passphrase2
if [[ $${__passphrase} = $${__passphrase2} ]]; then
break
else
echo "Passphrase did not match. You can try again or hit Enter twice to abort."
fi
done
echo Backing up local wallet. Please make sure to run this on all five Dirks!
echo Backup can be found in ./keys/dirk${DIRK_INSTANCE}-export.dat
echo
/app/ethdo wallet export \
--base-dir=/data/wallets \
--wallet=${WALLET_NAME} \
--passphrase=$${__passphrase} \
> /app/keys/dirk${DIRK_INSTANCE}-export.dat
echo
volumes:
dirk-data: