How does Yoroi register a stake address and delegation in one transaction?

Hi everyone. If we are using cardano-cli to manage staking, we first need to “register” our stake address before we can submit a transaction for our delegation choice. This means 2 transactions are necessary.

But in Yoroi (and probably other wallet apps also), these 2 steps are done in just one transaction.

Is this also doable using the CLI? How?

I am using cntools and I know I have the option “register wallet” - but only one transaction … why you will need 2 transactions?
I review the procedure… yeah you will need a transaction to register the delegate’s staking key on the blockchain and the 2nd transaction to create and submit the stake delegation certificate

It’s the same in cntools.sh - 2 transactions are required. First one only registers our stake cert / stake addr. But no delegation preference there yet… That’s submitted in another, following transaction.

As I understand it, a stake address needs to be registered on the blockchain first, before a delegation preference can be registered on-chain also.

This is why I’m wondering how Yoroi is able to serialize these 2 transactions into just 1.

you are right, sorry but I forgot since I delegated last time through cli

Select wallet to delegate

Selected wallet: NFTS (6.237786 Ada)
Wallet NFTS not registered on chain

Transaction successfully submitted.

Waiting for new block to be created (timeout = 600 slots, 600s)
INFO: press any key to cancel and return (won’t stop transaction)

Do you want to delegate to a local CNTools pool or specify the pool ID?
Selected value: [i] Pool ID
Pool ID (blank to cancel): 00333b89543da962cc92e7ffa45848f42a98f7276780670728ce5 256
Transaction successfully submitted.

Waiting for new block to be created (timeout = 600 slots, 600s)
INFO: press any key to cancel and return (won’t stop transaction)