Governance and Conway Era
Conway era introduces significant on-chain governance features to the Cardano blockchain, as outlined in CIP-1694 (opens in a new tab). These features enable ADA holders to participate in on-chain decisions through a system of delegation and direct voting.
For all operations, you'll need a registered stake address. Learn more about stake address registration here.
ADA Holders
As an ADA holder, you can participate in on-chain governance by delegating your voting power to a DRep or becoming a DRep yourself.
Delegate Voting Power
You can delegate your voting power to a trusted Delegated Representative (DRep). If you have a DRep ID (starts with drep1...
), convert it to a Credential:
import { drepIDToCredential } from "@lucid-evolution/lucid";
// Convert DRep ID to Credential
const drepId = "drep1...";
const drepCredential = drepIDToCredential(drepId);
// Use in transaction
await lucid
.newTx()
.delegate.VoteToDRep(rewardAddress, drepCredential)
.complete();
Convenience functions for common governance operations:
Register stake address & Delegate to DRep:
await lucid
.newTx()
.registerAndDelegate.ToDrep(rewardAddress, drepCredential)
.complete();
Register stake address & Delegate to stake pool & DRep:
await lucid
.newTx()
.registerAndDelegate.ToPoolAndDRep(rewardAddress, poolId, drepCredential)
.complete();
Delegate to stake pool & DRep:
await lucid
.newTx()
.delegate.VoteToPoolAndDrep(rewardAddress, poolId, drepCredential)
.complete();
Putting it all together
Here's a complete example of delegating to a DRep:
import { Lucid, Blockfrost, drepIDToCredential } from "@lucid-evolution/lucid";
// Initialize Lucid
const lucid = await Lucid(
new Blockfrost(
"https://cardano-mainnet.blockfrost.io/api/v0",
"<blockfrost-api-key>"
),
"Mainnet"
);
// Select wallet
lucid.selectWallet.fromPrivateKey(privateKey);
// Get your reward address
const rewardAddress = await lucid.wallet().rewardAddress();
// Convert DRep ID to credential
const drepId = "drep1...";
const drepCredential = drepIDToCredential(drepId);
// Build, sign and submit transaction
const tx = await lucid
.newTx()
.delegate.VoteToDRep(rewardAddress, drepCredential) // or use a predefined strategy
.complete();
const signedTx = await tx.sign.withWallet().complete();
const txHash = await signedTx.submit();
Understanding Delegation Certificates
When you delegate your voting power, Evolution library creates a certificate
that's included in your transaction. Behind the scenes, this is handled by the
Certificate.new_vote_deleg_cert
method in CML. The certificate contains:
- Stake credential derived from your reward address
- DRep you're delegating to
- Voting strategy (whether a specific DRep, Always Abstain, or Always No Confidence)