How to send an SPO’s poll transaction to the Cardano blockchain using cardano-cli.
POOL=POOL_NAME_DIR
WALLET=WALLET_NAME_DIR
CNODE_HOME=/opt/cardano/cnode
ADDRESS=addr…
POOL_ID=64a…
#Get TX_ID and INDEX_ID from any available utxo:
cardano-cli query utxo --mainnet --address $ADDRESS
#FORMAT: TXID#INDEXID
TXIDIX=…#.
Download poll.json from GitHub - cardano-foundation/CIP-0094-polls repo.
vi poll.json
{
“type”: “GovernancePoll”,
“description”: “An on-chain poll for SPOs: Which setup would you prefer to be put in place from Q3 2023 onwards?”,
“cborHex”: “a1185ea200827840576869636820736574757020776f756c6420796f752070726566657220746f2062652070757420696e20706c6163652066726f6d2051332032303233206f6e7765617264733f01868178284b656570206b2061742035303020616e64206d696e506f6f6c436f7374206174203334302061646181782e4b656570206b2061742035303020616e642068616c7665206d696e506f6f6c436f737420746f2031373020616461817832496e637265617365206b20746f203130303020616e64206b656570206d696e506f6f6c436f73742061742033343020616461817833496e637265617365206b20746f203130303020616e642068616c7665206d696e506f6f6c436f737420746f20313730206164618178194920776f756c642070726566657220746f206162737461696e81781c4e6f6e65206f66207468652070726f7669646564206f7074696f6e73”
}
cardano-cli governance answer-poll --poll-file poll.json > answer.json
cardano-cli transaction build
–babbage-era
–cardano-mode
–mainnet
–tx-in $TXIDIX
–change-address $ADDRESS
–metadata-json-file answer.json
–json-metadata-detailed-schema
–required-signer-hash $POOL_ID
–out-file answer.tx
cardano-cli transaction sign
–tx-body-file answer.tx
–signing-key-file $CNODE_HOME/priv/wallet/$WALLET/payment.skey
–signing-key-file $CNODE_HOME/priv/pool/$POOL/cold.skey
–mainnet
–out-file answer.signed
cardano-cli transaction submit
–tx-file answer.signed
–mainnet
cardano-cli governance verify-poll
–poll-file poll.json
–tx-file answer.signed
##REFERENCES:
–tx-in is your wallet address you are going to pay for the transaction from. You need to control this address key to sign the transaction.
–change-address is your wallet address you want your change to go to.
Steps
- Find an available poll
Available polls are listed in the table above. Alternatively, you can use the getPoll.sh script to look for specific polls submitted on-chain.
-
Create a poll answer
Use the cardano-cli governance answer-poll command to create an answer. -
Build a transaction with metadata
Build a transaction using the poll answer as metadata. You’ll also need to indicate your pool id as an extra required signatory. -
Sign the transaction
The transaction must be signed using your cold key. -
Submit the transaction
Finally, submit the transaction to the network.