cardano-foundation / cardano-wallet

HTTP server & command-line for managing UTxOs and HD wallets in Cardano.
Apache License 2.0
758 stars 213 forks source link

Documentation / interface for hardware wallets #4377

Open benapetr opened 6 months ago

benapetr commented 6 months ago

The problem that you wish to solve

Right now Daedalus somehow magically is able to connect HW wallets, but it's not obvious from API of cardano-wallet how is that possible. Is there any interface in cardano-wallet that can handle hardware wallets? If not it should be implemented.

Description

See above

Implementation suggestions

Implement API interface for handling hardware wallets, eg. let users export the public keys and create wallet just using that instead of secret passphrase. Let user export prepared TXs and let HW wallet sign them, then send them back to cardano-wallet for execution.

It would be great if format of output was compatible with existing CLI tools that can work with hardware wallets like cardano-hw-cli

Unisay commented 6 months ago

The cardano-wallet backend application doesn't have a functionality to support HW wallets like Ledger. The HW support in Daedalus comes from somewhere else.

HeinrichApfelmus commented 6 months ago

The HW support in Daedalus comes from somewhere else.

@Unisay that cannot be the whole story — ledgerjs-hw-app-cardano may be able to sign transactions, but it does not contain any provisions for interacting with the cardano-node. For the latter, Daedalus does rely on cardano-wallet.

Implement API interface for handling hardware wallets, eg. let users export the public keys and create wallet just using that instead of secret passphrase.

The API endpoint https://cardano-foundation.github.io/cardano-wallet/api/edge/#operation/postWallet with the shelley (from XPub) schema for the POST data allows you to do that — restore (synchronize) a wallet from a public key instead of a private key.

benapetr commented 6 months ago

ok, can we at least create some wiki page that would show example flow where user extracts the public key (using tools like cardano-hw-cli), then create a wallet with that key, then creates and exports a TX using cardano-wallet, signs it using cardano-hw-cli and then sends it back to cardano-wallet for submission?

Because while in theory this is already possible, I still have no clue how to do that in practice. Some examples would make this more obvious to people.