Answering SPO On-Chain Polls

This describes the process an SPO can take to participate in polls that are posted on-chain. Updated 5/25/2023 - to add note about paying transaction with multi-signature addresses.

Credits to Earn Coin Pool for documenting the procedure.

Step 1 - Prepare files

First we will need a signer-hash. So we will first go to our air gapped machine and create a hash file that we can move to our live environment.

Unlock cold keys folder by running the following:

chmod u+rwx $HOME/cold-keys

Run the following command on air gap machine to create signer-hash file.

cardano-cli stake-pool id \
--cold-verification-key-file $HOME/cold-keys/node.vkey \
--output-format hex > $HOME/cold-keys/pool.hex.id

You can view signer-hash to make sure it was successful by running:

cat $HOME/cold-keys/pool.hex.id

If successful copy file so you can move to live relay, now you can relock your keys by running:

chmod a-rwx $HOME/cold-keys

Step 2 - Move pool.hex.id file to Live Relay Node

For this guide we will put files in our $NODE_HOME folder. Please move pool.hex.id to $NODE_HOME folder on a hot/live relay node.

Step 3 - Answer Poll

First we need to get the poll.json file. This should be shared by Poll creator. Run this to download poll.json file for the parameter poll:

For future polls the address below will need to be updated to the correct URL for the poll.json file related to that poll.

cd $NODE_HOME
wget https://raw.githubusercontent.com/cardano-foundation/CIP-0094-polls/main/networks/mainnet/fae7bda85acb99c513aeab5f86986047b6f6cbd33a8e11f11c5005513a054dc8/poll.json

To answer the poll using interactive method run the following on your live relay node. Please note this is the step where 8.0.0 CLI is required.

cd $NODE_HOME
cardano-cli governance answer-poll \
--poll-file poll.json > poll-answer.json

Step 4 - Build Transaction

still on live relay node let's find UTXO with NO NFTs

cardano-cli query utxo \
--address $(cat payment.addr) \
--mainnet

Still on live relay node, build the transaction using the poll-answer.json and pool.hex.id by running:

cd $NODE_HOME
cardano-cli transaction build \
    --babbage-era \
    --mainnet \
    --tx-in <SAMPLE UTXO>#0 \
    --change-address $(cat payment.addr) \
    --metadata-json-file poll-answer.json \
    --json-metadata-detailed-schema \
    --required-signer-hash $(cat pool.hex.id) \
    --out-file answer.tx

When paying transaction with multi-signature addresses, you must add to the transaction build: “--witness-override 3” to calculate the correct transaction fees.

We use 3 in this example because we are using 3 private keys to sign the transaction later. Please adjust for your situation.

Step 5 - Inspect Transaction

You should be able to run the following to see your transaction details.

cardano-cli transaction view \
--tx-file answer.tx

Step 6 - Copy answer.tx to Air gapped and Sign the Transaction

Once again, we put our answer.tx file into our $NODE_HOME folder

⚠️ ON AIR GAPPED

Unlock cold keys folder by running the following:

chmod u+rwx $HOME/cold-keys

Now we will sign transaction with our node.skey and our payment.skey

cd $NODE_HOME
cardano-cli transaction sign \
--tx-body-file answer.tx \
--signing-key-file $HOME/cold-keys/node.skey \
--signing-key-file payment.skey \
--mainnet \
--out-file answer.tx.signed

If successful copy file so you can move to live relay, now you can relock your keys by running:

chmod a-rwx $HOME/cold-keys

Step 7 - Copy answer.tx.signed to Live Relay Node and Submit to Chain

We copy our answer.tx.signed file into our $NODE_HOME folder on our live relay and then run the following to submit it to chain:

cd $NODE_HOME
cardano-cli transaction submit \
--mainnet \
--tx-file answer.tx.signed

Congratulations you did it!

Now wait a few minutes for your transaction to get on-chain, then go to one of these tools to see your vote: https://adastat.net/polls https://cardanoscan.io/spo-polls/

Additional Resources

https://github.com/cardano-foundation/CIP-0094-polls

Contributors

Thanks to the following pools for helping to put together these guides. Please consider delegating to their pools to support them. Are you a pool? Consider buying them a coffee

Apex Cardano Pool - Ticker: APEX

Earn Coin Pool - Ticker: ECP

Envy Stake Pool - Ticker ENVY

PANL Stake Pool - Ticker PANL

xSPO Alliance

Last updated