Estimated reading time: 2 minutes
This page is a description of the three parts of the implementation of your DApp.
1. Update your DApp server
Ledger has a DApp browser to host your web3 DApp.
One of the most useful features of this DApp Browser is to be able to log-in automatically from a Ledger Live Ethereum account, therefore obviating the step to manually “Connect a Wallet”.
As a DApp developer, you must add the specific iframe provider from Ledger as web3 provider.
The server must allow DApps to be embedded into iframes. To know more on how to proceed, have a look at this documentation. This explains how to easily authorize your DApp to be embedded only by Ledger Live DApp Browser by specifying the DApp Browser URL without using wildcards.
There is a useful reference article on the Ledger Blog.
The package to add a new web3 provider is available here. This simply diverts all RPC calls made from the DApp to the parent window using the PostMessage API. It does not do any Ledger-specific computing. It could in the future become a development standard to work out-of-the-box with other wallets.
Alternativelly, if you are using the wagmi library to build your DApp, you can use our ledger-live-wagmi-connector
to seemlessly make it compatible with the Ledger Live wallet.
A DApp must run differently if it is called from within an iframe or not. If it is, then directly initialize the web3 instance with the iframe provider. In this way, there is no web3modal connect flow at all, and users are automatically connected to the wallet of the parent window. To detect if a call is made from within an iframe or not, use a query param such as
Feel free to check out how Lido did it here, it is later used in their sdk here
The DApp can submit a tx with or without gas fee set. If it is set, Ledger Live will use it as is, otherwise, Ledger Live will propose low/medium/high based on gas fee estimations.
2. Smooth out user experience
Please make sure basic cases are handled.
For instance, check what happens when you click on the log out or disconnect button in your Dapp. The user may be automatically logged back in Ledger Live iframe provider or redirected to the standard list of providers (Metamask, connect wallet, and such…).
We currently supports Ethereum mainnet, BSC and Polygon POS chains. We also support the Goerli testnet: to use it, make sur you have a Goerli testnet account available in Ledger Live. (To enable testnet networks, head over to Settings -> Experimental features and turn on the Developer mode setting.)
Please remove any references to third-party services that are not part of the current Ledger environment. You are free however to redirect to Ledger Live Buy or Swap services.
UI must be responsive and available for both Desktop and Mobile screen sizes.