This repository has been archived by the owner on Sep 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
import-keybase-usernames.sh
executable file
·143 lines (129 loc) · 4.9 KB
/
import-keybase-usernames.sh
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
#!/usr/bin/env bash
set -e
# Number of lamports to allocate to each validator (500 SOL)
lamports=500000000000
cd "$(dirname "$0")"
# https://github.com/solana-labs/solana/blob/5af7d12756bf59229a9a887e3aab858c76bd9bb9/genesis/src/genesis_accounts.rs#L201-L262
slp_pubkeys="
27SB7d27xvtBJjgsAV8JBDjQroySmZepiNSepeRbRhe9
2te46rxywMdCNdkvjumiBBPQoVczJFxhxEaxFavQNqe3
2tvTYUajoBgeAd66Zhd5Nc2BgKGCgdmasR94fpBokzop
3QZDKya4AHzsLAuRaMRgejrqW6mETnX88aMSkm7FEE7E
3Z5XVczCTXeYeFABoeFm1LngC9657kZMVGNFzqFXviHb
3o43fXxTpndqVsCdMi16WNq6aR9er75P364ZkTHrEQJN
44e8VyWoyZSE2oYHxMHMedAiHkGJqJgPd3tdt6iKoAFL
4MHRFcPheQonBf1pUKrBwJAnn2wP9NEZkXYFEFMfFbWV
4vPqTnfH2ud6hp1yFSFRy9t9xhm8sGDwU4amcZGr2gT7
4ydifDThiWuVtzV92eNGiznuQAnTZtGkb9b2XQoMGAUn
54g6LdVubwthdfMKwPqLraDEDAVWNDpN6a3ZGZm2Sbjz
5JuyDi5HR2CZS39nF43Ws6nhqYW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Urqja3EFjkR4PXNYCuyVtaQnozonCdf3iZk8X
ETVHRnFkZi7PihPDYibp9fmjfR8P5o7pEs92czku62VV
EduAgutprA7Vp94ZmTU6WRAmqq7VZAXBqH1GyxjWn12D
Ez4iUU87ViJLCnmSy1t1Ti3DLoysFXiBseNfnRfoehyY
FYbyeGqsx8G5mW4p3MfnNEsHaCQQSAmxESf7ct36moGZ
Fe5sLQAAT7RBT8mcH1AAGCbExJQcYxcwXvp1GjrGbvxs
FhacRVSACfKcZNAbvbKuj1MunBKxQu2nHu9raJaGsZzG
FiF184p8DYxnWkBc7WxUh49PccYwvVepmk3nxAnNgGqW
G47WACh32JUcxyiCna7UYw45tyYSFKQ58yFpUmhmMybm
GRi3H2M3HxYGAKhz5VrUQipUrAhWj6jTbtjhxiKXHhRj
GeZ5PrJi9muVCJiJAaFBNGoCEdxGEqTp7L2BmT2WTTy1
GsEofbB3rzUK78Ee4NRL6AmcPs6FKRCb7JA8tX6LZjHc
H279DmgqTkTYnEucPdKbvT8wMTGBAuVh787FX2gRT5Bg
Hac7hGYwbve747fGefaFoank1K1rNmvr5MjtsYvzZ37i
HavuVVDXXsJqMzPwQ4KcF5kFm2xqjbChhyi1bgGeCQif
HpzcHxARoR6HtVuZPXWJMLwgusk2UNCan343u6WSQvm2
Luna1VCsPBE4hghuHaL9UFgimBB3V6u6johyd7hGXBL
SPC3m89qwxGbqYdg1GuaoeZtgJD2hYoob6c4aKLG1zu
Smith4JYx2otuFgT2dR83qJSfW8RjBZHPsXPyfZBYBu
pbAxyqHHPMwgEjv8kmjGxysk9rhNtN7q22eAjReq6Hj
qzCAEHbjb7AtpTPKaetY47LWNLCxFeHuFozjeXhj1k1
"
rm -f validators/all.md
shopt -s nullglob
for keybase_file in validators/keybase-usernames.*; do
section=${keybase_file##*.}
echo "## $section" >> validators/all.md
pubkey_yml=${keybase_file/keybase-usernames./}-pubkey.yml
rm -f $pubkey_yml
touch $pubkey_yml
username_yml=${keybase_file/keybase-usernames./}-username.yml
rm -f $username_yml
touch $username_yml
for username in $(cat "$keybase_file"); do
echo "Processing $username..."
declare pubkeyDir=
for dir in /Volumes/Keybase/public/"$username"/[Ss]olana/; do
if [[ -d $dir ]]; then
pubkeyDir=$dir
break;
fi
done
if [[ -z $pubkeyDir ]]; then
echo "Warn: $username: $pubkeyDir does not exist"
continue
fi
declare validatorPubkey=
for file in "$pubkeyDir"validator-*; do
validatorPubkey="$(basename "$file" .json)"
if [[ $validatorPubkey =~ .*validator-\ *([1-9A-HJ-NP-Za-km-z]+)$ ]]; then
declare pubkey="${BASH_REMATCH[1]}"
if [[ $slp_pubkeys =~ $pubkey ]]; then
echo "Warn: Ignoring SLP pubkey: $pubkey"
continue
fi
echo "$pubkey registered"
cat >> $pubkey_yml <<EOF
$pubkey:
balance: $lamports
owner: 11111111111111111111111111111111
data:
executable: false
EOF
echo "$pubkey: $username" >> $username_yml
echo "1. [$username](https://keybase.io/$username): \`$pubkey\`" >> validators/all.md
break
else
echo "Warn: $username: invalid validator pubkey: $validatorPubkey"
fi
break;
done
if [[ -z $validatorPubkey ]]; then
echo "Warn: $username: no validator pubkey found"
continue
fi
done
echo Wrote $pubkey_yml $username_yml
done
echo
pubkey_yml=validators/all-pubkey.yml
rm -f $pubkey_yml
cat validators/*-pubkey.yml > $pubkey_yml
echo Wrote $pubkey_yml
username_yml=validators/all-username.yml
rm -f $username_yml
cat validators/*-username.yml > $username_yml
echo Wrote $username_yml