Help on how to write a transaction to delegate to a DRep?

Hey there all,

Looking for documentation on how to construct a transaction to delegate to a DRep.
Using Cardano Serialization Library.

Appreciate an example transaction with it constructed to send to a wallet such as Eternl.

I saw on Telegram that Marcel is already helping you out, but for others that might stumble about this, here is how to do it with cardano-cli:

The subcommand for the delegation certificate is cardano-cli conway stake-address vote-delegation-certificate:

This only needs the stake key hash to delegate and the dRep key hash to delegate to (couldn’t get the Bech32 drep1… to work, so I’m just using hex here):
screenshot-2025-03-31-13:52:45

Nice thing is: You can even see both hex key hashes in the generated CBOR:

Then just build a transaction including this certificate as usual:

And if I import this to Eternl (V2 Beta) to sign and submit, it does show the correct delegation from stake key hash to drep key hash:

Edit: Oh, didn’t see that you added “Cardano Serialisation Library”. Meh, then this doesn’t really help.