Skip to content

Instantly share code, notes, and snippets.

@Willburn
Created May 23, 2020 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Willburn/a8f64c3afc2bdcb090428d54fec6e4fe to your computer and use it in GitHub Desktop.
Save Willburn/a8f64c3afc2bdcb090428d54fec6e4fe to your computer and use it in GitHub Desktop.
register pool script
cat << "EOF"
``.'",,:>*r!~'`
`',,,,,,,:::::^/^!!~`
`.'"",,'',:~!^::!:=;;>ii!'
`.',''.`````:....';,,~::=vvl^`
.',,'....'',::,,::::::::>;ri|\\:`
`.,,,''` ',.```````,.'',,~^^:!^>iJ?`
`'''.````',. `.':,,,"~:!ii7l7v7Jr`
',,,':::~,.....!::,,,,',,!":::::|7!:;>`
',,,'.:'.`` :,.```.',:v;!:!^r?xv|il;
`,":,,,,''',',,":::,::*\**^^!!:!*>!:!::rl`
,:::"~,,,,,,::.`````..,r,,,,"~~:!\!;r?/l{:
`,,,:,,::;::!^^*\~.,:"~~:::::::!:::!!il7\:>\
` '` ,"",:!:,:!r:~:;,:c:';,,,,,"~~~~!!::::|llz^>s.
a! .@L `~::!>?zi:~!^::;!!^t::~~::::::::!*;rr?ll/7cvz'
"@K .@L '"~:;r\u6{,:|;::!!!l|"""""::~~~::::::!7/:;)lC'
UB@, '6Rd@/ ~OHg^ :::!^*{wdgr;L>~:!^^^zr^rr;;?r>>rrr>>>?z7|/7sv`
.@rUe OD`.@L `:d# ~":!^>ue$Bu">*:!!!!!v::)!::::!^>?)L!:!^>|iv}?
}Q:c@, Qu .@L /By8Q `'!>^>?|/yw6WE\7l*|\//cxr=7|?\LlzsJzzc|Ll7vvlvz/r!,`
,@wFFQA wB,"@L RH.eQ ``.'''..',,,,,:!!;!:"""":!rrr^rr^!~:!^rrr^:'``
rk` >X.`vp6u! ,ad4C `.```````.'.......``````````
:!' `::``,:^^!' '^!!:~.`:!!!:!.:!. `!; `~^rr!' `:!>*;, `,:r=^:`,!,
^lL:`//`!\^,://,,l=,!||`,"*\:,`ri,`,i\ .?L,,\L'^\;'"\/,:\^',\i~:l~
rc>L*)i.cl' `rl:~l|:r|! /L. >/|^/)l .ci;!l\'ll'``>l:>)"``^l::l!
rl,'|l)`=l?^rL/.~|="||. LL. >i,`'il .)L",'` ^|=r>L*`~c\*>L)':l>"~:
~!. `!!``,:!!:` ';" ,!" ;^` :!. `!! `:: ':::,` ':::~` '::::: a
____ _____________________________________ ____ ____ ____ __
/ __ \/ ____/ ____/ _/ ___/_ __/ ____/ __ \ / __ \/ __ \/ __ \/ /
/ /_/ / __/ / / __ / / \__ \ / / / __/ / /_/ / / /_/ / / / / / / / /
/ _, _/ /___/ /_/ // / ___/ // / / /___/ _, _/ / ____/ /_/ / /_/ / /___
/_/_||||_||||||||||__||||||||/_|_||||__/_/ |_| /_/ \____/\____/_____/
/ ___// ____/ __ \/ _/ __ \/_ __/
\__ \/ / / /_/ // // /_/ / / /
___/ / /___/ _, _// // ____/ / /
/____/\____/_/ |_/___/_/ /_/
EOF
# ASCII ART http://patorjk.com/software/taag/#p=display&f=Slant&t=REGISTER%20POOL%0ASCRIPT
# ASCII IMAGE https://cloudapps.herokuapp.com/imagetoascii/
# ANP PREAMBLE
source ~/.profile
addr_dir=$CNODEDIRADDR
if [ -z "$CNODEDIRADDR" ]; then
echo CNODEDIRADDR env variable set to $CNODEDIRADDR
echo what is your address/skey/vkey default directory
read addr_dir
fi
networkmagic=$CNODENETWORKMAGIC
if [ -z "$CNODENETWORKMAGIC" ]; then
echo CNODENETWORKMAGIC env variable was set to $CNODENETWORKMAGIC
echo what is your network magic number?
read networkmagic
fi
cnodesocket=$CARDANO_NODE_SOCKET_PATH
if [ -z "$CARDANO_NODE_SOCKET_PATH" ]; then
echo CARDANO_NODE_SOCKET_PATH env variable set to $CARDANO_NODE_SOCKET_PATH
echo what is the directory and filename of the cnode socket you want to use
read cnodesocket
fi
cnodeconfiguration=$CNODECONFIG
if [ -z "$CNODECONFIG" ]; then
echo CNODECONFIG env variable set to $CNODECONFIG
echo what is the directory and filename of the cnode config file you want to use
read cnodeconfiguration
fi
staking_dir=$CNODESTAKINGDIR
if [ -z "$CNODESTAKINGDIR" ]; then
echo CNODESTAKINGDIR env variable set to $CNODESTAKINGDIR
echo what is the directory absolute path for cnode staking directory you want to use
read staking_dir
fi
pool_dir=$CNODEPOOLDIR
if [ -z "$CNODEPOOLDIR" ]; then
echo CNODEPOOLDIR env variable set to $CNODEPOOLDIR
echo what is the directory absolute path for cnode pool directory you want to use
read pool_dir
fi
staking_vkey=$CNODESTAKINGVKEY
if [ -z "$CNODESTAKINGVKEY" ]; then
echo CNODESTAKINGVKEY env variable set to $CNODESTAKINGVKEY
echo what is the directory absolute path for cnode staking directory and file of vkey you want to use
read staking_vkey
fi
staking_skey=$CNODESTAKINGSKEY
if [ -z "$CNODESTAKINGSKEY" ]; then
echo CNODESTAKINGSKEY env variable set to $CNODESTAKINGSKEY
echo what is the directory absolute path for cnode staking directory and file of skey you wan
read staking_skey
fi
cold_vkey=$CNODECOLDVKEY
if [ -z "$CNODECOLDVKEY" ]; then
echo CNODECOLDVKEY env variable set to $CNODECOLDVKEY
echo what is the directory absolute path for cnode cold vkey directory and file of vkey you wan
read cold_vkey
fi
cold_skey=$CNODECOLDSKEY
if [ -z "$CNODECOLDSKEY" ]; then
echo CNODECOLDSKEY env variable set to $CNODECOLDSKEY
echo what is the directory absolute path for cnode cold skey directory and file of vkey you w
read cold_skey
fi
vrf_vkey=$CNODEVRFVKEY
if [ -z "$CNODEVRFVKEY" ]; then
echo CNODEVRFVKEY env variable set to $CNODEVRFVKEY
echo what is the directory absolute path for cnode vrf vkey directory and file of vkey you w
read vrf_vkey
fi
# STEP 1 generate a registration certificate for your pool
echo what do you want to name your pool cert, end with .cert
read poolcert
cardano-cli shelley stake-pool registration-certificate \
--stake-pool-verification-key-file $cold_vkey \
--vrf-verification-key-file $vrf_vkey \
--pool-pledge 9900000000 \
--pool-cost 256000000 \
--pool-margin 0.07 \
--reward-account-verification-key-file $staking_vkey \
--pool-owner-staking-verification-key $staking_vkey \
--out-file $pool_dir$poolcert
# STEP 2 Delegate some stake to stake pool
echo what do you want to name the delegation cert end with .cert
read delegationcert
cardano-cli shelley stake-address delegation-certificate \
--staking-verification-key-file $staking_vkey \
--stake-pool-verification-key-file $cold_vkey \
--out-file $pool_dir$delegationcert
# STEP 3 Register the pool online
echo lets calculate the necassary fees, first lets find protocol parameters
echo and put them in the protocol.json
cardano-cli shelley query protocol-parameters \
--testnet-magic $networkmagic > protocol.json
echo pool deposit fee in lovelace $(cat protocol.json | grep poolDeposit)
echo please enter it here
read pooldepositfee
echo how many slots do you want the transaction to have time to live before going invalid
cardano-cli get-tip --testnet-magic $networkmagic > gettipfile
currentslot=$(awk 'NR==5 {print $2}' gettipfile)
echo keep in mind the current slot is $currentslot and the slot number should be higher than this
read ttl
echo what staking payment signig key will you use for paying the transaction .skey file ending?
echo $(find $staking_dir*.skey)
echo name of input addr .skey file
read pay_addr_skey
echo what staking payment address will you use for paying fees in ADA and name with .addr?
echo $(find $staking_dir*.addr)
read pay_addr
pay_actual_addr=$(cat $staking_dir$pay_addr)
echo lets look at the TxHash of address and select one
cardano-cli shelley query utxo \
--address $(cat $staking_dir$pay_addr) \
--testnet-magic $networkmagic > txhashfile
awk '{print NR, $1, $2, $3,"\n"}' txhashfile
echo select line number for account you want to use
read txhashnumber
txhash=$(awk 'NR=="'"$txhashnumber"'" {print $1}' txhashfile)
txix=$(awk 'NR=="'"$txhashnumber"'" {print $2}' txhashfile)
addr_lovelace=$(awk 'NR=="'"$txhashnumber"'" {print $3}' txhashfile)
addr_ada=$(awk 'NR=="'"$txhashnumber"'" {print $3/1000000}' txhashfile)
echo you will use $txhash TxHash and TxIx $txix
echo account has $addr_lovelace number of lovelace or $addr_ada ADA
echo now lets calculate the minimum fees
cardano-cli shelley transaction calculate-min-fee \
--tx-in-count 1 \
--tx-out-count 1 \
--ttl $ttl \
--testnet-magic $networkmagic \
--signing-key-file $staking_dir$pay_addr_skey \
--signing-key-file $cold_skey \
--signing-key-file $staking_skey \
--certificate $pool_dir$poolcert \
--certificate $pool_dir$delegationcert \
--protocol-params-file protocol.json > minfeefile
min_fee=$(awk 'NR==1 {print $2}' minfeefile)
min_fee_ada=$(awk 'NR==1 {print $2/1000000}' minfeefile)
echo minimum fee $min_fee lovelace or $min_fee_ada ADA
let fee_total=min_fee+pooldepositfee
let fee_total_ada=fee_total/1000000
let lovelace_left=addr_lovelace-fee_total
let ada_left=lovelace_left/1000000
echo the lovelace that will be left in the account is $lovelace_left or $ada_left ADA
echo this is after payting $fee_total lovelace or $fee_total_ada ADA
echo from account address $pay_actual_addr
echo please confirm by hitting enter or abort with ctrl c
read hitenter
sleep 1
echo we are building the transaction now
cardano-cli shelley transaction build-raw \
--tx-in $txhash#$txix \
--tx-out $pay_actual_addr+$lovelace_left \
--ttl $ttl \
--fee $min_fee \
--tx-body-file tx001.raw \
--certificate $pool_dir$poolcert \
--certificate $pool_dir$delegationcert
sleep 1
echo we are now signing the transaction
cardano-cli shelley transaction sign \
--tx-body-file tx001.raw \
--signing-key-file $staking_dir$pay_addr_skey \
--signing-key-file $cold_skey \
--signing-key-file $staking_skey \
--testnet-magic $networkmagic \
--tx-file tx001.signed
sleep 1
echo we are now submitting the transaction
cardano-cli shelley transaction submit \
--tx-file tx001.signed \
--testnet-magic $networkmagic
echo we did it!
sleep 2
cat << "EOF"
''''''''''''''''''''''''''''''''''...'''...............':!;>*|||||?r:,...................................................................................
'''''''''''''''''''''.'''''.''''''...''..''.'.........'>zvz7)LLL7vvtuuz?:'...............................................................................
''''''''''''''''''''''''''''''''.........'..''.........,!*vv7cL)77cL\L7zuCc?!,...........................................................................
'''''''''''''''''''''''.'''.'''..'........'...............'~>lv)c)iL\||\LczCyos>,........................................................................
''''''''''''''''''''''''...'.'''''..........................'*vc)LL/\|**?\)JjaXAXv*^!:~",,,,,''..........................................................
''''''''''''''''''''''''''''''''''.....'.................'...:z777cL//LvCo4wXkkEXww4aaaaooaooojFzv)/|>;:,'...............................................
'''''''''''''''''''''''''''.''''''''.......'................';szsJ}FoewwwwXXww44eaaoSjjuujjjyoooaaa4wwXXeotL?!~''........................................
'''''''''''''''''''''''''''''''''''''.''..'''.''...'.......,>zjoewXXw4aaaaoooyjuC{s7)icllcl77vzsst}CujoaewwkAAXaF/;~'....................................
''''''''''''''''''''''''''''''''''''''''.'''''''....'....~|j444a4wXw4aojF{z7L/L/LiL/Li)iic)c)LiLiiLi)cc7vtCuja4XkUU6wu\!,'...............................
''''''''''''''''''''''''''''''''''''''''.'''''........':\oaaaaaaaoyuJv)iiLLLL/\\\///LLLLL/LL/////LLLLLL/Lic7vtFjSawXUpK$4J*:''...........................
''''''''''''''''''''''''''''''''''''''''''''''''''''':\jooaooyFCsz7v77777)L/|*>*?|||||||||||||||||||||\\\/LLLi7ztFjoa4X6pKpwj/!,,........................
'''''''''''''''''''''''''''''''''''''''''''''.''..':LuoaoSuFtzv77vvvcLL\|?>r^!!!:!;r^!!::!!!;;!!;;;;^^rr>>>>>**|\LlsujyoawkpKp4{z^:'.....................
'''''''''''''''''''''''''''''''''''''''''''''.''':\joSjuu{zvv7c7)/\|||?>r;;;!:~,,:::` '````,,~:~~:::::!!!!!!!!!;;;^r|7CFFjoawApK6o{r"....................
'''''''''''''''''''''''''''''''''''''''''''''',;7jjuuFtz7lccL\||??**??**rr^;;!:::::",,,"~~:::::::!!!!;;;;!!!!!;;;;!!^|)i7JuSaewXAUXoz>:'.................
'''''''''''''''''''''''''''''''''''''''''''',>tjuusvz7)iL/\\|?*****???*>r;!!::::::::::::::!!!!!!!;^^^r^r^^;!!;^>>*>>**|*|LzFjoe44wwww4u/,.............`..
'''''..''''''''''''''''''''''''''''''''''',*tFCF}z7LL/\|||?*|||||/\|>rr^^^^;;^^^^^^^r^^^^^rr>>*****r^;;^^r^!;^rr>>*||*>r>|L7JFjoew4aawAAu\,..............
''''''''''''..'''''''''''''''''''''''''':/{cCtz7i///\????||Llsts7L|>rr>>***|||?||\\\/|/\\||//Lici/\?>^;;^rrr>?|?>>**>rrr>>>|/lsFSaeeww4w$Ao>,............
'''''''''''''''''''''''''''''''''''''':\}}Jlz7L//\\|??|\/7tFu}vL|>^^^>|\/LiLci)i)lll7cvvll)L|\\cv\*>*?rr^rr>>r>>rrrr^r>>>>>>>>|L7suawwaeewU$j!'..........
'''''''''''''''''''''''''''''''''''',|{tsJzli/\\||?|\/7tFFz)/|*>r^;r|L77vlL|||\/Llvv7v7Ll77cLc7}us/|r**r!;^^^;^rr>>*|\LL/\\\\*;!;?LvuawwwaoEKA?'.........
'''''''''''''''''''''''''''''''''''^z{zvvlL/\|***?\L7c)L|?^!;rr>*|>?|||*****|\l7zz77zszzJFuuyu}JzzzvL|>;r!~:>|/////7{FC{}{}tzcLzEkXoztja44aowOU7,........
''''''''''''''''''''''''''.'''''',LJzzv7L\|?>r>?\L7v)>!:::~:!;;!!^???*>r>?|||\uoaXkEXwaaoyuFCJz7777vvv)\|*\Lv}tta4jyjuFuFv77LLlzueoujouFyoooyepqC,.......
'''''''''''''''''''''''''''''''':Lzvz7)\|?>r>|L77cl/?!:~~"::::!^>|L)l7vvvtuSoSojuSSuuSoooSuF}zv777vstFuCJztj4Ab8NN%UweeEs77)L\|**>|Lvua4aooaoS4qOu,......
'''''''''''''''''''''''''''''''!vv7v7i|*>r**?/LLLlL?!:,,,"::;>/sj4kU$qpKbbbbHDdKKbddpwoSjuuu}sszzs}Fj4$b%WNBQBBBNDHKppq47s7i))/|*?>*\vuyaaew4aakOD{'.....
''''''''''''''''''''''''''''',|zv)vcL|>>?||\/))/LL|::,~:!>LJjaXpbdHDDDdpXXXajC7L||>^;!!!::!!!!!!!!^uN@@QQQQQQQQQQB#NRDDKAk4juuJ7iL|*|iFojSoaaa4XpDH!.....
''''''''''''''''''''''''''''!7zc77)\?||/L\?|L7)ivC\|/)zj4AqKOdbbKXjv*!,'''''''''''''''''''''':^|tUQQQQQQQQQQQ##BBQQQQd>:!r?iuwj77{}zvvv7CuCuowqKKDNs'..'.
''''''''''''''''''''''''''';zzi7vl|||LL|?\Li7}aUdASSo4wwaj}s7\r!:'''''''''''''''''''''''',a%NBQQQQQQQQQQ#QB####gWBQA?'''''''':>|Lz7LL)ii/L77cvyAdNQF''''.
''''''''''''''''''''''''''rzvcl7l\||\\|?Lvzv}4DgRbKv*!:~''''''''''''''''''''''''''''''''''!FKBQQQQQQQBBBNRRNN#BBOF!''''''''''''''~;>|L\||||\L/LFXK%F'''''
'''''''''''''''''''''''''>z7i)cl/||\\|\)J}}op8RddF;,'''''''''''''''''''''''''''''''''''''''''~rLFa6DNBQBWHKXSv|:''''''''''''''''''''',!^?/L|?\LLvowXv,'''
''''''''''''''''''''''''^J7cc7L\\|\/\iv{uaEd88Ku^,'''''''''''''''''''''''''''''''''''''''''''''''''',:::,''''''''''''''''''''''''''''''''':;*LLL\|i}au~''
'''''''''''''''''''''''!zv)L)7)LiLv)7JjeAdRKo\:'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''',;\c|;*uD/''
''..''''''''''''''''''!zz)c77)LLLvc7toEqEoJ*,,'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''':>>\}4!''
''''''''''''''''''''',\zcicv7LL/)lcCowXS?:,''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''":"'''
'''''''''''''''''''':vC7lc7iLLL\)vuauus!,''''''',''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''',\u{vv7)LLL/z}C)L{/~''''''''',''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''!Fjtvz7LLiLvu}z7}!,'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''',',\yutssci)iz{zc7\~','''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''',''',,'':CyutCsc/\vuzl{c,,,,'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
',,,'',,'',,'''','!ujuF}z7)lzJvF/~,,,,,,',,''',,,,',,''',''''''''''',',,'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
,,,,,,,,,,,''''''';uujutvzlc7Jy|,,,,,,,,,,,,,,,,,,,,'',,,'',,,'',,,',',,,',,'',''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
,,,,,,,',',,,''',,>jjyuvvzvsto|,,,,~,,,,,,,,,,,,,',,,',,,,,,,''',,,,,,,,,,,,,,'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
,,,,,,,,,,''''',,'^uuj}vzizsa>,,,,,,',,,,,,,,,,,,,,,,,,,,,,'',,,,,,,,,,,,,,,,,,,,,,',,,,,,,,'',',,'''''''''''''''''''''''''''''''''''''''''''''''''''''''
,,,,'',,',',''''''!uuSa4usvo\,,,,',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,',,,,''',,,,'',,''''''''''''''''''''''''''''''''''''''''''
,,,,,,',',',',,,,'!aeUDdaJjL,,,,,,',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,',,,,,,,',',''''''''',,''''''''''''''''''''''''''
,,,,,',,,,,,,'':|od#QQQgyaL,,,,,,,',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,',,,,,,,',,,,,,,,,,,',,'''',,'',,,,''''',''',,,,,
,,,,,,,,,',:>FKQQQQ@@@@pU#a!,','',',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,',',,',,,,,,
,,,,,,,,">FRQ@@@@@@@@@QNQQWj*',,,',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,',,,,,,,
,,,,,,:|AQ@@@@@@@@@@@@QQQ#RDXL:,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,:LHQ@@@@@@@@@@@@@@@@@@QQD8F",,,,,,,,,,,,',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
CzJ}{|sLL/?*>r;!^!r>:~':::!:7H@@QXLlzzv7lzJ{uuuFtJJzzzttJszzzvzzzszv7z7vzzvvvv7777v7l)LLL///Li)L//\\|||/L)i\||\|\|\\||//|||\\\\\|?*??||?****>>>r>rrrrrr>r
jjuut7s|\{L/|)?:>\*:!:!!*>:~*LN@Qw}F{{7czCvCFuuyyuFF}FFFuC{}{tzz}{tJ{FFszvci7zzzzssszJzssvcL7zv)LLLL/LLll7iicl7li/LL//\\|\||||||||?|||\|||>^rr>>rrrrrr>*^
EOF
echo goodbye and thanks for the fish!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment