How to register pool stake address?
Closed this issue · 1 comments
I've done the following -->
Create a registration certificate:
cardano-cli stake-address registration-certificate \
--stake-verification-key-file operator-stake.vkey \
--out-file stake.cert
should create stake.cert file.
Get Testnet coins to the payment address
First check your payment address
cat operator-payment.addr
Then navigate to the link and get coins -->
https://testnets.cardano.org/en/testnets/cardano/tools/faucet/
Get the transaction hash and index of the UTXO to spend
cardano-cli query utxo \
--address $(cat operator-payment.addr) \
--testnet-magic 1097911063
example return:
TxHash TxIx Amount
--------------------------------------------------------------------------------------
91575bdfbd33da1890510c95e4c1bf0190eefcaaa0575859f931a3fe2e8fc8b7 0 1000000000 lovelace + TxOutDatumNone
Draft the transaction
cardano-cli transaction build-raw \
--tx-in "91575bdfbd33da1890510c95e4c1bf0190eefcaaa0575859f931a3fe2e8fc8b7#0" \
--tx-out $(cat operator-payment.addr)+0 \
--ttl 0 \
--fee 0 \
--certificate-file stake.cert \
--out-file tx.draft \
--alonzo-era \
--cddl-format
In --tx-in you should copy the UTXO from the previous query and the index.
This should create tx.draft file.
Calculate the fee
cardano-cli transaction calculate-min-fee \
--tx-body-file tx.draft \
--tx-in-count 1 \
--tx-out-count 1 \
--witness-count 2 \
--byron-witness-count 0 \
--testnet-magic 1097911063 \
--protocol-params-file protocol.json
example return:
179317 Lovelace
Determine the TTL for the transaction
cardano-cli query tip --testnet-magic 1097911063
example return:
{
"era": "Alonzo",
"syncProgress": "100.00",
"hash": "67fbefa101bbaff391c6f6954c5e9976bd4090c487b749715c075d435782d71f",
"epoch": 211,
"slot": 60885379,
"block": 3631745
}
Now you have got to get the TTL to make your transaction live, it should be the slot from the query + 400.
expr 60885379 + 400
Build the transaction
In the previous step we have calculated the TTL but we still did not calculate the remaining amount of the UTXO retracted the poolDeposit. You can find the stakeAddressDeposit amount in the protocol.json.
expr 1000000000 - 2000000 - 179317
cardano-cli transaction build-raw \
--tx-in "91575bdfbd33da1890510c95e4c1bf0190eefcaaa0575859f931a3fe2e8fc8b7#0" \
--tx-out $(cat operator-payment.addr)+997820683 \
--ttl 60886964 \
--fee 179317 \
--certificate-file stake.cert \
--out-file tx.raw \
--alonzo-era \
--cddl-format
Transform the transaction
HW wallets expect the transaction CBOR to be in canonical format (see CIP-0021). Unfortunately, cardano-cli sometimes produces tx files not compliant with CIP-0021. Use the following command to fix the formatting issues.
cardano-hw-cli transaction transform \
--tx-file tx.raw \
--out-file tx.transformed
Witness the transaction
cardano-hw-cli transaction witness \
--tx-file tx.transformed \
--hw-signing-file operator-payment.hwsfile \
--hw-signing-file operator-stake.hwsfile \
--testnet-magic 1097911063 \
--out-file payment.witness \
--out-file stake.witness
Assemble the transaction
cardano-cli transaction assemble \
--tx-body-file tx.transformed \
--witness-file payment.witness \
--witness-file stake.witness \
--out-file tx.signed
Submit the transaction
cardano-cli transaction submit \
--tx-file tx.signed \
--testnet-magic 1097911063
What am I doing wrong?
The solution was this -->
Witness the transaction
cardano-hw-cli transaction witness \
--tx-file tx.transformed \
--hw-signing-file operator-payment.hwsfile \
--hw-signing-file operator-stake.hwsfile \
--testnet-magic 1097911063 \
--out-file reg.witness