# Home

Cardano guides, links and tools

{% content-ref url="/pages/-MJr5TNpMuZj8X1\_wgL9" %}
[Stakepool Operator tools](/stake-pool-operator-tools/stakepool-sites)
{% endcontent-ref %}

{% content-ref url="/pages/-MJr5TNqgqO65-e7nsmf" %}
[Leader Log Scripts](/stake-pool-operator-tools/leader-log-scripts)
{% endcontent-ref %}

{% hint style="info" %}
This site is designed to bring together guides, links and tools from the Cardano community into one place to help those who want to know about Cardano or want to get started with becoming a Stake Pool Operator.

Thank you for your continued support.  Love2 hear any feedback via our [telegram channel ](https://t.me/Love2Stake)as your experience will help others who read and use this site.&#x20;
{% endhint %}

{% hint style="info" %}
&#x20;If you find the contents useful, then please consider supporting by either delegating your ADA to ticker **Love2** or sending ADA to the following address - `addr1qy2jswg2xfca87h79050dzgj0yup69u9gpclwn9jl2g5tlfvaj6kvenchu5gwxlfhffysxsnekq6kh4z7yq758w2x3gq7xc7sn`&#x20;
{% endhint %}

&#x20; &#x20;


# Daedalus wallet

{% content-ref url="/pages/-MI5asT\_9Am1JgqPXCHT" %}
[How to install Daedalus](/cardano-wallets/daedalus-wallet/how-to-install-daedalus)
{% endcontent-ref %}

{% content-ref url="/pages/-MI5deKFbEpJPQnNX6UT" %}
[How to create Wallet](/cardano-wallets/daedalus-wallet/how-to-create-wallet)
{% endcontent-ref %}

{% content-ref url="/pages/-MI95k5inKBoRic3Z3Mf" %}
[How to transfer ADA to Wallet](/cardano-wallets/daedalus-wallet/how-to-transfer-ada-to-wallet)
{% endcontent-ref %}

{% content-ref url="/pages/-MI95QiMc3ssztCROEKq" %}
[How to delegate your ADA](/cardano-wallets/daedalus-wallet/how-to-delegate-your-ada)
{% endcontent-ref %}


# How to install Daedalus

Please ensure you download the Daedalus wallet from the [official website](https://daedaluswallet.io/en/download/).&#x20;

Do not download any wallets from third party websites.  There are scammers out there, trying to trick you into revealing your passphrase or asking you to send your ADA to them to stake.&#x20;

The ADA in your wallet, does not leave your wallet once it is delegated. You remain in complete control.  Please be vigilant and do not be fooled as cryptocurrency is not regulated.

> "If you buy these types of cryptoassets, you are unlikely to have access to the [Financial Ombudsman Service](https://www.financial-ombudsman.org.uk/) or the [Financial Services Compensation Scheme (FSCS)](https://www.fscs.org.uk/) if something goes wrong."  - [*https://www.fca.org.uk/*](https://www.fca.org.uk/)

Download the appropriate Daedalus wallet for your operating system. For the purpose of this exercise we are downloading **Windows 8.1 and 10, 64 bit**.  Time of download version was 2.2.0.

![](https://3006678834-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI5anYFP0lA9tWOsWa-%2F-MI5arGvyyImHQIvAds6%2F-MI5b2B7ia43br1u6r0h%2Fimage.png?alt=media\&token=f5936238-5325-472f-b092-48c4eabfedc4)

Once the file has been downloaded, locate the file and double click the executable - **daedalus-2.2.0-mainnet-14276.exe**&#x20;

You maybe prompted by a “User Account Control Message” stating that “iohk signed file” would like to make changes to your device. Click Yes

![](https://3006678834-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI5anYFP0lA9tWOsWa-%2F-MI5arGvyyImHQIvAds6%2F-MI5cRZcJLOXAfluBG17%2Fimage.png?alt=media\&token=d06e7209-1697-4a4c-8967-f5e7bfdc496e)

Click Install.  *We recommend installing, to the default file location.*

![](https://3006678834-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI5anYFP0lA9tWOsWa-%2F-MI5arGvyyImHQIvAds6%2F-MI5cKnt356TLKco4r48%2Fimage.png?alt=media\&token=f2ccf447-385c-4ad8-956c-67027ff37ce5)

Click Close.  *You will now notice a new shortcut on your desktop.*

![](https://3006678834-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI5anYFP0lA9tWOsWa-%2F-MI5arGvyyImHQIvAds6%2F-MI5bwbhC9okX5_kr2jM%2Fimage.png?alt=media\&token=9ba866e8-7945-4433-a11b-25ab7460a796)

Double click the Daedalus Mainnet icon and the wallet will launch.&#x20;

As the application is communicating with the outside world, you will receive a “Windows Security Alert” or an alert from your Anti Virus software – Click Allow access.

![](https://3006678834-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI5anYFP0lA9tWOsWa-%2F-MI5arGvyyImHQIvAds6%2F-MI5c7A-cO_5zvhL0Dua%2Fimage.png?alt=media\&token=4570de96-c135-44a4-97bd-1c06cc2b8c57)

The wallet will require some customisation.  The default settings are sufficient for our requirement&#x20;

![](https://3006678834-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI5anYFP0lA9tWOsWa-%2F-MI5arGvyyImHQIvAds6%2F-MI5cp4p4SHERArAgeSr%2Fimage.png?alt=media\&token=69c91246-815e-4e95-8379-d3fe38f3f5f7)

Continue reading through the terms and conditions and tick "I agree with the terms of service" and then click "Continue"

![](https://3006678834-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI5anYFP0lA9tWOsWa-%2F-MI5arGvyyImHQIvAds6%2F-MI5cuoWKDpER0juvJrR%2Fimage.png?alt=media\&token=9556c53b-d9e9-436e-b3fd-629c4c324f62)

The Daedalus will sync in the background, depending on the speed of your internet and the size of the blockchain.  Expect this process to take several hours.

![](https://3006678834-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI5anYFP0lA9tWOsWa-%2F-MI5arGvyyImHQIvAds6%2F-MI5d9dZmhF03RsnYTx8%2Fimage.png?alt=media\&token=f8eab919-c487-43ae-88c8-1f01c5c16d7b)

{% hint style="success" %}
*Congratulation as you have successfully installed Daedalus*
{% endhint %}

{% hint style="info" %}
If you find the contents useful, then please consider supporting by either delegating your ADA to ticker **Love2** or sending ADA to the following address - `addr1qy2jswg2xfca87h79050dzgj0yup69u9gpclwn9jl2g5tlfvaj6kvenchu5gwxlfhffysxsnekq6kh4z7yq758w2x3gq7xc7sn`
{% endhint %}


# How to create Wallet

{% hint style="info" %}
Now you have accomplished the installed of Daedalus, lets look at how to delegate your ADA in Daedalus.
{% endhint %}

Double click the **Daedalus Mainnet** icon and the wallet will launch.  If it requires syncing let that complete before continuing.

![](https://3006678834-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI5anYFP0lA9tWOsWa-%2F-MI5jJo0EEFOo_-pbvlo%2F-MI5lcA6jGxOrDI35Agg%2Fimage.png?alt=media\&token=bcd4be06-b874-40a9-9e5a-ccdf5a4ae4a7)

Click on **Create**&#x20;

![](https://3006678834-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI5anYFP0lA9tWOsWa-%2F-MI5jJo0EEFOo_-pbvlo%2F-MI5m3Ax6xYfoqMPN2HB%2Fimage.png?alt=media\&token=765c0e1d-3033-42cf-9386-0e80a1c13704)

Specify a **Wallet name** – minimum of 3 letters and a maximum of 40

The spending **password** is required, when sending funds and delegating – at least 10 characters long and special characters can be used.

![](https://3006678834-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI5anYFP0lA9tWOsWa-%2F-MI5jJo0EEFOo_-pbvlo%2F-MI5mkkkgq-jTe_K699a%2Fimage.png?alt=media\&token=93ecf500-9cf0-43d7-85cd-ada9e0240031)

The next step is VERY IMPORTANT and the message below should be digested.

![](https://3006678834-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI5anYFP0lA9tWOsWa-%2F-MI5jJo0EEFOo_-pbvlo%2F-MI5n1tuidV471P7TC0p%2Fimage.png?alt=media\&token=1e69878c-e405-4900-bb93-15edd822da76)

In the event of hardware failure or the computer that is storing the Daedalus wallet is destroyed. You will require the recovery phrase to reinstate your wallet.&#x20;

{% hint style="warning" %}
Do not take a screen print and keep it on the same computer that is hosting the wallet. Even if you delegate your ADA to a pool, the operator does not hold your ADA and is unable to assist you in retrieving your funds. I cannot reiterate how IMPORTANT the recovery phrase is.
{% endhint %}

![](https://3006678834-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI5anYFP0lA9tWOsWa-%2F-MI5jJo0EEFOo_-pbvlo%2F-MI5nRUrffRVmMUx2W86%2Fimage.png?alt=media\&token=5096d06c-0b34-4f6a-acf3-5348baf2e449)

You will be prompted to confirm the 24 word recovery phrase, once you have clicked **Yes, I have written down my wallet recovery phrase.**

![](https://3006678834-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI5anYFP0lA9tWOsWa-%2F-MI5jJo0EEFOo_-pbvlo%2F-MI5ngyVgNe7k164CupV%2Fimage.png?alt=media\&token=56f0bf49-6d08-41a5-b0e3-2ef4b78bb277)

Verify your recovery phrase.

![](https://3006678834-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI5anYFP0lA9tWOsWa-%2F-MI5jJo0EEFOo_-pbvlo%2F-MI5nuIhmifyQ2TrZknN%2Fimage.png?alt=media\&token=6ddef33d-dae0-41ea-9340-22724969074e)

You will need to tick both boxes and **Confirm**.   The Wallet will start syncing with the blockchain.

![](https://3006678834-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI5anYFP0lA9tWOsWa-%2F-MI5jJo0EEFOo_-pbvlo%2F-MI5oMVVcTI37pjQ6ppQ%2Fimage.png?alt=media\&token=55d1b566-2e69-45e0-b8d5-62124853de11)


# How to transfer ADA to Wallet


# How to delegate your ADA


# Mainnet

DRAFT


# Create Stakepool on Mainnet

How to build a Cardano Stake Pool on Mainnet

{% hint style="info" %}
If you want to know how to create a stake pool on Mainnet and see all the commands being executed then there is a fantastic guide by [Coincashew](https://www.coincashew.com/coins/overview-ada/guide-how-to-build-a-haskell-stakepool-node).

**Website:** <https://www.coincashew.com/coins/overview-ada/guide-how-to-build-a-haskell-stakepool-node>

**Telegram:** <https://t.me/coincashew>
{% endhint %}


# KES Renewal

Renewing cardano node operational certificate.

Before undertaking these steps the block producing node must be fully synchronised.  Otherwise, latest KES period cannot be calculated.  Please check block explorer such as <https://pooltool.io/> for latest epoch and slot number.

&#x20;Determine the number of slots per KES period from the genesis file:

```
slotsPerKESPeriod=$(cat $NODE_HOME/${NODE_CONFIG}-shelley-genesis.json | jq -r '.slotsPerKESPeriod')
echo slotsPerKESPeriod: ${slotsPerKESPeriod}
```

Find the Slot number:

```
slotNo=$(cardano-cli shelley query tip --mainnet | jq -r '.slotNo')
echo slotNo: ${slotNo}
```

Find the kesPeriod by dividing the slot tip number by the slotsPerKESPeriod:

```
kesPeriod=$((${slotNo} / ${slotsPerKESPeriod}))
echo kesPeriod: ${kesPeriod}
startKesPeriod=${kesPeriod}
echo startKesPeriod: ${startKesPeriod}
```

Ensure you have kes.vkey, node.skey and node.counter in place before creating the node operational certificate:

```bash
cardano-cli shelley node issue-op-cert \
    --kes-verification-key-file $HOME/bp-cold-keys/kes.vkey \
    --cold-signing-key-file $HOME/bp-cold-keys/node.skey \
    --operational-certificate-issue-counter $HOME/bp-cold-keys/node.counter \
    --kes-period <startKesPeriod> \
    --out-file node.cert
```

{% hint style="info" %}
With new node.cert, restart your block producer node.
{% endhint %}


# Testnet

DRAFT


# Create Stakepool on Testnet

How to create a stakepool on Testnet

## 1. Install Cabal, GHC and Set PATH

Update packages and install Ubuntu dependencies:

```
sudo apt-get update -y
sudo apt-get upgrade -y
GETPKG_LIST="aptitude autoconf bc build-essential curl g++ git gnupg htop jq libffi-dev libgmp-dev libncursesw5 libpq-dev libsystemd-dev libssl-dev libtinfo-dev libtinfo-dev libtool make pkg-config rsync secure-delete tcptraceroute tmux wget zlib1g-dev"
sudo apt-get -y install ${GETPKG_LIST}
```

Install Libsodium:

```bash
mkdir $HOME/git
cd $HOME/git
git clone https://github.com/input-output-hk/libsodium
cd libsodium
git checkout 66f017f1
./autogen.sh
./configure
make
sudo make install
```

Install Cabal:

```bash
cd
wget https://downloads.haskell.org/~cabal/cabal-install-3.2.0.0/cabal-install-3.2.0.0-x86_64-unknown-linux.tar.xz
tar -xf cabal-install-3.2.0.0-x86_64-unknown-linux.tar.xz
rm cabal-install-3.2.0.0-x86_64-unknown-linux.tar.xz cabal.sig
mkdir -p $HOME/.local/bin
mv cabal $HOME/.local/bin/
```

Install GHC:

```bash
wget https://downloads.haskell.org/~ghc/8.6.5/ghc-8.6.5-x86_64-deb9-linux.tar.xz
tar -xf ghc-8.6.5-x86_64-deb9-linux.tar.xz
rm ghc-8.6.5-x86_64-deb9-linux.tar.xz
cd ghc-8.6.5
./configure
sudo make install
```

Update PATH to include Cabal and GHC and add exports. Your node's location will be in $NODE\_HOME. The cluster configuration is set by $NODE\_CONFIG and $NODE\_BUILD\_NUM.

```bash
echo PATH="$HOME/.local/bin:$PATH" >> $HOME/.bashrc
echo export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" >> $HOME/.bashrc
echo export NODE_HOME=$HOME/cardano-my-node >> $HOME/.bashrc
echo export NODE_CONFIG=testnet>> $HOME/.bashrc
echo export NODE_BUILD_NUM=$(curl https://hydra.iohk.io/job/Cardano/iohk-nix/cardano-deployment/latest-finished/download/1/index.html | grep -e "build" | sed 's/.*build\/\([0-9]*\)\/download.*/\1/g') >> $HOME/.bashrc
source $HOME/.bashrc
```

Update cabal and verify the correct versions were installed successfully.

```bash
cabal update
cabal -V
ghc -V
```

## 9. Generate block producer keys

{% hint style="danger" %}
**Testnet** ADA do not have value and to ease the build all commands are assumed to be run on BP (Block Producer) node.   **Do not do this on your production stake pool.**&#x20;
{% endhint %}

The block-producer node requires you to create 3 keys as defined in the [Shelley ledger specs](https://hydra.iohk.io/build/2473732/download/1/ledger-spec.pdf):

1. stake pool cold key (`node.cert`)
2. stake pool hot key (`kes.skey`)
3. stake pool VRF key (`vrf.skey`)

First, make a KES key pair.

```bash
cd $NODE_HOME
cardano-cli shelley node key-gen-KES \
    --verification-key-file kes.vkey \
    --signing-key-file kes.skey
```

{% hint style="info" %}
KES (key evolving signature) keys are created to secure your stake pool against hackers who might compromise your keys.&#x20;

**On mainnet, you will need to regenerate the KES key every 90 days.**
{% endhint %}

{% hint style="danger" %}
**Cold keys** **must be generated and stored on your air-gapped offline machine.** The cold keys are the files stored in `$HOME/cold-keys.`
{% endhint %}

```bash
mkdir $HOME/cold-keys
pushd $HOME/cold-keys
```

Make a set of cold keys and create the cold counter file.

on Airgap

```bash
cardano-cli shelley node key-gen \
    --cold-verification-key-file node.vkey \
    --cold-signing-key-file node.skey \
    --operational-certificate-issue-counter node.counter
```

{% hint style="warning" %}
Be sure to **back up your all your keys** to another secure storage device. Make multiple copies.
{% endhint %}

{% tabs %}
{% tab title="BP" %}

```
pushd +1
slotsPerKESPeriod=$(cat $NODE_HOME/${NODE_CONFIG}-shelley-genesis.json | jq -r '.slotsPerKESPeriod')
echo slotsPerKESPeriod: ${slotsPerKESPeriod}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Before continuing, your node must be fully synchronized to the blockchain. Otherwise, you won't calculate the latest KES period.&#x20;

Your node is synchronized when the *epoch* and *slot#* is equal to that found on a block explorer <https://explorer.cardano-testnet.iohkdev.io/en/browse-blocks>

{% endhint %}

```
slotNo=$(cardano-cli shelley query tip --testnet-magic 1097911063| jq -r '.slotNo')
echo slotNo: ${slotNo}
```

Find the kesPeriod by dividing the slot tip number by the slotsPerKESPeriod.

```
kesPeriod=$((${slotNo} / ${slotsPerKESPeriod}))
echo kesPeriod: ${kesPeriod}
startKesPeriod=$(( ${kesPeriod} - 1 ))
echo startKesPeriod: ${startKesPeriod}
```

With this calculation, you can generate a operational certificate for your pool.&#x20;

Copy **kes.vkey** to your **cold environment**.&#x20;

Change the **startKesPeriod** value accordingly.

{% hint style="info" %}
Stake pool operators must provide an operational certificate to verify that the pool has the authority to run. The certificate includes the operator’s signature, and includes key information about the pool (addresses, keys, etc.). Operational certificates represent the link between the operator’s offline key and their operational key.
{% endhint %}

```
cardano-cli shelley node issue-op-cert \
    --kes-verification-key-file kes.vkey \
    --cold-signing-key-file $HOME/cold-keys/node.skey \
    --operational-certificate-issue-counter $HOME/cold-keys/node.counter \
    --kes-period $startKesPeriod \
    --out-file node.cert
```

Copy **node.cert** to your **hot environment**.

Make a VRF key pair

Open a new terminal window and stop your **BP node** by running the following:

```
killall cardano-node
```

Update your BP startup script with the new KES, VRF and Operation Certificate.

```
cat > $NODE_HOME/startBlockProducingNode.sh << EOF 
DIRECTORY=\$NODE_HOME
PORT=9000
HOSTADDR=0.0.0.0
TOPOLOGY=\${DIRECTORY}/${NODE_CONFIG}-topology.json
DB_PATH=\${DIRECTORY}/db
SOCKET_PATH=\${DIRECTORY}/db/socket
CONFIG=\${DIRECTORY}/${NODE_CONFIG}-config.json
KES=\${DIRECTORY}/kes.skey
VRF=\${DIRECTORY}/vrf.skey
CERT=\${DIRECTORY}/node.cert
cardano-node run --topology \${TOPOLOGY} --database-path \${DB_PATH} --socket-path \${SOCKET_PATH} --host-addr \${HOSTADDR} --port \${PORT} --config \${CONFIG} --shelley-kes-key \${KES} --shelley-vrf-key \${VRF} --shelley-operational-certificate \${CERT}
EOF
```

{% hint style="info" %}
To operate a stake pool, you need the KES, VRF key and Operational Certificate. Cold keys generate new operational certificates periodically.
{% endhint %}

Now start your block producer node.

```
cd $NODE_HOME
./startBlockProducingNode.sh
```

## 10. Setup payment and stake keys

To create our transaction we will need the protocol parameters, so let’s query the parameters and save them in params.json

```
cardano-cli shelley query protocol-parameters \
    --testnet-magic 1097911063 \
    --out-file params.json
```

{% hint style="info" %}
Payment keys are used to send and receive payments and stake keys are used to manage stake delegations.
{% endhint %}

Create a new payment key pair: payment.skey & payment.vkey

```
###
### On BP node machine,
###
cd $NODE_HOME
cardano-cli shelley address key-gen \
    --verification-key-file payment.vkey \
    --signing-key-file payment.skey
```

Create a new stake address key pair: stake.skey & stake.vkey.

```
###
### On air-gapped offline machine,
###
cardano-cli shelley stake-address key-gen \
    --verification-key-file stake.vkey \
    --signing-key-file stake.skey
```

Create your stake address from the stake address verification key and store it in stake.addr

```
###
### On air-gapped offline machine,
###
cardano-cli shelley stake-address build \
    --stake-verification-key-file stake.vkey \
    --out-file stake.addr \
    --testnet-magic 1097911063
```

Build a payment address for the payment key payment.vkey which will delegate to the stake address, stake.vkey

```
###
### On air-gapped offline machine,
###
cardano-cli shelley address build \
    --payment-verification-key-file payment.vkey \
    --stake-verification-key-file stake.vkey \
    --out-file payment.addr \
    --testnet-magic 1097911063
```

Next step is to fund your payment address.  Fill in the form below with your payment.addr

<https://docs.google.com/forms/d/1BmPI3PsBChSIrpKBgroOjscRXe1vI7iQDFLNGVR6y2o/>

Before continuing, your nodes must be fully synchronized to the blockchain. Otherwise, you won't see your funds.

After funding your account, check your payment address balance.

```
cardano-cli shelley query utxo \
    --address $(cat payment.addr) \
    --testnet-magic 1097911063
```

You should see output similar to this. This is your unspent transaction output (UXTO).

```
                           TxHash                                 TxIx        Lovelace
----------------------------------------------------------------------------------------
c69b3e652fa237875a2c13593c3585dcd87f29233d746dd6697159c4fba17e83     0         997820683
```

## 11. Register your stake address

Create a certificate, `stake.cert`, using the `stake.vkey`

```bash
cardano-cli shelley stake-address registration-certificate \
    --stake-verification-key-file stake.vkey \
    --out-file stake.cert
```

You need to find the **tip** of the blockchain to set the **ttl** parameter properly.

```bash
currentSlot=$(cardano-cli shelley query tip --testnet-magic 1097911063 | jq -r '.slotNo')
echo Current Slot: $currentSlot
```

Find your balance and **UTXOs**.

```bash
cardano-cli shelley query utxo \
    --address $(cat payment.addr) \
    --testnet-magic 1097911063 > fullUtxo.out

tail -n +3 fullUtxo.out | sort -k3 -nr > balance.out

cat balance.out

tx_in=""
total_balance=0
while read -r utxo; do
    in_addr=$(awk '{ print $1 }' <<< "${utxo}")
    idx=$(awk '{ print $2 }' <<< "${utxo}")
    utxo_balance=$(awk '{ print $3 }' <<< "${utxo}")
    total_balance=$((${total_balance}+${utxo_balance}))
    echo TxHash: ${in_addr}#${idx}
    echo ADA: ${utxo_balance}
    tx_in="${tx_in} --tx-in ${in_addr}#${idx}"
done < balance.out
txcnt=$(cat balance.out | wc -l)
echo Total ADA balance: ${total_balance}
echo Number of UTXOs: ${txcnt}
```

Find the keyDeposit value.

```bash
keyDeposit=$(cat $NODE_HOME/params.json | jq -r '.keyDeposit')
echo keyDeposit: $keyDeposit
```

{% hint style="info" %}
Registration of a stake address certificate (keyDeposit) costs 2000000 lovelace.
{% endhint %}

Run the build-raw transaction command

{% hint style="info" %}
The **ttl** value must be greater than the current tip. In this example, we use current slot + 10000.
{% endhint %}

```bash
cardano-cli shelley transaction build-raw \
    ${tx_in} \
    --tx-out $(cat payment.addr)+0 \
    --ttl $(( ${currentSlot} + 10000)) \
    --fee 0 \
    --out-file tx.tmp \
    --certificate stake.cert
```

Calculate the current minimum fee:

```bash
fee=$(cardano-cli shelley transaction calculate-min-fee \
    --tx-body-file tx.tmp \
    --tx-in-count ${txcnt} \
    --tx-out-count 1 \
    --testnet-magic 1097911063 \
    --witness-count 2 \
    --byron-witness-count 0 \
    --protocol-params-file params.json | awk '{ print $1 }')
echo fee: $fee
```

{% hint style="info" %}
Ensure your balance is greater than cost of fee + keyDeposit or this will not work.
{% endhint %}

Calculate your change output.

```bash
txOut=$((${total_balance}-${keyDeposit}-${fee}))
echo Change Output: ${txOut}
```

Build your transaction which will register your stake address.&#x20;

```bash
cardano-cli shelley transaction build-raw \
    ${tx_in} \
    --tx-out $(cat payment.addr)+${txOut} \
    --ttl $(( ${currentSlot} + 10000)) \
    --fee ${fee} \
    --certificate-file stake.cert \
    --out-file tx.raw
```

Sign the transaction with both the payment and stake secret keys.&#x20;

```bash
cardano-cli shelley transaction sign \
    --tx-body-file tx.raw \
    --signing-key-file payment.skey \
    --signing-key-file stake.skey \
    --testnet-magic 1097911063 \
    --out-file tx.signed
```

Sign transaction.

```bash
cardano-cli shelley transaction submit \
    --tx-file tx.signed \
    --testnet-magic 1097911063
```

## 12. Register your stakepool

Create your pool's metadata with a JSON file. Update with your pool information.

{% hint style="info" %}
**ticker** must be between 3-5 characters in length. Characters must be A-Z and 0-9 only. d**escription** cannot exceed 255 characters in length.
{% endhint %}

```bash
cat > poolMetaData.json << EOF
{
"name": "MyPoolName",
"description": "My pool description",
"ticker": "MPN",
"homepage": "https://myadapoolnamerocks.com"
}
EOF
```

Calculate the hash of your metadata file.

```bash
cardano-cli shelley stake-pool metadata-hash --pool-metadata-file poolMetaData.json > poolMetaDataHash.txt
```

Now upload your poolMetaData.json to your website or a public website such as <https://pages.github.com/>

Find the minimum pool cost.

```bash
minPoolCost=$(cat $NODE_HOME/params.json | jq -r .minPoolCost)
echo minPoolCost: ${minPoolCost}
```

{% hint style="info" %}
minPoolCost is 340000000 lovelace or 340 ADA. Therefore, your `--pool-cost` must be at a minimum this amount.
{% endhint %}

```bash
cardano-cli shelley stake-pool registration-certificate \
    --cold-verification-key-file $HOME/cold-keys/node.vkey \
    --vrf-verification-key-file vrf.vkey \
    --pool-pledge 100000000000 \
    --pool-cost 340000000 \
    --pool-margin 0.01 \
    --pool-reward-account-verification-key-file stake.vkey \
    --pool-owner-stake-verification-key-file stake.vkey \
    --testnet-magic 1097911063 \
    --pool-relay-ipv4 81.108.149.100 \
    --pool-relay-port 9001 \
    --metadata-url <url where you uplaoded poolMetaData.json> \
    --metadata-hash $(cat poolMetaDataHash.txt) \
    --out-file pool.cert
```

Pledge stake to your stake pool.

```bash
cardano-cli shelley stake-address delegation-certificate \
    --stake-verification-key-file stake.vkey \
    --cold-verification-key-file $HOME/cold-keys/node.vkey \
    --out-file deleg.cert
```

You need to find the **tip** of the blockchain to set the **ttl** parameter properly.

```bash
currentSlot=$(cardano-cli shelley query tip --testnet-magic 1097911063 | jq -r '.slotNo')
echo Current Slot: $currentSlot
```

Find your balance and **UTXOs**.

```bash
cardano-cli shelley query utxo \
    --address $(cat payment.addr) \
    --testnet-magic 1097911063 > fullUtxo.out

tail -n +3 fullUtxo.out | sort -k3 -nr > balance.out

cat balance.out

tx_in=""
total_balance=0
while read -r utxo; do
    in_addr=$(awk '{ print $1 }' <<< "${utxo}")
    idx=$(awk '{ print $2 }' <<< "${utxo}")
    utxo_balance=$(awk '{ print $3 }' <<< "${utxo}")
    total_balance=$((${total_balance}+${utxo_balance}))
    echo TxHash: ${in_addr}#${idx}
    echo ADA: ${utxo_balance}
    tx_in="${tx_in} --tx-in ${in_addr}#${idx}"
done < balance.out
txcnt=$(cat balance.out | wc -l)
echo Total ADA balance: ${total_balance}
echo Number of UTXOs: ${txcnt}
```

Find the keyDeposit value.

```bash
poolDeposit=$(cat $NODE_HOME/params.json | jq -r '.poolDeposit')
echo poolDeposit: $poolDeposit
```

{% hint style="info" %}
Registration of a stake address certificate (keyDeposit) costs 500000000 lovelace.
{% endhint %}

Run the build-raw transaction command

{% hint style="info" %}
The **ttl** value must be greater than the current tip. In this example, we use current slot + 10000.&#x20;
{% endhint %}

```bash
cardano-cli shelley transaction build-raw \
    ${tx_in} \
    --tx-out $(cat payment.addr)+$(( ${total_balance} - ${poolDeposit}))  \
    --ttl $(( ${currentSlot} + 10000)) \
    --fee 0 \
    --certificate-file pool.cert \
    --certificate-file deleg.cert \
    --out-file tx.tmp
```

Calculate the current minimum fee:

```bash
fee=$(cardano-cli shelley transaction calculate-min-fee \
    --tx-body-file tx.tmp \
    --tx-in-count ${txcnt} \
    --tx-out-count 1 \
    --testnet-magic 1097911063 \
    --witness-count 3 \
    --byron-witness-count 0 \
    --protocol-params-file params.json | awk '{ print $1 }')
echo fee: $fee
```

{% hint style="info" %}
Ensure your balance is greater than cost of fee + minPoolCost or this will not work.
{% endhint %}

Calculate your change output.

```bash
txOut=$((${total_balance}-${poolDeposit}-${fee}))
echo txOut: ${txOut}
```

Build your transaction:&#x20;

```bash
cardano-cli shelley transaction build-raw \
    ${tx_in} \
    --tx-out $(cat payment.addr)+${txOut} \
    --ttl $(( ${currentSlot} + 10000)) \
    --fee ${fee} \
    --certificate-file pool.cert \
    --certificate-file deleg.cert \
    --out-file tx.raw
```

Sign the transaction with both the payment and stake secret keys.&#x20;

```bash
cardano-cli shelley transaction sign \
    --tx-body-file tx.raw \
    --signing-key-file payment.skey \
    --signing-key-file $HOME/cold-keys/node.skey \
    --signing-key-file stake.skey \
    --testnet-magic 1097911063 \
    --out-file tx.signed
```

Sign transaction.

```bash
cardano-cli shelley transaction submit \
    --tx-file tx.signed \
    --testnet-magic 1097911063
```

## 14. Configure your topology files

{% hint style="info" %}
Shelley has been launched without peer-to-peer (p2p) node discovery so that means we will need to manually add trusted nodes in order to configure our topology. This is a **critical step** as skipping this step will result in your minted blocks being orphaned by the rest of the network.
{% endhint %}

Publishing your Relay Node with topologyUpdater.sh

{% hint style="info" %}
This code has been taken from github and all credit to the developer. <https://gist.github.com/gufmar/7e1bc16f8df62af953567a373d6a8f72>
{% endhint %}

Create the topologyUpdater.sh script which publishes your node information to a topology fetch list.

```
###
### On relaynode1
###
cat > $NODE_HOME/topologyUpdater.sh << EOF
#!/bin/bash
# shellcheck disable=SC2086,SC2034
 
USERNAME=$(whoami)
CNODE_PORT=9001 # must match your relay node port as set in the startup command
CNODE_HOSTNAME="CHANGE ME"  # optional. must resolve to the IP you are requesting from
CNODE_BIN="/usr/local/bin"
CNODE_HOME=$NODE_HOME
CNODE_LOG_DIR="\${CNODE_HOME}/logs"
GENESIS_JSON="\${CNODE_HOME}/${NODE_CONFIG}-shelley-genesis.json"

###########################################

NETWORKID=\$(jq -r .networkId \$GENESIS_JSON)
CNODE_VALENCY=1   # optional for multi-IP hostnames
NWMAGIC=\$(jq -r .networkMagic < \$GENESIS_JSON)
[[ "\${NETWORKID}" = "Mainnet" ]] && HASH_IDENTIFIER="--mainnet" || HASH_IDENTIFIER="--testnet-magic \${NWMAGIC}"
[[ "\${NWMAGIC}" = "764824073" ]] && NETWORK_IDENTIFIER="--mainnet" || NETWORK_IDENTIFIER="--testnet-magic \${NWMAGIC}"
 
export PATH="\${CNODE_BIN}:\${PATH}"
export CARDANO_NODE_SOCKET_PATH="\${CNODE_HOME}/db/socket"
 
blockNo=\$(cardano-cli shelley query tip \${NETWORK_IDENTIFIER} | jq -r .blockNo )
 
# Note:
# if you run your node in IPv4/IPv6 dual stack network configuration and want announced the
# IPv4 address only please add the -4 parameter to the curl command below  (curl -4 -s ...)
if [ "\${CNODE_HOSTNAME}" != "CHANGE ME" ]; then
  T_HOSTNAME="&hostname=\${CNODE_HOSTNAME}"
else
  T_HOSTNAME=''
fi

if [ ! -d \${CNODE_LOG_DIR} ]; then
  mkdir -p \${CNODE_LOG_DIR};
fi
 
curl -s "https://api.clio.one/htopology/v1/?port=\${CNODE_PORT}&blockNo=\${blockNo}&valency=\${CNODE_VALENCY}&magic=\${NWMAGIC}\${T_HOSTNAME}" | tee -a \$CNODE_LOG_DIR/topologyUpdater_lastresult.json
EOF
```

Add permissions and run the updater script.

```
###
### On relaynode1
###
cd $NODE_HOME
chmod +x topologyUpdater.sh
./topologyUpdater.sh
```

Update your relay node topology files

Create relay-topology\_pull.sh script which fetches your relay node buddies and updates your topology file. Update with your block producer's public IP address.

```
###
### On relaynode1
###
cat > $NODE_HOME/relay-topology_pull.sh << EOF
#!/bin/bash
BLOCKPRODUCING_IP=<BLOCK PRODUCERS PUBLIC IP ADDRESS>
BLOCKPRODUCING_PORT=6000
curl -s -o /home/test/cardano-my-node/testnet-topology.json "https://api.clio.one/htopology/v1/fetch/?max=15&magic=1097911063&customPeers=${BLOCKPRODUCING_IP}:${BLOCKPRODUCING_PORT}:1|relays-new.cardano-testnet.iohkdev.io:3001:2"
EOF
```

Add permissions and pull new topology files.

```
###
### On relaynode1
###
chmod +x relay-topology_pull.sh
./relay-topology_pull.sh
```

## 18.4 Changing the pledge, fee, margin, etc.

Find the minimum pool cost.

{% tabs %}
{% tab title="block producer node" %}

```bash
minPoolCost=$(cat $NODE_HOME/params.json | jq -r .minPoolCost)
echo minPoolCost: ${minPoolCost}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
minPoolCost is 340000000 lovelace or 340 ADA. Therefore, your `--pool-cost` must be at a minimum this amount.
{% endhint %}

If you're changing your poolMetaData.json, remember to calculate the hash of your metadata file and re-upload the updated poolMetaData.json file.&#x20;

{% tabs %}
{% tab title="block producer node" %}

```
cardano-cli shelley stake-pool metadata-hash --pool-metadata-file poolMetaData.json > poolMetaDataHash.txt
```

{% endtab %}
{% endtabs %}

Update the below registration-certificate transaction with your desired settings.

If you have **multiple relay nodes,** [**refer to section 12**](broken://pages/-M9UBmtPytad9YlyjG1W#12-register-your-stake-pool) and change your parameters appropriately.

{% hint style="warning" %}
**metadata-url** must be no longer than 64 characters.
{% endhint %}

{% tabs %}
{% tab title="air-gapped offline machine" %}

```bash
cardano-cli shelley stake-pool registration-certificate \
    --cold-verification-key-file $HOME/cold-keys/node.vkey \
    --vrf-verification-key-file vrf.vkey \
    --pool-pledge 100000000000 \
    --pool-cost 340000000 \
    --pool-margin 0.01 \
    --pool-reward-account-verification-key-file stake.vkey \
    --pool-owner-stake-verification-key-file stake.vkey \
    --testnet-magic 1097911063 \
    --pool-relay-ipv4 81.108.149.100 \
    --pool-relay-port 9001 \
    --metadata-url <url where you uplaoded poolMetaData.json> \
    --metadata-hash $(cat poolMetaDataHash.txt) \
    --out-file pool.cert
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Here we are pledging 1000 ADA with a fixed pool cost of 345 ADA and a pool margin of 20%.&#x20;
{% endhint %}

Pledge stake to your stake pool.

{% tabs %}
{% tab title="air-gapped offline machine" %}

```
cardano-cli shelley stake-address delegation-certificate \
    --stake-verification-key-file stake.vkey \
    --cold-verification-key-file $HOME/cold-keys/node.vkey \
    --out-file deleg.cert
```

{% endtab %}
{% endtabs %}

Copy **deleg.cert** to your **hot environment.**

You need to find the **tip** of the blockchain to set the **ttl** parameter properly.

{% tabs %}
{% tab title="block producer node" %}

```bash
currentSlot=$(cardano-cli shelley query tip  --testnet-magic 1097911063 | jq -r '.slotNo')
echo Current Slot: $currentSlot
```

{% endtab %}
{% endtabs %}

Find your balance and **UTXOs**.

{% tabs %}
{% tab title="block producer node" %}

```bash
cardano-cli shelley query utxo \
    --address $(cat payment.addr) \
     --testnet-magic 1097911063 > fullUtxo.out

tail -n +3 fullUtxo.out | sort -k3 -nr > balance.out

cat balance.out

tx_in=""
total_balance=0
while read -r utxo; do
    in_addr=$(awk '{ print $1 }' <<< "${utxo}")
    idx=$(awk '{ print $2 }' <<< "${utxo}")
    utxo_balance=$(awk '{ print $3 }' <<< "${utxo}")
    total_balance=$((${total_balance}+${utxo_balance}))
    echo TxHash: ${in_addr}#${idx}
    echo ADA: ${utxo_balance}
    tx_in="${tx_in} --tx-in ${in_addr}#${idx}"
done < balance.out
txcnt=$(cat balance.out | wc -l)
echo Total ADA balance: ${total_balance}
echo Number of UTXOs: ${txcnt}
```

{% endtab %}
{% endtabs %}

Run the build-raw transaction command.

{% hint style="info" %}
The **ttl** value must be greater than the current tip. In this example, we use current slot + 10000.&#x20;
{% endhint %}

{% tabs %}
{% tab title="block producer node" %}

```bash
cardano-cli shelley transaction build-raw \
    ${tx_in} \
    --tx-out $(cat payment.addr)+${total_balance} \
    --ttl $(( ${currentSlot} + 10000)) \
    --fee 0 \
    --certificate-file pool.cert \
    --certificate-file deleg.cert \
    --out-file tx.tmp
```

{% endtab %}
{% endtabs %}

Calculate the minimum fee:

{% tabs %}
{% tab title="block producer node" %}

```bash
fee=$(cardano-cli shelley transaction calculate-min-fee \
    --tx-body-file tx.tmp \
    --tx-in-count ${txcnt} \
    --tx-out-count 1 \
     --testnet-magic 1097911063 \
    --witness-count 3 \
    --byron-witness-count 0 \
    --protocol-params-file params.json | awk '{ print $1 }')
echo fee: $fee
```

{% endtab %}
{% endtabs %}

Calculate your change output.

{% tabs %}
{% tab title="block producer node" %}

```bash
txOut=$((${total_balance}-${fee}))
echo txOut: ${txOut}
```

{% endtab %}
{% endtabs %}

Build the transaction.&#x20;

{% tabs %}
{% tab title="block producer node" %}

```bash
cardano-cli shelley transaction build-raw \
    ${tx_in} \
    --tx-out $(cat payment.addr)+${txOut} \
    --ttl $(( ${currentSlot} + 10000)) \
    --fee ${fee} \
    --certificate-file pool.cert \
    --certificate-file deleg.cert \
    --out-file tx.raw
```

{% endtab %}
{% endtabs %}

Copy **tx.raw** to your **cold environment.**

Sign the transaction.&#x20;

{% tabs %}
{% tab title="air-gapped offline machine" %}

```bash
cardano-cli shelley transaction sign \
    --tx-body-file tx.raw \
    --signing-key-file payment.skey \
    --signing-key-file $HOME/cold-keys/node.skey \
    --signing-key-file stake.skey \
     --testnet-magic 1097911063 \
    --out-file tx.signed
```

{% endtab %}
{% endtabs %}

Copy **tx.signed** to your **hot environment.**

Send the transaction.

{% tabs %}
{% tab title="block producer node" %}

```bash
cardano-cli shelley transaction submit \
    --tx-file tx.signed \
     --testnet-magic 1097911063
```

{% endtab %}
{% endtabs %}

Changes take effect next epoch. After the next epoch transition, verify that your pool settings are correct.

{% tabs %}
{% tab title="block producer node" %}

```bash
cardano-cli shelley query ledger-state  --testnet-magic 1097911063 --out-file ledger-state.json
jq -r '.esLState._delegationState._pstate._pParams."'"$(cat stakepoolid.txt)"'"  // 
```

{% endtab %}
{% endtabs %}

## 18.9 Send a simple transaction example

If you have not downloaded and install bech32 from <https://github.com/input-output-hk/bech32/releases>

```
mkdir $HOME/bech32
cd $HOME/bech32
wget https://github.com/input-output-hk/bech32/releases/download/v1.1.0/bech32-v1.1.0-linux64.tar.gz
tar -xzvf bech32-v1.1.0-linux64.tar.gz
chmod +x $HOME/bech32/bin/bech32
cd $NODE_HOME
```

Example sends **1000 ADA** to Love2Stake **address** &#x20;

First, find the **tip** of the blockchain to set the **ttl** parameter properly.

{% tabs %}
{% tab title="block producer node" %}

```bash
currentSlot=$(cardano-cli shelley query tip --testnet-magic 1097911063 | jq -r '.slotNo')
echo Current Slot: $currentSlot
```

{% endtab %}
{% endtabs %}

Set the amount to send in lovelaces. :sparkles: Remember **1 ADA** = **1,000,000 lovelaces.**

{% tabs %}
{% tab title="block producer node" %}

```bash
amountToSend=99000000000000
echo amountToSend: $amountToSend
```

{% endtab %}
{% endtabs %}

cho "daedalus-address" | bech32 addr\_test

Set the destination address which is where you're sending funds to.

{% tabs %}
{% tab title="block producer node" %}

```bash
testnetDaedalusAddress=addr1qzgc2yx9p55x50ggc3jvr8tfmahx23fvj2zqmqrvyg3he0z89uja3cpcdnpstavx5f37md2xuc03v84zkphz23djd62qdyu0u5
echo ${testnetDaedalusAddress} | destinationAddress=$HOME/bech32/bin/bech32
echo destinationAddress: $destinationAddress
```

{% endtab %}
{% endtabs %}

Find your balance and **UTXOs**.

{% tabs %}
{% tab title="block producer node" %}

```bash
cardano-cli shelley query utxo \
    --address $(cat payment.addr) \
    --testnet-magic 1097911063 > fullUtxo.out

tail -n +3 fullUtxo.out | sort -k3 -nr > balance.out

cat balance.out

tx_in=""
total_balance=0
while read -r utxo; do
    in_addr=$(awk '{ print $1 }' <<< "${utxo}")
    idx=$(awk '{ print $2 }' <<< "${utxo}")
    utxo_balance=$(awk '{ print $3 }' <<< "${utxo}")
    total_balance=$((${total_balance}+${utxo_balance}))
    echo TxHash: ${in_addr}#${idx}
    echo ADA: ${utxo_balance}
    tx_in="${tx_in} --tx-in ${in_addr}#${idx}"
done < balance.out
txcnt=$(cat balance.out | wc -l)
echo Total ADA balance: ${total_balance}
echo Number of UTXOs: ${txcnt}
```

{% endtab %}
{% endtabs %}

Run the build-raw transaction command.

{% tabs %}
{% tab title="block producer node" %}

```bash
cardano-cli shelley transaction build-raw \
    ${tx_in} \
    --tx-out $(cat payment.addr)+0 \
    --tx-out ${destinationAddress}+0 \
    --ttl $(( ${currentSlot} + 10000)) \
    --fee 0 \
    --out-file tx.tmp    
```

{% endtab %}
{% endtabs %}

Calculate the current minimum fee:

{% tabs %}
{% tab title="block producer node" %}

```bash
fee=$(cardano-cli shelley transaction calculate-min-fee \
    --tx-body-file tx.tmp \
    --tx-in-count ${txcnt} \
    --tx-out-count 2 \
    --testnet-magic 1097911063 \
    --witness-count 1 \
    --byron-witness-count 0 \
    --protocol-params-file params.json | awk '{ print $1 }')
echo fee: $fee
```

{% endtab %}
{% endtabs %}

Calculate your change output.

{% tabs %}
{% tab title="block producer node" %}

```bash
txOut=$((${total_balance}-${fee}-${amountToSend}))
echo Change Output: ${txOut}
```

{% endtab %}
{% endtabs %}

Build your transaction.&#x20;

{% tabs %}
{% tab title="block producer node" %}

```bash
cardano-cli shelley transaction build-raw \
    ${tx_in} \
    --tx-out $(cat payment.addr)+${txOut} \
    --tx-out ${destinationAddress}+${amountToSend} \
    --ttl $(( ${currentSlot} + 10000)) \
    --fee ${fee} \
    --out-file tx.raw
```

{% endtab %}
{% endtabs %}

Copy **tx.raw** to your **cold environment.**

Sign the transaction with both the payment and stake secret keys.&#x20;

{% tabs %}
{% tab title="air-gapped offline machine" %}

```bash
cardano-cli shelley transaction sign \
    --tx-body-file tx.raw \
    --signing-key-file payment.skey \
    --testnet-magic 1097911063 \
    --out-file tx.signed
```

{% endtab %}
{% endtabs %}

Copy **tx.signed** to your **hot environment.**

Send the signed transaction.

{% tabs %}
{% tab title="block producer node" %}

```bash
cardano-cli shelley transaction submit \
    --tx-file tx.signed \
    --testnet-magic 1097911063
```

{% endtab %}
{% endtabs %}

Check if the funds arrived.

{% tabs %}
{% tab title="block producer node" %}

```bash
cardano-cli shelley query utxo \
    --address ${destinationAddress} \
    --testnet-magic 1097911063
```

{% endtab %}
{% endtabs %}

You should see output similar to this showing the funds you sent.

```
                           TxHash                                 TxIx        Lovelace
----------------------------------------------------------------------------------------
100322a39d02c2ead....                                              0        1000000
```


# Untitled

DRAFT

Check for latest config files&#x20;

```bash
echo export NODE_BUILD_NUM=$(curl https://hydra.iohk.io/job/Cardano/iohk-nix/cardano-deployment/latest-finished/download/1/index.html | grep -e "build" | sed 's/.*build\/\([0-9]*\)\/download.*/\1/g')
```

### Updating your node's configuration files

```bash
NODE_BUILD_NUM=$(curl https://hydra.iohk.io/job/Cardano/iohk-nix/cardano-deployment/latest-finished/download/1/index.html | grep -e "build" | sed 's/.*build\/\([0-9]*\)\/download.*/\1/g')
cd $NODE_HOME
wget -N https://hydra.iohk.io/build/${NODE_BUILD_NUM}/download/1/${NODE_CONFIG}-byron-genesis.json
wget -N https://hydra.iohk.io/build/${NODE_BUILD_NUM}/download/1/${NODE_CONFIG}-shelley-genesis.json
wget -N https://hydra.iohk.io/build/${NODE_BUILD_NUM}/download/1/${NODE_CONFIG}-config.json
sed -i ${NODE_CONFIG}-config.json \
    -e "s/SimpleView/LiveView/g" \
    -e "s/TraceBlockFetchDecisions\": false/TraceBlockFetchDecisions\": true/g"
```

Update OS if required:

```bash
sudo apt-get update -y
sudo apt-get upgrade -y
```


# Cardano Node Set-up using CNTOOLs.

This instruction is based on [Guild Operators](https://cardano-community.github.io/guild-operators/#/basics).  All scripts are based on this site and please&#x20;


# Stakepool Sites

Get insight into stakepool your running or delegating too.

Whether your running a stakepool or delegating to a pool the sites below are invaluable and provide statistics about all aspects a stakepool. &#x20;

There is not a single site I have come across that rules all others, each site has its own way and style of providing the information so give them a try.  List below is in no particular order.

{% hint style="info" %}
If there are other sites that should be listed on here then please leave a message on [telegram channel](https://t.me/Love2Stake).&#x20;
{% endhint %}

## [ADApools.org](https://adapools.org/)

[Telegram Group](https://t.me/adapools_ops) | [Android App](https://adapools.org/images/mobile/google-play-badge.png) | [iOS App](https://apps.apple.com/us/app/id1533815448) &#x20;

![](https://3006678834-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI5anYFP0lA9tWOsWa-%2F-MJwonoljKelytejo_J7%2F-MJwrpUAeWg1Q_-Crgzq%2Fimage.png?alt=media\&token=e9ba711d-6074-44d6-b48c-aed130fa4372)

## [Cardano PoolTool](https://pooltool.io/)

[Telegram Group](https://t.me/pooltool) | [Android App](https://pooltool.io/google-play-badge.png) | [iOS App ](https://apps.apple.com/us/app/pegasus-tool/id1495556387)

![](https://3006678834-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI5anYFP0lA9tWOsWa-%2F-MJwonoljKelytejo_J7%2F-MJwuqwAisz4YU6zdM9E%2Fimage.png?alt=media\&token=7a202e01-8ced-405d-b3ef-84e8ca3fefe7)

## [Cardanoscan](https://cardanoscan.io/)

[Telegram Group](https://t.me/cardanoscanbot)

![](https://3006678834-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI5anYFP0lA9tWOsWa-%2F-MJwonoljKelytejo_J7%2F-MJwvDDsbnkKGokljUhh%2Fimage.png?alt=media\&token=cccd5e0f-7158-4abd-9345-72e7ddb6cae6)


# Leader Log Scripts

Scripts for stake pool owners to check when their pool is scheduled for the slot leadership

{% hint style="info" %}
Leader Log scripts were developed by [papacarp ](https://t.me/pooltool)from [pooltool.io](https://pooltool.io/).  For full details of the scripts see [pooltool.io public](https://github.com/papacarp/pooltool.io) github
{% endhint %}

The scripts allow stake pool owners to check when their pool is scheduled for the slot leadership.  The steps below cover the following.

* [ ] **Installation** - *Updating and Installing required packages*
* [ ] **Download Scripts** *- Download of the scripts*
* [ ] **Executing scripts** *-* *Create Cardano ledger and run scripts* &#x20;

{% hint style="info" %}
All steps are required to be run on your Block Producer node
{% endhint %}

## Installation

Below guide is for **Ubuntu 20.04**.

Update and add ppa package:

```
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
```

Update, install python and pip:

```
sudo apt-get update
sudo apt-get install -y python3.9
sudo apt-get install -y python3-pip
```

Check version of the scripts:

```
python3 --version
pip3 --version
```

{% hint style="info" %}
Python output `Python 3.8.5`

PIP output `pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)`
{% endhint %}

Install python package pytz:

```
pip3 install pytz
```

## Download scripts

Download `getSigma.py` and `leaderLogs.py`scripts from github:

{% hint style="info" %}
Example uses $NODE\_HOME as the location of the Cardano node folder
{% endhint %}

```
cd $NODE_HOME
wget https://raw.githubusercontent.com/papacarp/pooltool.io/master/leaderLogs/getSigma.py
wget https://raw.githubusercontent.com/papacarp/pooltool.io/master/leaderLogs/leaderLogs.py
```

## Executing scripts

Create Cardano ledger state:

```
cardano-cli query ledger-state --mainnet --allegra-era --out-file ledger-state.json
```

{% hint style="info" %}
This may take a minute and create `ledger-state.json inside your $NODE_HOME`
{% endhint %}

Using your Pool ID and `ledger-state.json` execute getSigma script:

{% hint style="info" %}
If you do not know your pool id you can find this in any of the staking pool sites (adapools.org, pooltool.io or cardanoscan.io).  Example below from pooltool.io&#x20;
{% endhint %}

![](https://3006678834-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MI5anYFP0lA9tWOsWa-%2F-MJrebOVXOAESI6saQZ2%2F-MJrizD6EF6LCwsdJdim%2FCapture99.JPG.png?alt=media\&token=7d2814ad-9a2a-4011-958d-73be6684189a)

```
python3 getSigma.py \
--pool-id a930baffeb4ab6d3e93b39a70f1d6b5f5f922baad9e4f618da285b05 \
--ledger ledger-state.json
```

{% hint style="info" %}
This will output your Sigma value for the next steps

`building active stake`&#x20;

`Sigma: 6.970276119270975e-05`
{% endhint %}

Run `leaderLogs.py` with following parameters.&#x20;

{% hint style="info" %}
Below summary of arguments for full details see the [pooltool.io github](https://github.com/papacarp/pooltool.io/tree/master/leaderLogs).  Some of these are optional arguments but included in the example as these are what I use.

* **--vrf-skey** path to the pool vrf.skey file.
* **--sigma** value from the previous command
* **--pool-id** stake pool id
* **--epoch** the epoch your running this for.  In this case 223
* **--epoch-nonce** epoch 223 nonce (different value of each epoch).  This can be found [here](/stake-pool-operator-tools/leader-log-scripts/epoch-nonce).&#x20;
* **-bft** show potential blocks you would have had if Cardano was full decentralised.
* **--tz** set the timezone of your location.  Run command below to see list of timezones&#x20;

  ```
  timedatectl list-timezones 
  ```

{% endhint %}

Execute leaderLogs.py:&#x20;

```
python3 leaderLogs.py \
--vrf-skey vrf.skey \
--sigma 6.970276119270975e-05 \
--pool-id a930baffeb4ab6d3e93b39a70f1d6b5f5f922baad9e4f618da285b05 \
--epoch 223 \
--epoch-nonce fa2cd68857d74b32d704c86ac94ad40c2d7b5d7143ace3ea4e1fa798794059c0 \
-bft \
--tz Europe/London
```

If are scheduled for slot leadership then you should see output similar to this:&#x20;

```
Checking leadership log for Epoch 223 [ d Param: 0.58 ]
2020-10-14 20:19:53 ==> Leader for 164102, Cumulative epoch blocks: 1
2020-10-14 20:19:53 ==> Leader for slot 164102, Cumulative epoch blocks: 1
2020-10-15 08:39:00 ==> Leader for 208449, Cumulative epoch blocks: 2
2020-10-15 08:39:00 ==> Leader for slot 208449, Cumulative epoch blocks: 2
2020-10-17 10:46:55 ==> Stolen by BFT for 388924, Cumulative stolen blocks due to d param: 1
2020-10-17 10:46:55 ==> Leader for slot 388924, Cumulative epoch blocks: 2
2020-10-17 21:01:49 ==> Stolen by BFT for 425818, Cumulative stolen blocks due to d param: 2
2020-10-17 21:01:49 ==> Leader for slot 425818, Cumulative epoch blocks: 2
```

{% hint style="danger" %}
**Security:** It is responsibility of the operator to protect and secure the stake pool.  Consider  what you share with others.  [The Basics](https://forum.cardano.org/t/back-to-basics-security-measures-every-cardano-stake-pool-operators-should-know-and-implement/38166)  &#x20;
{% endhint %}

{% hint style="info" %}
**Support:** If you find the contents useful, then please consider supporting by either delegating your ADA to ticker **Love2** or sending ADA to the following address - `addr1qy2jswg2xfca87h79050dzgj0yup69u9gpclwn9jl2g5tlfvaj6kvenchu5gwxlfhffysxsnekq6kh4z7yq758w2x3gq7xc7sn`
{% endhint %}


# Epoch nonce

Cardano Epoch nonce

Cardano Epoch nonce parameter required by the Leader Log scripts.

| Epoch | Nonce                                                            | d param |
| ----- | ---------------------------------------------------------------- | ------- |
| 235   | 829749cb2701843214ae3aee67ae12ec9bdb3502e060ac0b75275d0f52af349c | 0.32    |
| 234   | cf55ad387b034590d0ae09c45124a9906442f7b3701e0590526f64b056a343a1 | 0.34    |
| 233   | ac43ea023354c02fd186f87810262c0024063b467f4d08f9e3e2b5cc99116bde | 0.38    |
| 232   | 9c9e044e865030b92a03b7276aa8f749c1c94641c6b13104696e53c8d3c55f61 | 0.40    |
| 231   | 528ef24069580c2bc578e57df8c12aab6f60584c96c04ed4ee4c69f495ad0fd5 | 0.42    |
| 230   | 2125564d8e24f3263c6fa6ced3813a1ab2b068e081274573bc89efd21fdebf37 | 0.44    |
| 229   | 9b13f20f857f8afac84094d5e748f0d728df9eefec9ebf90fc61021ca9c43cb2 | 0.46    |
| 228   | a21f1bc2eafb9dc040ba56453ed7f5a8dc00366d5941b28f47655cb309177e08 | 0.48    |
| 227   | 0e534dd41bb80bfff4a16d038eb52280e9beac7545cc32c9bfc253a6d92010d1 | 0.50    |
| 226   | 2d77849ae819151983123083e2650aa82d84691770b0ebeb59c8bc762d4bfa9e | 0.52    |
| 225   | edb2d417956becb8ae5c6e29028459ab1230c1c8620778b9a801cd99feae8fb9 | 0.54    |
| 224   | e329be6b095b4af25217a8af19a1ebbdd6bae3cb7a6a98fbe7529660498ed332 | 0.56    |
| 223   | fa2cd68857d74b32d704c86ac94ad40c2d7b5d7143ace3ea4e1fa798794059c0 | 0.58    |
| 222   | 171625aef5357dfccfeaeedecd5de49f71fb6e05953f2799d3ff84419dbef0ac | 0.6     |
| 221   | 5ee77854fe91cc243b8d5589de3192e795f162097dba7501f8d1b0d5d7546bd5 | 0.62f   |

{% hint style="info" %}
If you find the contents useful, then please consider supporting by either delegating your ADA to ticker **Love2** or sending ADA to the following address - `addr1qy2jswg2xfca87h79050dzgj0yup69u9gpclwn9jl2g5tlfvaj6kvenchu5gwxlfhffysxsnekq6kh4z7yq758w2x3gq7xc7sn`
{% endhint %}


# Cardano Security for Stakepool Operators

Useful security relate links for Stake Pool Operators

## [Back to Basics — Security measures every Cardano Stake Pool Operators should know and implement](https://www.reddit.com/r/cardano/comments/i7i9td/back_to_basics_security_measures_every_cardano/)

Posted by [u/ADABros](https://www.reddit.com/user/ADABros/) on [https://www.reddit.com/](https://www.reddit.com/r/cardano/comments/i7i9td/back_to_basics_security_measures_every_cardano/)&#x20;

## [How to Harden Ubuntu Server](https://www.coincashew.com/coins/overview-ada/guide-how-to-build-a-haskell-stakepool-node/how-to-harden-ubuntu-server)

From [https://www.coincashew.com/](https://www.coincashew.com/coins/overview-ada/guide-how-to-build-a-haskell-stakepool-node/how-to-harden-ubuntu-server)&#x20;

##

{% hint style="danger" %}
**Security:** It is responsibility of the operator to protect and secure the stake pool.  Consider  what you share with others.  [Disclaimer](/disclaimer).
{% endhint %}

{% hint style="info" %}
**Support:** If you find the contents useful, then please consider supporting by either delegating your ADA to ticker **Love2** or sending ADA to the following address - `addr1qy2jswg2xfca87h79050dzgj0yup69u9gpclwn9jl2g5tlfvaj6kvenchu5gwxlfhffysxsnekq6kh4z7yq758w2x3gq7xc7sn`
{% endhint %}


# Disclaimer

{% hint style="info" %}
*"The only thing more expensive than education is ignorance" - Benjamin Franklin*&#x20;
{% endhint %}

{% hint style="warning" %}
**Disclaimer**

Anything presented, stated, allude on this site should not be considered as an endorsement or professional expert advice. &#x20;

All views, thoughts, and opinions expressed on this site belong solely to the author, and not necessarily to the author's employer, organisation, committee or other group or individual.

All information in this site is provided "as is", with no guarantee of completeness, accuracy, timeliness or of the results obtained from the use of this information, and without responsibility or liability of any kind, express or implied.&#x20;

You agree to take all responsibility or liability for your actions and decisions.&#x20;

Please do your own due diligence.
{% endhint %}


# Support

{% hint style="info" %}
If you find the contents useful, then please consider supporting by either delegating your ADA to ticker **Love2** or sending ADA to the following address - `addr1qy2jswg2xfca87h79050dzgj0yup69u9gpclwn9jl2g5tlfvaj6kvenchu5gwxlfhffysxsnekq6kh4z7yq758w2x3gq7xc7sn`
{% endhint %}


