Stake is concentrated in accounts, and you will need your account key to delegate its associated stake.
You will need your:
- account public key: a bech32 string of a public key
- the Stake Pool ID: an hexadecimal string identifying the stake pool you want to delegate your stake to.
$ jcli certificate new stake-delegation STAKE_POOL_ID ACCOUNT_PUBLIC_KEY > stake_delegation.cert
We need to make sure that the owner of the account is authorizing this delegation to happens, and for that we need a cryptographic signature.
We will need the account secret key to create a signature
$ cat stake_delegation.cert | jcli certificate sign account_key.prv | tee stake_delegation.cert cert1q8rv4ccl54k99rtnm39...zr0
The output can now be added in the
transaction and submitted to a node.
jcli transaction add-certificate command should be used to add a certificate before finalizing the transaction.
... jcli transaction add-certificate $(cat stake_delegation.cert) --staging tx jcli transaction finalize CHANGE_ADDRESS --fee-constant 5 --fee-coefficient 2 --fee-certificate 2 --staging tx ...
--fee-certificate flag indicates the cost of adding a certificate, used for computing the fees, it can be omitted if it is zero.
See here for more documentation on transaction creation.