How to know if I connect to ledger or seed phrase account?

Hello, everybody.
How are you?
I am integrating wallet connect for my dApp.
And I want to allow users to connect with their ledger wallet and seed phrase wallet.
But the ones who use ledger wallet got error message when they meet signData() function.
It seems like cardano ledger don’t support signData() api.

Is there any way to check if I was connected to ledger wallet or seed phrase account?

Thank you.

Not from the dApp side as far as I can see. You just get addresses and UTxOs and they don’t contain the information how they were derived at all.

You could just implement a login mechanism that works with Ledgers and use it for all logins, seed phrase or hardware (Trezor also does not allow signData).

One candidate for such a login that works with Ledgers is letting the users sign a transaction (but never submit it) and check the signature of that transaction. Hardware as well as seed phrase wallets perfectly allow that.

Can be made more elegant by using inputs and outputs on the zero address addr1vyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkdl5mw so that users see that what they are signing has zero effect on their wallet, just requiring a signature from the stake key, giving a CIP 20 message explaining what is going on, setting an invalid-hereafter in the past, …

1 Like

Oh, thanks for your reply.
So you mean, we can’t detect whether users connect their wallet from seed phrase account or ledger account on dApps like

Yes, you can’t detect.

1 Like

So with ledger connected, then how can we verify them (their stakeaddress like signData do)?

By the way, can we discuss on Discord? Since that is much faster.

??? I already answered that:

I’d honestly prefer not to. Sorry! Here, others could jump in if they have better answers and/or more time to answer at the moment. And others can also find it if they have the same question in the future.

Yeah, this is good for community

So we will let them signTx() right?
And can we show them some kinda text description (the explanation what is this for) when they signTx()?


One site that does it like that is:

Let’s you sign such a transaction:
So, the message what is going on is there, but you first have to expand the metadata. And it’s one or more clicks deep in all wallet apps that I tested.

You probably want to additionally just explain it on your “Connect Wallet” pop-up (where you have complete control of the content and presentation).

And: As also said in the first answer: I would try to let the output also go to the zero address, so that the effect is zero, and the user is not irritated by signing a transaction, where they should get funds, but they then never arrive.

And we do this using lucid-cardano module?
Can you help me with some code snippets please?

You should be able to do it with any transaction building library you choose.

Sorry, don’t have one ready (and unfortunately no time to create you one now).

You’d have to create a transaction with inputs and outputs on the zero address (you can just use that same input that Equine uses above, it’s on the zero address, it can never vanish) and the stake key hash of the user as required signer.

Lucid unfortunately does not seem to have a comprehensive API description. If it does not have that functionality itself, it states on that you can always resort to going through to CML (which in turn doesn’t really seem to have comprehensive documentation sigh).

But CML is a fork of CSL (which also does not have a really nice API description, but at least points to the “Flow file” listing all methods available). The transaction body should offer this:

Thanks. Let me try this one

I made that kind of transaction with zero address thanks for you help.
But how to verify it?

I am trying to verify the signed transaction.I verify the signed message (cip08) using

@emurgo/cardano-serialization-lib-nodejs @emurgo/cardano-message-signing-nodejs

But it didn’t work same with the signed Transaction hex. I got error like this

Deserialization failed in TransactionWitnessSet because: Invalid cbor: not the right type, expected Map' byte received Array’.