|
1 | 1 |
|
2 | | -# How to register your operator pledge staking key for Catalyst Voting |
| 2 | +This document is outdated, please checkout the [NEW VERSION](https://github.com/gitmachtl/scripts/blob/master/Catalyst_Registration_CLI_Tools.md) here: |
| 3 | +https://github.com/gitmachtl/scripts/blob/master/Catalyst_Registration_CLI_Tools.md |
3 | 4 |
|
4 | | -<a href="https://github.com/gitmachtl/scripts/tree/master/cardano/mainnet"><img src="https://www.stakepool.at/pics/stakepool_operator_scripts.png" border=0></img></a><br> |
| 5 | +Thx |
5 | 6 |
|
6 | | -I put this together, should work for you, it did for me. But of course, use the instructions at your own risk ... :-) |
7 | | - |
8 | | -Best regards, Martin (ATADA/ATAD2 Stakepool Austria) |
9 | | - |
10 | | - <br> |
11 | | - |
12 | | -# The simple way using the SPO-Scripts |
13 | | - |
14 | | -## How to vote with Funds (also Pledge) on Hardware-Wallets :new: |
15 | | - |
16 | | -Important - you need the [cardano-hw-cli](https://github.com/vacuumlabs/cardano-hw-cli/releases) version **1.5.0** or above for that! |
17 | | - |
18 | | -Software needed on the Hardware-Wallet: |
19 | | -* **Ledger NanoS or NanoX: Cardano-App 2.3.2** or newer |
20 | | -* **Trezor Model-T: Firmware 2.4.0** or newer |
21 | | - |
22 | | -To **generate your Voting-Registration**, please use the **09a_catalystVote.sh script** from the MainNet Repo to do so, you can find a description of the 4 simple steps [here](https://github.com/gitmachtl/scripts/tree/master/cardano/mainnet#catalyst-voting-with-your-hw-wallet) |
23 | | - |
24 | | - <br> |
25 | | - |
26 | | -## How to vote with Funds (also Pledge) on CLI-Keys and HYBRID-Keys :new: |
27 | | - |
28 | | -Important - you need the [voter-registration tool](https://github.com/input-output-hk/voting-tools/releases/latest) version **0.2.0.0** or above for that! |
29 | | - |
30 | | -To **generate your Voting-Registration**, please use the **09a_catalystVote.sh script** from the MainNet Repo to do so, you can find a description of the 4 simple steps [here](https://github.com/gitmachtl/scripts/tree/master/cardano/mainnet#catalyst-voting-with-your-cli-keys-or-hybrid-keys) |
31 | | - |
32 | | - <br> |
33 | | - |
34 | | - |
35 | | -# The step-by-step way on the CLI |
36 | | - |
37 | | -## How to vote with Funds (also Pledge) on CLI-Keys |
38 | | - |
39 | | -### First - Lets talk about security |
40 | | - |
41 | | -Make sure you don't have any rewards sitting on your pledge staking key, |
42 | | -withdrawl them first to your pledge payment account or whereever you like. |
43 | | -The tool IOHK provides should not harm it in any way, its just a safety thing. |
44 | | -You need a running and fully synced node on the machine, also you will have |
45 | | -your pledge staking skey on that machine for the time of running the registration |
46 | | -tool. Each SPO have to decide if he is ok with that or not. Your pledge funds are |
47 | | -not at risk here, because you don't need your pledge payment skey for the registration. |
48 | | - |
49 | | -### Generate your voting secret and public key |
50 | | - |
51 | | -You need a **jcli** binary for that, you should already have this laying around, if not, |
52 | | -you can find the latest compiled release here:<br> |
53 | | -[https://github.com/input-output-hk/jormungandr/releases/latest](https://github.com/input-output-hk/jormungandr/releases/latest) |
54 | | - |
55 | | -You can extract the file for your operating system like: |
56 | | -``` console |
57 | | -wget https://github.com/input-output-hk/jormungandr/releases/download/v0.9.3/jormungandr-0.9.3-x86_64-unknown-linux-gnu-generic.tar.gz |
58 | | -tar -xf jormungandr-0.9.3-x86_64-unknown-linux-gnu-generic.tar.gz |
59 | | -``` |
60 | | - |
61 | | -Now lets generate the two keyfiles: |
62 | | - |
63 | | -``` console |
64 | | -./jcli key generate --type ed25519extended > catalyst-vote.skey |
65 | | -./jcli key to-public < catalyst-vote.skey > catalyst-vote.pkey |
66 | | -``` |
67 | | - |
68 | | -You have generated the secret- and the public-voting key, we use them now in the next steps. |
69 | | - |
70 | | -⚠️ Make sure, that you have generated the skey as an ed25519**extended** key ! |
71 | | - |
72 | | -### Where will the voting rewards distributed to? |
73 | | - |
74 | | -Thats an important one, the voting rewards will be distributed back onto a stake address as rewards. Like staking rewards ! |
75 | | - |
76 | | - |
77 | | -### Generate the voting registration metadata |
78 | | - |
79 | | -Make sure your environment variable **CARDANO_NODE_SOCKET_PATH** is pointing to a running fully synced |
80 | | -cardano node (just a simple passive one is ok), for example: |
81 | | - |
82 | | -``` console |
83 | | -export CARDANO_NODE_SOCKET_PATH=db-mainnet/node.socket |
84 | | -``` |
85 | | - |
86 | | -Lets generate the registration metadata in json format: |
87 | | - |
88 | | -``` console |
89 | | -export NETWORK_ID="--mainnet" |
90 | | -export SLOT_TIP=$(cardano-cli query tip $NETWORK_ID | jq '.slot') |
91 | | - |
92 | | -voter-registration \ |
93 | | - --rewards-address $(cat pledge.staking.addr) \ |
94 | | - --vote-public-key-file catalyst-vote.pkey \ |
95 | | - --stake-signing-key-file pledge.staking.skey \ |
96 | | - --slot-no $SLOT_TIP \ |
97 | | - --json > voting-registration-metadata.json |
98 | | -``` |
99 | | - |
100 | | -Both CBOR (--cbor) and JSON (--json) formats exist. We choose --json in this example. |
101 | | - |
102 | | -### Submission of vote registration |
103 | | - |
104 | | -Next, we need to add this transaction metadata to a transaction and submit it to the chain. |
105 | | - |
106 | | -First we'll grab the protocol parameters: |
107 | | - |
108 | | -``` console |
109 | | -cardano-cli query protocol-parameters \ |
110 | | - $NETWORK_ID \ |
111 | | - --out-file protocol.json |
112 | | -``` |
113 | | - |
114 | | -And find some funds to use: |
115 | | - |
116 | | -We need a payment address, this should **NOT BE YOUR PLEDGE ADDRESS**! Just a simple |
117 | | -payment address to pay for the transaction, we call it **payment**. |
118 | | - |
119 | | - |
120 | | -``` console |
121 | | -export PAYMENT_ADDR=$(cat payment.addr) |
122 | | - |
123 | | -echo "UTxOs available:" |
124 | | -cardano-cli query utxo \ |
125 | | - $NETWORK_ID \ |
126 | | - --address $PAYMENT_ADDR |
127 | | - TxHash TxIx Amount |
128 | | --------------------------------------------------------------------------------------- |
129 | | -b9579d53f3fd77679874a2d1828e2cf40e31a8ee431b35ca9347375a56b6c39b 0 999821651 lovelace + TxOutDatumNone |
130 | | - |
131 | | -``` |
132 | | - |
133 | | -Here we're just using the first TxHash and TxIx we find, you should choose an appropriate UTxO and TxIx. |
134 | | - |
135 | | -``` console |
136 | | -export AMT=$(cardano-cli query utxo $NETWORK_ID --address $PAYMENT_ADDR | tail -n1 | awk '{print $3;}') |
137 | | -export UTXO=$(cardano-cli query utxo $NETWORK_ID --address $PAYMENT_ADDR | tail -n1 | awk '{print $1;}') |
138 | | -export UTXO_TXIX=$(cardano-cli query utxo $NETWORK_ID --address $PAYMENT_ADDR | tail -n1 | awk '{print $2;}') |
139 | | -echo "UTxO: $UTXO#$UTXO_TXIX" |
140 | | -``` |
141 | | - |
142 | | -Here we'll make draft transaction for the purposes of fee estimation. This transaction will simply send the entire UTxO value back to us, minus the fee. We don't need to send money anywhere else, we simply have to make a valid transaction with the metadata attached. |
143 | | - |
144 | | -``` console |
145 | | -cardano-cli transaction build-raw \ |
146 | | - --tx-in $UTXO#$UTXO_TXIX \ |
147 | | - --tx-out $(cat payment.addr)+0 \ |
148 | | - --invalid-hereafter 0 \ |
149 | | - --fee 0 \ |
150 | | - --metadata-json-file voting-registration-metadata.json |
151 | | - --out-file tx.draft \ |
152 | | - |
153 | | -export FEE=$(cardano-cli transaction calculate-min-fee \ |
154 | | - $NETWORK_ID \ |
155 | | - --tx-body-file tx.draft \ |
156 | | - --tx-in-count 1 \ |
157 | | - --tx-out-count 1 \ |
158 | | - --witness-count 1 \ |
159 | | - --protocol-params-file protocol.json | awk '{print $1;}') |
160 | | - |
161 | | -export AMT_OUT=$(expr $AMT - $FEE) |
162 | | -``` |
163 | | - |
164 | | -Then we have to decide on a TTL for the transaction, and build the final transaction: |
165 | | - |
166 | | -``` console |
167 | | -export TTL=$(expr $SLOT_TIP + 200) |
168 | | - |
169 | | -cardano-cli transaction build-raw \ |
170 | | - --tx-in $UTXO#$UTXO_TXIX \ |
171 | | - --tx-out $PAYMENT_ADDR+$AMT_OUT \ |
172 | | - --invalid-hereafter $TTL \ |
173 | | - --fee $FEE \ |
174 | | - --metadata-json-file voting-registration-metadata.json |
175 | | - --out-file tx.raw |
176 | | -``` |
177 | | - |
178 | | -Then we can sign the transaction: |
179 | | - |
180 | | -``` console |
181 | | -cardano-cli transaction sign \ |
182 | | - --tx-body-file tx.raw \ |
183 | | - --signing-key-file payment.skey \ |
184 | | - $NETWORK_ID \ |
185 | | - --out-file tx.signed |
186 | | -``` |
187 | | - |
188 | | -And finally submit our transaction: |
189 | | - |
190 | | -``` console |
191 | | -cardano-cli transaction submit \ |
192 | | - --tx-file tx.signed \ |
193 | | - $NETWORK_ID |
194 | | -``` |
195 | | - |
196 | | -We'll have to wait a little while for the transaction to be incorporated into the chain: |
197 | | - |
198 | | -``` console |
199 | | -cardano-cli query utxo --address $(cat payment.addr) $NETWORK_ID |
200 | | - TxHash TxIx Amount |
201 | | --------------------------------------------------------------------------------------- |
202 | | -b9579d53f3fd77679874a2d1828e2cf40e31a8ee431b35ca9347375a56b6c39b 0 999821651 lovelace + TxOutDatumNone |
203 | | - |
204 | | -cardano-cli query utxo --address $(cat payment.addr) $NETWORK_ID |
205 | | - TxHash TxIx Amount |
206 | | --------------------------------------------------------------------------------------- |
207 | | -4fbd6149f9cbbeb8f91b618ae3813bc451c22059c626637d3b343d3114cb92c5 0 999642026 lovelace + TxOutDatumNone |
208 | | -``` |
209 | | - |
210 | | -But once we've confirmed the transaction has entered the chain, we're registered! |
211 | | - |
212 | | - |
213 | | -### Generate the QR code for the Catalyst Voting App: |
214 | | - |
215 | | -There is a handy little tool called **qr-code** available as part of `catalyst-toolbox` for that, you can find the compiled binary for your system here:<br> |
216 | | -[https://github.com/input-output-hk/catalyst-toolbox/releases/latest](https://github.com/input-output-hk/catalyst-toolbox/releases/latest) |
217 | | - |
218 | | -Extract the downloaded archive for your operating system and copy out the binary to your prefered folder. We use again ~/cardano/ in our example: |
219 | | -``` console |
220 | | -wget https://github.com/input-output-hk/catalyst-toolbox/releases/download/v0.3.0/catalyst-toolbox-0.3.0-x86_64-unknown-linux-gnu.tar.gz |
221 | | -tar -xf catalyst-toolbox-0.3.0-x86_64-unknown-linux-gnu.tar.gz |
222 | | -cp $(find . -name catalyst-toolbox -executable -type f) ~/cardano/. |
223 | | -``` |
224 | | - |
225 | | -Now we have the tool to generate the qr code, and thats pretty simple. You have a few parameters: |
226 | | -```console |
227 | | -Usage of ./catalyst-toolbox qr-code: |
228 | | - --input string |
229 | | - path to file containing ed25519extended bech32 value |
230 | | - --output string |
231 | | - path to file to save qr code output, if not provided console output will be attempted |
232 | | - --pin string |
233 | | - Pin code. 4-digit number is used on Catalyst |
234 | | - img |
235 | | - Output as an image (Subcommand) |
236 | | -``` |
237 | | - |
238 | | -Or simply run `./catalyst-toolbox qr-code --help` for the newest version help. |
239 | | - |
240 | | -In our example here we have generated the secret voting key as file called **catalyst-vote.skey**, and lets go with the |
241 | | -pincode *1234*. You can choose that and you will have to input it when using the Catalyst App to scan the QR code: |
242 | | - |
243 | | -```console |
244 | | -./catalyst-toolbox qr-code --pin 1234 --input catalyst-vote.skey img |
245 | | -``` |
246 | | - |
247 | | -This will show you the QR code on screen and you can use it with the Catalyst Voting App. :-) |
248 | | - |
249 | | -If you wanna save the QR code for later, you can save it as a PNG image too using the -output parameter like: |
250 | | -```console |
251 | | -./catalyst-toolbox qr-code --pin 1234 --input catalyst-vote.skey --output catalyst-qrcode.png img |
252 | | -``` |
253 | | - |
254 | | -This will generate the QR code as the file **catalyst-qrcode.png** |
255 | | - |
256 | | -> If you wanna be 1000% sure that your QR code is correct, you can validate it again with this little tool here: [https://github.com/input-output-hk/vit-testing/tree/main/iapyx#readme](https://github.com/input-output-hk/vit-testing/tree/main/iapyx#readme) ➡️ iapyx-qr |
257 | | - |
258 | 7 | ## Happy voting ! |
0 commit comments