You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
09a_catalystVote.sh / 09a_vatalystVoteF10.sh:
Added a query feature so you can now verify your registered Voting-Power. This works on MainNet and on TestNet, because its a combined API at the moment.
The result is the currently registered total Voting-Power, and all the Delegators/Delegations that are done to that Voting-Key.
Queries can be done by providing the name of the Voting-Key file, by providing a bech encoded Voting-Key or by directly providing a hex encoded Voting-Key like:
- 09a_catalystVoteF10.sh query myvote-test
- 09a_catalystVoteF10.sh query cvote_vk1lca8dhe30dtmuk4yq3c9f20af0jk7ne9vhzhemheczjtpy3dq85qcdzn3e
- 09a_catalystVoteF10.sh query fe3a76df317b57be5aa4047054a9fd4be56f4f2565c57ceef9c0a4b0922d01e8
if [[ ${paramCnt}-lt 3 ]];then showUsage;exit 1;fi
57
-
58
58
case${1,,}in
59
59
60
60
### Generate the QR code from the vote secret key for the mobile voting app
61
61
qrcode )
62
62
63
+
if [[ ${paramCnt}-lt 3 ]];then showUsage;exit 1;fi
64
+
63
65
#Check the catalyst-toolbox binary existance and version
64
66
if! exists "${catalyst_toolbox_bin}";then
65
67
#Try the one in the scripts folder
@@ -70,7 +72,7 @@ case ${1,,} in
70
72
if [[ $?-ne 0 ]];thenecho -e "\e[35mERROR - This script needs a working 'catalyst-toolbox' binary. Please make sure you have it present with with the right path in '00_common.sh' !\e[0m\n\n";exit 1;fi
if [[ $?-ne 0 ]];then majorError "Version ${catalystToolboxVersion} ERROR - Please use a cardano-toolbox version ${minCatalystToolboxVersion} or higher !\nOld versions are not compatible, please upgrade - thx.";exit 1;fi
75
+
if [[ $?-ne 0 ]];then majorError "Version ${catalystToolboxVersion} ERROR - Please use a catalyst-toolbox version ${minCatalystToolboxVersion} or higher !\nOld versions are not compatible, please upgrade - thx.";exit 1;fi
echo -e "\e[0mQuery the Catalyst-API (${catalystAPI}) for the following Voting-Key\e[0m"
480
+
echo
481
+
482
+
#Read the votePublicKey information
483
+
voteKeyName="${allParameters[1]}"
484
+
485
+
#check the voteKeyName entry if it is a .pkey file (contains the bech pubKey), or if is a .vkey file (contains the key in hex format) or if it is a direct bech or hex key
486
+
if [ -f"${voteKeyName}.voting.pkey" ];then#the .pkey file exists so lets read the value in it and check it if its a bech key
487
+
inputKey=$(cat "${voteKeyName}.voting.pkey")
488
+
tmp=$(${bech32_bin}<<<"${inputKey}"2> /dev/null)
489
+
if [ $?-ne 0 ];thenecho -e "\e[35mError - ${voteKeyName}.voting.pkey contains an invalid bech votePublicKey !\e[0m\n";exit 1;fi
490
+
votePubKey=$(${bech32_bin}"cvote_vk"<<<"${inputKey}"2> /dev/null)#make sure it is a bechKey "cvote_vk"
491
+
checkError "$?";if [ $?-ne 0 ];thenexit$?;fi
492
+
voteKeySource="${voteKeyName}.voting.pkey"
493
+
elif [ -f"${voteKeyName}.voting.vkey" ];then#the .vkey file exists so lets read the value in it and check it
if [[ $?-ne 0 ]];thenecho -e "\e[35mERROR - ${voteKeyName}.voting.vkey is not a valid json file. Please make sure to use the new voting key format, you can generate it with the subcommand 'new' !\e[0m\n\n";exit 1;fi
496
+
#Generate the voting key bech format
497
+
inputKey=${cborVoteKey:4}
498
+
votePubKey=$(${bech32_bin}"cvote_vk"<<<${inputKey:0:64}2> /dev/null)#only use the first 64chars (32 bytes) in case an extended key was provided
499
+
checkError "$?";if [ $?-ne 0 ];thenexit$?;fi
500
+
voteKeySource="${voteKeyName}.voting.vkey"
501
+
502
+
elif [[ "${voteKeyName//[![:xdigit:]]}"=="${voteKeyName}" ]] && [[ ${#voteKeyName}-eq 64 ||${#voteKeyName}-eq 128 ]];then#lets use a hex key as the voteKeyName with length of 32 or 64 bytes
503
+
#Generate the voting key from hex input
504
+
inputKey=${voteKeyName,,}
505
+
votePubKey=$(${bech32_bin}"cvote_vk"<<<${inputKey:0:64}2> /dev/null)#only use the first 64chars (32 bytes) in case an extended key was provided
506
+
checkError "$?";if [ $?-ne 0 ];thenexit$?;fi
507
+
voteKeySource="direct"
508
+
voteKeyName="Hex-VotePublicKey"
509
+
510
+
else#ok lets try to read in the voteKeyName as a direct bech key
511
+
inputKey="${voteKeyName}"
512
+
tmp=$(${bech32_bin}<<<"${inputKey}"2> /dev/null)
513
+
if [ $?-ne 0 ];thenecho -e "\e[35mError - ${voteKeyName}.voting.pkey/vkey file not found. Also it is not a direct valid bech or hex votePublicKey !\e[0m\n";exit 1;fi
514
+
votePubKey=$(${bech32_bin}"cvote_vk"<<<"${inputKey}"2> /dev/null)#make sure it is a bechKey "cvote_vk"
0 commit comments