Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the Wallet address #140

Open
devtrix opened this issue Dec 15, 2021 · 7 comments
Open

How to get the Wallet address #140

devtrix opened this issue Dec 15, 2021 · 7 comments

Comments

@devtrix
Copy link

devtrix commented Dec 15, 2021

Hi,
I have two questions here.

  1. How can I get the wallet address vis javascript in the browser?
  2. How can I have the sign fuctionality like the one OpenSea has during the registration process. I used Metamask with them?
    Thanks in advance.
@rooooooooob
Copy link

For #2 the CIP-30 spec that defines wallet-dApp communication on Cardano is potentially due to have minor changes so keep that in mind. You can use the cardano.signData(address, payload) endpoint. It should return a verification key as well (since addresses on Cardano are key hashes so you can't use just an address to verify a signature but you can go the other way around and go from a key to an address). There's a description of this endpoint in the nami-wallet main readme at the root directory of this repo.

@devtrix
Copy link
Author

devtrix commented Dec 17, 2021

@rooooooooob You just stated the obvious here buddy. I saw that cardano.signData. What address and what payload? It would be helpful to have an example here since the documentation is not there. Plus, I cant believe Nami people arent even answering this simple question. Cheers!

@rooooooooob
Copy link

@devtrix I mentioned it is defined in CIP-30 but the current specification is in slight flux (the PR cardano-foundation/CIPs#148 is already almost what nami does, further away from the in-master copy of CIP-30).

@devtrix
Copy link
Author

devtrix commented Dec 17, 2021

Any insight on how I can get the wallet address? BTW I am very, very new to the crypto world as it is and still learning my way around. I appreciate all the patience & guidance. Thank you.

@rooooooooob
Copy link

@devtrix What are you wanting to do with it? The concept of "the address for a wallet" only makes sense for some wallet types. HD wallets for example will have many addresses associated with a wallet so which one is "the" address? That's why the data sign endpoint takes in an address as a parameter. Would you make an address out of the root pubkey hash? (I am not sure if most wallets would even recognize this or if they wouldn't find it when doing regular HD address discovery) Or pick an arbitrary one of the derived addresses? Or are you just looking for an arbitrary identifier regardless of it it's used as an address?

It's possible we will want to extend the CIP-30 API (it's still in draft status) as well.

@devtrix
Copy link
Author

devtrix commented Dec 18, 2021

@devtrix What are you wanting to do with it? The concept of "the address for a wallet" only makes sense for some wallet types. HD wallets for example will have many addresses associated with a wallet so which one is "the" address? That's why the data sign endpoint takes in an address as a parameter. Would you make an address out of the root pubkey hash? (I am not sure if most wallets would even recognize this or if they wouldn't find it when doing regular HD address discovery) Or pick an arbitrary one of the derived addresses? Or are you just looking for an arbitrary identifier regardless of it it's used as an address?

It's possible we will want to extend the CIP-30 API (it's still in draft status) as well.

I wanted to use it as a part of my client registration. I didnt want to use their name etc. For web 3.0 wallet integration. I dont care about HW wallets, just Nami and Yoroi.

@rooooooooob
Copy link

@devtrix No, not HW (Hardware) wallet, but HD (Hierarchical Deterministic). All Yoroi wallets are HD wallets. I'm not sure about nami. It's a scheme that lets you generate many derived keys from a root passphrase in a secure (and potentially privacy-focused) way.

What if you just pick something like one of the reward addresses? I think for most(all or almost all?) wallets there will only be one and if they return multiple you could just pick the first one lexigraphically and when they go to sign in you just see if you recognize any of them? Or ask them which one they want to use in the case where they have multiple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants