@@ -288,7 +288,7 @@ importNodeSkey() {
288288
289289        # Generate the pairing Vkey file from the Skey file
290290        echo  -ne " \e[0mGenerating file '\e[32m${poolName} /${poolName} .node.vkey\e[0m' ... " >&2 ; 
291-         ${cardanocli}  key verification-key --signing-key-file " ${poolName} /${poolName} .node.skey" " ${poolName} /${poolName} .node.vkey" ;  checkError " $? " ;  if  [ $?  -ne  0 ];  then  exit  $? ;  fi 
291+         ${cardanocli}  ${cliEra}   key verification-key --signing-key-file " ${poolName} /${poolName} .node.skey" " ${poolName} /${poolName} .node.vkey" ;  checkError " $? " ;  if  [ $?  -ne  0 ];  then  exit  $? ;  fi 
292292        file_lock " ${poolName} /${poolName} .node.vkey" 
293293        echo  -e " \e[32mOK\e[0m" >&2 ; 
294294
@@ -298,7 +298,7 @@ importNodeSkey() {
298298	poolNodeCounter=$(( ${poolNodeCounter} + 1 )) 
299299	echo  -e " \e[0mNew OpCertCounter for this import: \e[32m${poolNodeCounter} \e[0m" >&2 ; 
300300        echo  -ne " \e[0mGenerating file '\e[32m${poolName} /${poolName} .node.counter\e[0m' ... " >&2 ; 
301- 	${cardanocli}  node new-counter --cold-verification-key-file " ${poolName} /${poolName} .node.vkey" ${poolNodeCounter}  --operational-certificate-issue-counter-file " ${poolName} /${poolName} .node.counter" 
301+ 	${cardanocli}  ${cliEra}   node new-counter --cold-verification-key-file " ${poolName} /${poolName} .node.vkey" ${poolNodeCounter}  --operational-certificate-issue-counter-file " ${poolName} /${poolName} .node.counter" 
302302        checkError " $? " ;  if  [ $?  -ne  0 ];  then  exit  $? ;  fi 
303303        # NodeCounter file was written, now add the description in the file to reflect the next node counter number
304304        newCounterJSON=$( jq " .description = \" Next certificate issue number: ${poolNodeCounter} \" " <  " ${poolName} /${poolName} .node.counter" ) 
@@ -339,8 +339,8 @@ importVrfSkey() {
339339        if  [[ !  " $( jq -r .type $1 ) " ==  * " SigningKey" *  ]];  then  echo  -e " \n\e[35mERROR - \" $1 \"  is not a valid vrf.skey file.\e[0m\n" >&2 ;  exit  1;  fi ; 
340340
341341	# Probe the given VRF key hash with the one that is online
342- 	newVRFstring=$( ${cardanocli}  key verification-key --signing-key-file " ${1} " |  jq -r .cborHex) # the maybe new vrf string
343- 	newVRFhash=$( ${cardanocli}  node key-hash-VRF --verification-key " ${newVRFstring: 4} " ) # crop the first 4 chars before handing over the string
342+ 	newVRFstring=$( ${cardanocli}  ${cliEra}   key verification-key --signing-key-file " ${1} " |  jq -r .cborHex) # the maybe new vrf string
343+ 	newVRFhash=$( ${cardanocli}  ${cliEra}   node key-hash-VRF --verification-key " ${newVRFstring: 4} " ) # crop the first 4 chars before handing over the string
344344	oldVRFhash=$( jq -r " .vrf_key_hash" 2>  /dev/null <<<  ${importJSON} ) 
345345	if  [[ !  " ${newVRFhash} " ==  " ${oldVRFhash} " ;  then  echo  -e " \n\e[35mWARNING - VRF KeyHash does not match up with the one that is online right now!\e[0m\n" >&2 ;  exit  1;  fi ; 
346346
@@ -353,7 +353,7 @@ importVrfSkey() {
353353
354354        # Generate the pairing Vkey file from the Skey file
355355        echo  -ne " \e[0mGenerating file '\e[32m${poolName} /${poolName} .vrf.vkey\e[0m' ... " >&2 ; 
356-         ${cardanocli}  key verification-key --signing-key-file " ${poolName} /${poolName} .vrf.skey" " ${poolName} /${poolName} .vrf.vkey" ;  checkError " $? " ;  if  [ $?  -ne  0 ];  then  exit  $? ;  fi 
356+         ${cardanocli}  ${cliEra}   key verification-key --signing-key-file " ${poolName} /${poolName} .vrf.skey" " ${poolName} /${poolName} .vrf.vkey" ;  checkError " $? " ;  if  [ $?  -ne  0 ];  then  exit  $? ;  fi 
357357        file_lock ${poolName} /${poolName} .vrf.vkey
358358        echo  -e " \e[32mOK\e[0m\n" >&2 ; 
359359
@@ -394,12 +394,12 @@ importPaymentSkey() {
394394
395395        # Generate the pairing Vkey file from the Skey file
396396        echo  -ne " \t\e[0mGenerating file '\e[32m${poolName} /${ownerName} .payment.vkey\e[0m' ... " >&2 ; 
397-         ${cardanocli}  key verification-key --signing-key-file " ${poolName} /${ownerName} .payment.skey" " ${poolName} /${ownerName} .payment.vkey" ;  checkError " $? " ;  if  [ $?  -ne  0 ];  then  exit  $? ;  fi 
397+         ${cardanocli}  ${cliEra}   key verification-key --signing-key-file " ${poolName} /${ownerName} .payment.skey" " ${poolName} /${ownerName} .payment.vkey" ;  checkError " $? " ;  if  [ $?  -ne  0 ];  then  exit  $? ;  fi 
398398
399399	# If the verification key is an extended one, convert it into a non-extended one
400400	tmp=$( jq -r .type " ${poolName} /${ownerName} .payment.vkey" 2>  /dev/null) 
401401        if  [[ " ${tmp^^} " ==  * " EXTENDED" *  ]];  then 
402- 		${cardanocli}  key non-extended-key --extended-verification-key-file " ${poolName} /${ownerName} .payment.vkey" " ${poolName} /${ownerName} .payment.vkey" ; 
402+ 		${cardanocli}  ${cliEra}   key non-extended-key --extended-verification-key-file " ${poolName} /${ownerName} .payment.vkey" " ${poolName} /${ownerName} .payment.vkey" ; 
403403  		checkError " $? " ;  if  [ $?  -ne  0 ];  then  exit  $? ;  fi ; 
404404	fi 
405405
@@ -430,12 +430,12 @@ importStakingSkey() {
430430
431431        # Generate the pairing Vkey file from the Skey file
432432        echo  -ne " \t\e[0mGenerating file '\e[32m${poolName} /${ownerName} .staking.vkey\e[0m' ... " >&2 ; 
433-         ${cardanocli}  key verification-key --signing-key-file " ${poolName} /${ownerName} .staking.skey" " ${poolName} /${ownerName} .staking.vkey" ;  checkError " $? " ;  if  [ $?  -ne  0 ];  then  exit  $? ;  fi 
433+         ${cardanocli}  ${cliEra}   key verification-key --signing-key-file " ${poolName} /${ownerName} .staking.skey" " ${poolName} /${ownerName} .staking.vkey" ;  checkError " $? " ;  if  [ $?  -ne  0 ];  then  exit  $? ;  fi 
434434
435435        # If the verification key is an extended one, convert it into a non-extended one
436436        tmp=$( jq -r .type " ${poolName} /${ownerName} .staking.vkey" 2>  /dev/null) 
437437        if  [[ " ${tmp^^} " ==  * " EXTENDED" *  ]];  then 
438-                 ${cardanocli}  key non-extended-key --extended-verification-key-file " ${poolName} /${ownerName} .staking.vkey" " ${poolName} /${ownerName} .staking.vkey" ; 
438+                 ${cardanocli}  ${cliEra}   key non-extended-key --extended-verification-key-file " ${poolName} /${ownerName} .staking.vkey" " ${poolName} /${ownerName} .staking.vkey" ; 
439439                checkError " $? " ;  if  [ $?  -ne  0 ];  then  exit  $? ;  fi ; 
440440        fi 
441441
@@ -491,29 +491,39 @@ while [[ ! "${ownerName}" == "" ]]; do
491491
492492			# Building a Payment Address
493493		        echo  -ne " \t\e[0mGenerating file '\e[32m${poolName} /${ownerName} .payment.addr\e[0m' ... " ; 
494- 			${cardanocli}  address build --payment-verification-key-file " ${poolName} /${ownerName} .payment.vkey" " ${poolName} /${ownerName} .staking.vkey" ${addrformat}  >  " ${poolName} /${ownerName} .payment.addr" 
494+ 			${cardanocli}  ${cliEra}   address build --payment-verification-key-file " ${poolName} /${ownerName} .payment.vkey" " ${poolName} /${ownerName} .staking.vkey" ${addrformat}  >  " ${poolName} /${ownerName} .payment.addr" 
495495			checkError " $? " ;  if  [ $?  -ne  0 ];  then  exit  $? ;  fi 
496496			file_lock " ${poolName} /${ownerName} .payment.addr" 
497497		        echo  -e " \e[32mOK\e[0m" ; 
498498
499499			# Building a Staking Address
500500		        echo  -ne " \t\e[0mGenerating file '\e[32m${poolName} /${ownerName} .staking.addr\e[0m' ... " ; 
501- 			${cardanocli}  stake-address build --staking-verification-key-file " ${poolName} /${ownerName} .staking.vkey" ${addrformat}  >  " ${poolName} /${ownerName} .staking.addr" 
501+ 			${cardanocli}  ${cliEra}   stake-address build --staking-verification-key-file " ${poolName} /${ownerName} .staking.vkey" ${addrformat}  >  " ${poolName} /${ownerName} .staking.addr" 
502502			checkError " $? " ;  if  [ $?  -ne  0 ];  then  exit  $? ;  fi 
503503			file_lock " ${poolName} /${ownerName} .staking.addr" 
504504		        echo  -e " \e[32mOK\e[0m" ; 
505505
506506			# Create an address registration certificate
507- 		        echo  -ne " \t\e[0mGenerating file '\e[32m${poolName} /${ownerName} .staking.cert\e[0m' ... " ; 
508- 			${cardanocli}  stake-address registration-certificate --staking-verification-key-file " ${poolName} /${ownerName} .staking.vkey" " ${poolName} /${ownerName} .staking.cert" 
507+ 			# Read ProtocolParameters
508+ 			case  ${workMode}  in 
509+ 			        " online" $( ${cardanocli}  ${cliEra}  query protocol-parameters) # onlinemode
510+ 			        " light" ${lightModeParametersJSON} ;; # lightmode
511+ 			        " offline" ;         # Reads the offlinefile into the offlineJSON variable
512+ 			                        protocolParametersJSON=$( jq " .protocol.parameters" <<<  ${offlineJSON} ) # offlinemode
513+ 			esac 
514+ 			checkError " $? " ;  if  [ $?  -ne  0 ];  then  exit  $? ;  fi 
515+ 			# Lets use the currently set keyDeposit amount
516+ 			stakeAddressDepositFee=$( jq -r .stakeAddressDeposit <<<  ${protocolParametersJSON} ) 
517+ 		        echo  -ne " \t\e[0mGenerating file '\e[32m${poolName} /${ownerName} .staking.cert\e[0m' with ${stakeAddressDepositFee}  lovelace deposit fee ... " ; 
518+ 			${cardanocli}  ${cliEra}  stake-address registration-certificate --staking-verification-key-file " ${poolName} /${ownerName} .staking.vkey" " ${stakeAddressDepositFee} " " ${poolName} /${ownerName} .staking.cert" 
509519			checkError " $? " ;  if  [ $?  -ne  0 ];  then  exit  $? ;  fi 
510520			file_lock " ${poolName} /${ownerName} .staking.cert" 
511521		        echo  -e " \e[32mOK\e[0m" ; 
512522
513523                        # Create the delegation certificate to this pool
514524			if  [ -f  " ${poolName} /${poolName} .node.vkey" &&  [ -f  " ${poolName} /${ownerName} .staking.vkey" ;  then 
515525	                        echo  -ne " \t\e[0mGenerating file '\e[32m${poolName} /${ownerName} .deleg.cert\e[0m' ... " ; 
516- 	  			${cardanocli}  stake-address delegation-certificate --stake-verification-key-file " ${poolName} /${ownerName} .staking.vkey" " ${poolName} /${poolName} .node.vkey" " ${poolName} /${ownerName} .deleg.cert" 
526+ 				${cardanocli}  ${cliEra}   stake-address stake- delegation-certificate --stake-verification-key-file " ${poolName} /${ownerName} .staking.vkey" " ${poolName} /${poolName} .node.vkey" " ${poolName} /${ownerName} .deleg.cert" 
517527				checkError " $? " ;  if  [ $?  -ne  0 ];  then  exit  $? ;  fi 
518528				file_lock " ${poolName} /${ownerName} .deleg.cert" 
519529			        echo  -e " \e[32mOK\e[0m" ; 
0 commit comments