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:

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:

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:

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.

Update cabal and verify the correct versions were installed successfully.

9. Generate block producer keys

The block-producer node requires you to create 3 keys as defined in the Shelley ledger specs:

  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.

KES (key evolving signature) keys are created to secure your stake pool against hackers who might compromise your keys.

On mainnet, you will need to regenerate the KES key every 90 days.

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

on Airgap

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

With this calculation, you can generate a operational certificate for your pool.

Copy kes.vkey to your cold environment.

Change the startKesPeriod value accordingly.

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.

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:

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

To operate a stake pool, you need the KES, VRF key and Operational Certificate. Cold keys generate new operational certificates periodically.

Now start your block producer node.

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

Payment keys are used to send and receive payments and stake keys are used to manage stake delegations.

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

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

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

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

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.

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

11. Register your stake address

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

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

Find your balance and UTXOs.

Find the keyDeposit value.

Registration of a stake address certificate (keyDeposit) costs 2000000 lovelace.

Run the build-raw transaction command

The ttl value must be greater than the current tip. In this example, we use current slot + 10000.

Calculate the current minimum fee:

Ensure your balance is greater than cost of fee + keyDeposit or this will not work.

Calculate your change output.

Build your transaction which will register your stake address.

Sign the transaction with both the payment and stake secret keys.

Sign transaction.

12. Register your stakepool

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

ticker must be between 3-5 characters in length. Characters must be A-Z and 0-9 only. description cannot exceed 255 characters in length.

Calculate the hash of your metadata file.

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

Find the minimum pool cost.

minPoolCost is 340000000 lovelace or 340 ADA. Therefore, your --pool-cost must be at a minimum this amount.

Pledge stake to your stake pool.

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

Find your balance and UTXOs.

Find the keyDeposit value.

Registration of a stake address certificate (keyDeposit) costs 500000000 lovelace.

Run the build-raw transaction command

The ttl value must be greater than the current tip. In this example, we use current slot + 10000.

Calculate the current minimum fee:

Ensure your balance is greater than cost of fee + minPoolCost or this will not work.

Calculate your change output.

Build your transaction:

Sign the transaction with both the payment and stake secret keys.

Sign transaction.

14. Configure your topology files

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.

Publishing your Relay Node with topologyUpdater.sh

This code has been taken from github and all credit to the developer. https://gist.github.com/gufmar/7e1bc16f8df62af953567a373d6a8f72

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

Add permissions and run the updater script.

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.

Add permissions and pull new topology files.

18.4 Changing the pledge, fee, margin, etc.

Find the minimum pool cost.

minPoolCost is 340000000 lovelace or 340 ADA. Therefore, your --pool-cost must be at a minimum this amount.

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

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

If you have multiple relay nodes, refer to section 12 and change your parameters appropriately.

Here we are pledging 1000 ADA with a fixed pool cost of 345 ADA and a pool margin of 20%.

Pledge stake to your stake pool.

Copy deleg.cert to your hot environment.

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

Find your balance and UTXOs.

Run the build-raw transaction command.

The ttl value must be greater than the current tip. In this example, we use current slot + 10000.

Calculate the minimum fee:

Calculate your change output.

Build the transaction.

Copy tx.raw to your cold environment.

Sign the transaction.

Copy tx.signed to your hot environment.

Send the transaction.

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

18.9 Send a simple transaction example

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

Example sends 1000 ADA to Love2Stake address

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

Set the amount to send in lovelaces. ✨ Remember 1 ADA = 1,000,000 lovelaces.

cho "daedalus-address" | bech32 addr_test

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

Find your balance and UTXOs.

Run the build-raw transaction command.

Calculate the current minimum fee:

Calculate your change output.

Build your transaction.

Copy tx.raw to your cold environment.

Sign the transaction with both the payment and stake secret keys.

Copy tx.signed to your hot environment.

Send the signed transaction.

Check if the funds arrived.

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

Last updated

Was this helpful?