Skip to content

Commit

Permalink
Merge #2435
Browse files Browse the repository at this point in the history
2435: Update SPO Docs r=Jimbo4350 a=Jimbo4350



Co-authored-by: [PCT] 0 Percent Pool <ryan@0percentpool.dev>
  • Loading branch information
iohk-bors[bot] and [PCT] 0 Percent Pool committed Mar 3, 2021
2 parents 112c487 + 8ae31c3 commit 8b1c229
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 95 deletions.
6 changes: 3 additions & 3 deletions doc/stake-pool-operations/KES_period.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ We check the current tip of the blockchain:
cardano-cli query tip --mainnet

{
"blockNo": 36914,
"headerHash": "58df595137e71c0fa65edc99add11704b00e5f163475bd804e4bd59c126bfc9b",
"slotNo": 8520857
"blockNo": 36914,
"headerHash": "58df595137e71c0fa65edc99add11704b00e5f163475bd804e4bd59c126bfc9b",
"slotNo": 8520857
}

In this example, we are currently in slot 8520857, and we know from the genesis file that one period lasts for 129600 slots. So we calculate the current period by
Expand Down
24 changes: 12 additions & 12 deletions doc/stake-pool-operations/core_relay.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ Make the __block-producing__ node to "talk" only to __YOUR__ relay node. Do not

nano mainnet-topology.json

{
"Producers": [
{
"addr": "<RELAY IP ADDRESS",
"port": <PORT>,
"valency": 1
}
]
}
{
"Producers": [
{
"addr": "<RELAY IP ADDRESS>",
"port": <PORT>,
"valency": 1
}
]
}

#### Configure the relay node:

Expand All @@ -28,8 +28,8 @@ Make your __relay node__ `talk` to your __block-producing__ node and __other rel
{
"Producers": [
{
"addr": "<BLOCK-PRODUCING IP ADDRESS",
"port": PORT,
"addr": "<BLOCK-PRODUCING IP ADDRESS>",
"port": <PORT>,
"valency": 1
},
{
Expand All @@ -38,7 +38,7 @@ Make your __relay node__ `talk` to your __block-producing__ node and __other rel
"valency": 1
},
{
"addr": "<IP ADDRESS",
"addr": "<IP ADDRESS>",
"port": <PORT>,
"valency": 1
}
Expand Down
6 changes: 3 additions & 3 deletions doc/stake-pool-operations/getConfigFiles_AND_Connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ Check that the node is syncing by fetching the current tip. When syncing slotNo
cardano-cli query tip --mainnet

{
"blockNo": 36322,
"headerHash": "3f1bea22be21452415851ae670f4bac9340471cb7f2f6a664fac56d7f60dbaad",
"slotNo": 888561
"blockNo": 36322,
"headerHash": "3f1bea22be21452415851ae670f4bac9340471cb7f2f6a664fac56d7f60dbaad",
"slotNo": 888561
}

**Note**`--mainnet` identifies the Cardano mainnet, for testnets use `--testnet-magic 1097911063` instead.
5 changes: 3 additions & 2 deletions doc/stake-pool-operations/keys_and_addresses.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ To query the balance of an address we need a running node and the environment va
```
cardano-cli query utxo \
--address $(cat payment.addr) \
--mainnet
--mainnet \
--mary-era
```
```
TxHash TxIx Lovelace
TxHash TxIx Amount
--------------------------------------------------------------------------------------------
```

Expand Down
12 changes: 6 additions & 6 deletions doc/stake-pool-operations/node_keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ Then we need the current tip of the blockchain:

cardano-cli query tip --mainnet
{
"blockNo": 36929,
"headerHash": "44c2a2be237ea485c15bf2a50c12b4d2aabe6d4233cb1b2131efc080615a17d0",
"slotNo": 906528
"blockNo": 36929,
"headerHash": "44c2a2be237ea485c15bf2a50c12b4d2aabe6d4233cb1b2131efc080615a17d0",
"slotNo": 906528
}

Look for Tip `slotNo` value. In this example we are on slot 906528. So we have KES period is 120:
Look for Tip `slotNo` value. In this example we are on slot 906528. So we have KES period is 251:

expr 432571 / 3600
expr 906528 / 3600
> 251

To generate the certificate:
Expand All @@ -85,7 +85,7 @@ To generate the certificate:
--kes-verification-key-file kes.vkey \
--cold-signing-key-file cold.skey \
--operational-certificate-issue-counter cold.counter \
--kes-period 120 \
--kes-period 251 \
--out-file node.cert

#### Move the cold keys to secure storage and remove them from your local machine.
Expand Down
17 changes: 9 additions & 8 deletions doc/stake-pool-operations/register_key.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ For the transaction draft, --tx.out, --invalid-hereafter and --fee can be set to
--tx-out $(cat payment.addr)+0 \
--invalid-hereafter 0 \
--fee 0 \
--out-file tx.raw \
--out-file tx.draft \
--certificate-file stake.cert

#### Calculate fees

cardano-cli transaction calculate-min-fee \
--tx-body-file tx.raw \
--tx-body-file tx.draft \
--tx-in-count 1 \
--tx-out-count 1 \
--witness-count 1 \
--witness-count 2 \
--byron-witness-count 0 \
--mainnet \
--protocol-params-file protocol.json
Expand All @@ -40,7 +40,7 @@ The output is the transaction fee in lovelace:

Registering the stake address, not only pay transaction fees, but also includes a _deposit_ (which you get back when deregister the key) as stated in the protocol parameters:

The deposit amount can be found in the `protocol.json` under `keyDeposit`, for example in Shelley Tesntet:
The deposit amount can be found in the `protocol.json` under `keyDeposit`, for example in Shelley Mainnet:

...
"keyDeposit": 2000000,
Expand All @@ -50,17 +50,18 @@ Query the UTXO of the address that pays for the transaction and deposit:

cardano-cli query utxo \
--address $(cat payment.addr) \
--mainnet
--mainnet \
--mary-era

> TxHash TxIx Lovelace
> TxHash TxIx Amount
> ----------------------------------------------------------------------------------------
> b64ae44e1195b04663ab863b62337e626c65b0c9855a9fbb9ef4458f81a6f5ee 1 1000000000
> b64ae44e1195b04663ab863b62337e626c65b0c9855a9fbb9ef4458f81a6f5ee 1 1000000000 lovelace

#### Calculate the change to send back to payment address after including the deposit

expr 1000000000 - 171485 - 2000000

> 999428515
> 997828515

#### Submit the certificate with a transaction:

Expand Down
38 changes: 19 additions & 19 deletions doc/stake-pool-operations/register_stakepool.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ Make sure you have access to:

Registering your stake pool requires:

* Create JSON file with your metadata and store it in the node and in a url you maintain.
* Create JSON file with your metadata and store it in the node and in a url you maintain
* Get the hash of your JSON file
* Generate the stake pool registration certificate
* Create a delegation certificate pledge
* Submit the certificates to the blockchain

**WARNING:** Generating the **stake pool registration certificate** and the **delegation certificate** requires the **cold keys** So, when doing this on mainnet you may want to generate these certificates in your local machine taking the proper security measures to avoid exposing your cold keys to the internet.
**WARNING:** Generating the **stake pool registration certificate** and the **delegation certificate** requires the **cold keys**. So, when doing this on mainnet you may want to generate these certificates in your local machine taking the proper security measures to avoid exposing your cold keys to the internet.

#### Create a JSON file with your pool's metadata

Expand Down Expand Up @@ -70,27 +70,27 @@ This validates that the JSON fits the required schema, if it does, you will get

| Parameter | Explanation |
| :--- | :--- |
| stake-pool-verification-key-file | verification _cold_ key |
| cold-verification-key-file | verification _cold_ key |
| vrf-verification-key-file | verification _VRS_ key |
| pool-pledge | pledge lovelace |
| pool-cost | operational costs per epoch lovelace |
| pool-margin | operator margin |
| pool-reward-account-verification-key-file | verification staking key for the rewards |
| pool-owner-staking-verification-key-file | verification staking keys for the pool owners |
| out-file | output file to write the certificate to |
| pool-relay-port | port |
| pool-relay-ipv4 | relay node ip address |
| pool-relay-port | port |
| metadata-url | url of your json file |
| metadata-hash | the hash of pools json metadata file |
| out-file | output file to write the certificate to |

**You can use a different key for the rewards, and can provide more than one owner key if there were multiple owners who share the pledge.**

The **pool-registration.cert** file should look like this:


type: StakePoolCertificateShelley
title: Free form text
cbor-hex:
type: CertificateShelley
description: Stake Pool Registration Certificate
cborHex:
18b58a03582062d632e7ee8a83769bc108e3e42a674d8cb242d7375fc2d97db9b4dd6eded6fd5820
48aa7b2c8deb8f6d2318e3bf3df885e22d5d63788153e7f4040c33ecae15d3e61b0000005d21dba0
001b000000012a05f200d81e820001820058203a4e813b6340dc790f772b3d433ce1c371d5c5f5de
Expand All @@ -106,7 +106,7 @@ To honor your pledge, create a _delegation certificate_:
--cold-verification-key-file cold.vkey \
--out-file delegation.cert

This creates a delegation certificate which delegates funds from all stake addresses associated with key `stake.vkey` to the pool belonging to cold key `cold.vkey`. If we there are many staking keys as pool owners in the first step, we need delegation certificates for all of them.
This creates a delegation certificate which delegates funds from all stake addresses associated with key `stake.vkey` to the pool belonging to cold key `cold.vkey`. If there are many staking keys as pool owners in the first step, we need delegation certificates for all of them.

#### Submit the pool certificate and delegation certificate to the blockchain

Expand All @@ -115,7 +115,7 @@ To submit the `pool registration certificate` and the `delegation certificates`
#### Draft the transaction

cardano-cli transaction build-raw \
--tx-in <UTXO>#<TxIx> \
--tx-in <TxHash>#<TxIx> \
--tx-out $(cat payment.addr)+0 \
--invalid-hereafter 0 \
--fee 0 \
Expand All @@ -126,34 +126,34 @@ To submit the `pool registration certificate` and the `delegation certificates`
#### Calculate the fees

cardano-cli transaction calculate-min-fee \
--tx-body-file tx.raw \
--tx-body-file tx.draft \
--tx-in-count 1 \
--tx-out-count 1 \
--mainnet \
--witness-count 1 \
--witness-count 3 \
--byron-witness-count 0 \
--mainnet \
--protocol-params-file protocol.json

For example:

> 184685

Registering a stake pool requires a deposit. This amount is specified in `protocol.json` . For example, for Shelley Testnet we have:
Registering a stake pool requires a deposit. This amount is specified in `protocol.json`. For example, for Shelley Mainnet we have:

"poolDeposit": 500000000

#### Calculate the change for --tx-out
All amounts in Lovelace

expr <UTxO BALANCE> - <poolDeposit> - <FEE>
expr <UTxO BALANCE> - <poolDeposit> - <TRANSACTION FEE>

#### Build the transaction:

cardano-cli transaction build-raw \
--tx-in <UTXO>#<TxIx> \
--tx-in <TxHash>#<TxIx> \
--tx-out $(cat payment.addr)+<CHANGE IN LOVELACE> \
--invalid-hereafter <TTL> \
--fee <FEE> \
--fee <TRANSACTION FEE> \
--out-file tx.raw \
--certificate-file pool-registration.cert \
--certificate-file delegation.cert
Expand All @@ -179,8 +179,8 @@ All amounts in Lovelace

Get Pool ID

cardano-cli stake-pool id --verification-key-file cold.vkey
cardano-cli stake-pool id --cold-verification-key-file cold.vkey

Check for the presence of your poolID in the network ledger state, with:

cardano-cli query ledger-state --mainnet | grep publicKey | grep <poolId>
cardano-cli query ledger-state --mainnet --mary-era | grep publicKey | grep <poolId>

0 comments on commit 8b1c229

Please sign in to comment.