How do I submit my JSON ballot to the blockchain using the ATADA pool's scripts?
If you are like me and hate using the CLI interface because of the multiple typos you suffer then you may want to use the scripts developed by Martin from ATADA pool and @TheRealAdamDean.
This explanation of how to submit your JSON file for the ballot makes the following assumptions:
- You have visited https://spocra.io/voting/ and followed their instructions
- You have validated yourself as a member and have been attributed a voter ID
- You have generated your ballot according to the instructions on https://spocra.io/voting/
If you have completed the above steps lets begin.
INSTRUCTIONS
Open your node server and find or make a working directory for your voting scripts. In my case, since I use CNTools as the scripting resource to run my node, I am using that file structure to place my voting working directory. But this can be done on any build anywhere on your node. Also, I choose to make a directory that is distinct from any other directory containing the production scripts for the node.
cd /opt/cardano/cnode/
mkdir -p other/voting
cd other/voting
Now that we are in our working directory let's download the applicable scripts to be able to build our voting transaction:
wget https://raw.githubusercontent.com/gitmachtl/scripts/master/cardano/mainnet/00_common.sh
wget https://raw.githubusercontent.com/gitmachtl/scripts/master/cardano/mainnet/01_sendVoteMeta.sh
Don't forget to CHMOD 755 these files:
chmod 755 00_common.sh 01_sendVoteMeta.sh
ls -l
You should then have a happy working directory with this (example):
-rwxr-xr-x 1 user user 6741 Sep 18 16:02 00_common.sh
-rwxr-xr-x 1 user user 8463 Sep 18 16:02 01_sendVoteMeta.sh
Now let's go ahead and put our JSON generated ballot in the same directory. Important: do not put the .json extension on this file name. The ATALA scripts add those extensions for you (why they chose to it that way I do not know...).
touch ballot
nano ballot
This will open the ballot file. Here you paste your generated JSON file contents using your favourite editor. Nano in my case. The JSON data will look like the code below (except for the parts where you need to REPLACE.WITH.VOTER.ID and REPLACE.WITH.YOU.CANDIATE.ID).
{
"1": {
"ObjectType": "VoteBallot",
"ObjectVersion": "1.0.0",
"NetworkId": "SPOCRA",
"ProposalId": "00d8f63b-9efb-41b6-90dc-35d90f5ad4e2",
"VoterId": "REPLACE.WITH.YOUR.VOTER.ID",
"Choices": {
"1": {
"CandidateId": "REPLACE.WITH.YOUR.CANDIDATE.ID",
"VoteWeight": 1,
"VoteRank": 2
},
"6": {
"CandidateId": "REPLACE.WITH.YOUR.CANDIDATE.ID",
"VoteWeight": 1,
"VoteRank": 3
},
"15": {
"CandidateId": "REPLACE.WITH.YOUR.CANDIDATE.ID",
"VoteWeight": 1,
"VoteRank": 1
}
}
}
}
EDITING 00_common.sh script for your node setup:
Now comes the tricky parts to edit and this depends on how you have set your node up.
Open 00_common.sh in your editor.
nano 00_common.sh
You will be presented with a script that starts with this:
#!/bin/bash
socket="db-mainnet/node.socket"
genesisfile="configuration-mainnet/mainnet-shelley-genesis.json" #Shelley
genesisfile_byron="configuration-mainnet/mainnet-byron-genesis.json" #Byroncardanocli="./cardano-cli"
cardanonode="./cardano-node"
Replace the paths above according to your node config. In my case, as a CNTools user, mine came out like this:
socket="/opt/cardano/cnode/sockets/node0.socket"
genesisfile="/opt/cardano/cnode/files/genesis.json" #Shelley
genesisfile_byron="/opt/cardano/cnode/files/byron-genesis.json" #Byron
cardanocli="/home/yourusername/.cabal/bin/cardano-cli"
cardanonode="/home/yourusername/.cabal/bin/cardano-node"
Once you have successfully edited your paths save your edited script. No need to edit anything else in 00_common.sh.
You are now nearly all set.
Only thing left is to create a "dummy" wallet. Now I am going to leave you do this on your own.
In my case, since I use CNTools, I use that tool to create a new wallet for me:
There is one caveat if you are a CNTools user, for example, your file names must all start with the same prefix for the voting scripts to work! CNTools names the wallet address file as "base.addr" and the hot and cold keys "payment.skey" and "payment.vkey". I would change these to "voting.addr", "voting.skey" and "voting.vkey". Remember, you are not using this wallet for CNtools. Only for the voting scripts!
You should have something like the following example (if you use CNTools):
cd /PATH_TO_YOUR_WALLET_FOLDER/
ls -l
-rw-rw-r-- 1 youruser youruser 103 Sep 18 11:51 base.addr
-rw------- 1 youruser youruser 180 Sep 18 16:49 payment.skey
-rw------- 1 youruser youruser 190 Sep 18 11:44 payment.vkey
-rw-rw-r-- 1 youruser youruser 59 Sep 18 11:51 reward.addr
-rw------- 1 youruser youruser 176 Sep 18 16:49 stake.skey
-rw------- 1 youruser youruser 186 Sep 18 11:44 stake.vkey
Change the first three file names to something like this:
-rw-rw-r-- 1 youruser youruser 103 Sep 18 11:51 voting.addr
-rw------- 1 youruser youruser 180 Sep 18 16:49 voting.skey
-rw------- 1 youruser youruser 190 Sep 18 11:44 voting.vkey
Regardless which node tool utility scripts you use just make sure the wallet address prefix matches the hot and cold key prefixes. The 01_sendVoteMeta.sh script just goes ahead and assumes the wallet address and key files names all start with the same prefix....
Do not forget to load some ADA into your newly created "dummy" wallet to pay for the ballot tx fee!
Time to submit the ballot to the blockchain!
Make sure you are back in your voting working directory. On the command line enter the following details replacing the paths to your wallet address and the path to your JSON ballot file:
./01_sendVoteMeta.sh /your/path/to/wallet/voting_address_file /your/path/to/working_directory/ballot
Note: in the path to your wallet address drop the .addr suffix. The script adds that automatically.
However, in the case of your JSON file, the file itself must be named to not have the .json extension at all! Again, the ballot script will also add the .json extension in the script to run with cardano-cli.
Once you submit the ballot using ./01_sendVoteMeta.sh, and if everything is correctly configured, you will get an output that looks like this:
Using lovelaces from Address /your/path/to/wallet/voting_address_file to send the metafile /your/path/to/working_directory/ballot.json:
Current Slot-Height: 8873447 (setting TTL to 8889007)
Source/Destination Address /your/path/to/wallet/voting_address_file.addr: addrfdfdffdffdffffffffffffffffffffffffffffffffffffffff8gsq5xyfx08xdvd0ss27u37retc
Attached Metafile: /your/path/to/working_directory/ballot.json
1 UTXOs found on the source Addr!
HASH: e15435345b4565b53453454500000000000000000000000 INDEX: 4 LOVELACES: 9000000
Total lovelaces in UTX0: 9000000 lovelaces
Minimum Transaction Fee for 1x TxIn & 1x TxOut: 188557 lovelaces
Lovelaces to return to /your/path/to/wallet/voting_address_file.addr: 8811443 lovelaces
Building the unsigned transaction body: /tmp/base.txbody
{
"type": "TxUnsignedShelley",
"description": "",
"cborHex": "45555555555555555555555555bda4fhhggh9f3cc6e79a83d5b4f6284e58d566a304cdc42b88d5849f521dea613a96d252129f3cc6e79a83d5b4f6284e58d566a304cdc42b88d5849f521dea613a96d252129f3cc6e79a83d5b4f6284e58d566a304cdc42b88d5849f521dea613a96d25212"
}
Sign the unsigned transaction body with the /opt/cardano/cnode/priv/wallet/voting/base.skey: /tmp/base.tx
/opt/cardano/cnode/priv/wallet/voting/base.skey: /opt/cardano/cnode/priv/wallet/voting/base.skey: openBinaryFile: does not exist (No such file or directory)
ERROR (Code 1) !
limbo@tim:/opt/cardano/cnode/other$ ./01_sendVoteMeta.sh /opt/cardano/cnode/priv/wallet/voting/payment /opt/cardano/cnode/other/spocra.round1
Using lovelaces from Address /opt/cardano/cnode/priv/wallet/voting/payment.addr to send the metafile /opt/cardano/cnode/other/spocra.round1.json:
Current Slot-Height: 8870564 (setting TTL to 8880564)
Source/Destination Address /opt/cardano/cnode/priv/wallet/voting/payment.addr: addr1q9xzlzvdnjhxdweg3526t4sg74klxunklul8h34kgnyy6ekw9c76fantycfxhsxrqj4fkj0xjn8gsq5xyfx08xdvd0ss27u37r
Attached Metafile: /opt/cardano/cnode/other/spocra.round1.json
1 UTXOs found on the source Addr!
HASH: e1744e1c3c69d84e269d4c1979ea509e67ebb0886045ddd574aea38bb9d77842 INDEX: 4 LOVELACES: 9000000
Total lovelaces in UTX0: 9000000 lovelaces
Minimum Transaction Fee for 1x TxIn & 1x TxOut: 188557 lovelaces
Lovelaces to return to /opt/cardano/cnode/priv/wallet/voting/payment.addr: 8811443 lovelaces
Building the unsigned transaction body: /tmp/payment.txbody
{
"type": "TxUnsignedShelley",
"description": "",
"cborHex": "82a50081825820e1744e1c3c69d84e269d4c1979ea509e67ebb0886045ddd574aea38bb9d77842040181825839014c2f898d9cae66bb288d15a5d608f56df37276ff3e7bc6b644c84d66ce2e3da4f66b26126bc0c304aa9b49e694ce880286224cf399ac6be11a008673b3021a0002e08d031a008781b4075820ccafcc5216ee96e20474fe70c0201e5c28c705a2f9147d11d0012a9d18727cfaa101a66743686f69636573a36131a36b43616e6469646174654964782465643066376230662d323066632d346361372d613436372d36656663376461336563396468566f746552616e6b026a566f746557656967687401623135a36b43616e6469646174654964782438333130343835392d313964382d343638332d396162332d32386437333337346639613668566f746552616e6b016a566f7465576569676874016136a36b43616e6469646174654964782438343166386635612d383561372d346237632d393135382d36333838646534633866303168566f746552616e6b036a566f746557656967687401694e6574776f726b49646653504f4352416a4f626a656374547970656a566f746542616c6c6f746d4f626a65637456657273696f6e65312e302e306a50726f706f73616c4964782430306438663633622d396566622d343162362d393064632d33356439306635616434653267566f7465724964782466656633343662302d653530352d346533352d393964362d316335386633663035323433"
}
Sign the unsigned transaction body with the /your/path/to/wallet/voting_address_file.skey: /tmp/payment.tx
{
"type": "TxSignedShelley",
"description": "",
"cborHex": "80787af9ded1206d652e8c9dd322fabcd111e77d093a4f90e3f57d9c9013287530787af9ded1206d652e8c9dd322fabcd111e77d093a4f90e3f57d9c9013287530787af9ded1206d652e8c9dd322fabcd111e77d093a4f90e3f57d9c9013287530787af9ded1206d652e8c9dd322fabcd111e77d093a4f90e3f57d9c9013287530787af9ded1206d652e8c9dd322fabcd111e77d093a4f90e3f57d9c9013287530787af9ded1206d652e8c9dd322fabcd111e77d093a4f90e3f57d9c901328753"
}
You will be prompted at the bottom of the above output:
Does this look good for you, continue ? [y/N] y
Select "y".
And that is it. Your ballot has been submitted.
You can wait a few moments, maybe a minute, and check to see if your ballot adds to the totals already displayed on the proposal voting results by clicking this link.
Links referenced in this document:
SPOCRA membership and voting details: https://spocra.io/voting/
Founding Board Round #1 Proposal: https://vote.crypto2099.io/
Proposal Voting Results: https://vote.crypto2099.io/view-results/?proposal_id=00d8f63b-9efb-41b6-90dc-35d90f5ad4e2&network_id=SPOCRA
Discord channel for SPOCRA: https://discord.com/channels/742178593421131907/742178593421131911
00_common.sh script on GitHub: https://github.com/gitmachtl/scripts/blob/master/cardano/mainnet/00_common.sh
01_sendVoteMeta.sh on GitHub: https://github.com/gitmachtl/scripts/blob/master/cardano/mainnet/01_sendVoteMeta.sh
CNTools: https://cardano-community.github.io/guild-operators/#/
* This document was created by Jorge Pascoal [BRUN] pool. Information here was checked and deemed correct on the date of 18 September 2020. All scripts and other instructions are subject to change after that date.
Please address any issue via my handles on the following platforms:
- Twitter: https://twitter.com/JorgePascoal18
- Telegram: https://t.me/bladarunner
- Or just comment below.
SHORT URL TO THIS PAGE:
https://cutt.ly/gfHtIIK
No Comments