Evolution SDK
Staking

Stake Key Registration

Register stake credentials on the Cardano blockchain

Stake Key Registration

Before you can delegate or earn rewards, your stake credential must be registered on-chain. Registration requires a deposit (currently 2 ADA on mainnet) which is refunded when you deregister.

Basic Registration

import { , ,  } from "@evolution-sdk/evolution"

const  = .()
  .({
    : "https://cardano-preprod.blockfrost.io/api/v0",
    : ..!
  })
  .({ : ..!, : 0 })

// Get your stake credential from your wallet address
const  = await .()
const  = .!
// stakeCredential is a Credential (KeyHash for seed wallets, ScriptHash for script-controlled)

const  = await .().({  }).()

const  = await .()
await .()

The deposit amount (currently 2 ADA) is fetched automatically from protocol parameters.

Register and Delegate Together

The Conway era introduced combined certificates that register and delegate in one step, saving a certificate fee:

import { , ,  } from "@evolution-sdk/evolution"

const  = .()
  .({
    : "https://cardano-preprod.blockfrost.io/api/v0",
    : ..!
  })
  .({ : ..!, : 0 })

declare const : .
declare const : any // pool key hash from a stake pool (e.g. from a pool explorer)
declare const : any // DRep to delegate voting power to (e.g. DRep.fromKeyHash(...))

// Register + delegate to pool in one certificate
const  = await 
  .()
  .({
    ,
    
  })
  .()

const  = await .()
await .()

You can also combine registration with DRep delegation or both:

import { , ,  } from "@evolution-sdk/evolution"

const  = .()
  .({
    : "https://cardano-preprod.blockfrost.io/api/v0",
    : ..!
  })
  .({ : ..!, : 0 })

declare const : .
declare const : any // pool key hash from a stake pool (e.g. from a pool explorer)
declare const : any // DRep to delegate voting power to (e.g. DRep.fromKeyHash(...))

// Register + delegate to both pool and DRep
const  = await 
  .()
  .({
    ,
    ,
    
  })
  .()

const  = await .()
await .()

Script-Controlled Registration

For stake credentials controlled by Plutus scripts, provide a redeemer:

import { , , ,  } from "@evolution-sdk/evolution"

const  = .()
  .({
    : "https://cardano-preprod.blockfrost.io/api/v0",
    : ..!
  })
  .({ : ..!, : 0 })

declare const : .
declare const : any // compiled Plutus staking script (from Aiken build or Blueprint codegen)

const  = await 
  .()
  .({
    : ,
    : .(0n, []),
    : "register-script-stake"
  })
  .({ :  })
  .()

const  = await .()
await .()

Next Steps

On this page