Akram El Milligy - Build with a Hardware Device
EthereumZuri.ch 2024 · April 2024 · 18:11
Akram El Milligy, a developer support engineer at Ledger, surveys the four layers of open source integration for hardware wallets: embedded apps, blockchain support, Ledger Live apps with clear signing plugins, and connector libraries. A short walkthrough then shows how to build a small web app that asks a Ledger device to sign an EIP-191 personal message and recover the signing address. The Q&A covers EVM prioritisation, library maintenance, and how a secure element and clear signing protect users who connect online.
Speakers
Topics
From EthereumZuri.ch 2024, hosted by EthereumZuri.ch.
Transcript
[Applause] thanks thank you everyone uh so yes I'm working at Ledger as a developer support engineer um so today uh I will show you it will be a two-part uh presentation uh first one um and quick overview of the different open source Integrations we have at Ledger uh and the second one the second part it will be a presentation SL Workshop uh to show you quickly how to uh to build a quick web app interacting with a ledger Hardware device so uh let's quickly uh dive into the different Integrations Pathways we have a with Ledger um many people
doesn't necessarily know but uh most of the Integrations at Ledger are most of them open source uh they're doable by bi internally but also by external Partners um we have many uh let's say four layers of Integrations uh the first one is the embedded app integration if you're uh uh familiar with ler Hardware device the first step to use it is to have your embedded app uh regarding a specific blockchain installed on it and before developed on it so the embedded app are the first uh layer they are buil on top of the uh basic FAL layer uh this the this is the first step that will allow
you to inter act with the protocol this is something we did it uh by by it was done by us at the beginning uh a few years ago but we tried to uh let it be done by external Partners uh our repo is open so you can have a look uh at it uh check how the the embedded app are done uh clone the rep so if you want um and also you can do your own embedded app uh by yourself you can do what we call a side loading on your Hardware device so it would be your risk to do it but you can do your own custom app and uh uh from a clone of a previous app and custom it and uh and side load
it on the on the device so this is the first layer of uh integration uh the second layer that comes right after the embedded app integration is the blockchain support or blockchain integration so you have the this first layer that allows you to have your embedded app on your device so this is the first step the Second Step if you're familiar with the Ledger Hardware device we also have a kind of software wallet our companion app so to allow users uh to use your blockchain directly for example uh on the software wallet you have to uh do this blockchain integration it will allow them to manage use their coin directly on on the companion app and same thing uh it's
open it's open source you can clone uh previous blockchain integration from from the repo Uh custom it do it yourself or with the team because it's lots of work and then submit it uh if done so these are the first two big layers of Integrations there is another uh integration that comes on this let's say on the side it's the liveup integration um so what is a live app it's kind of uh application could be a DB or or a nonap uh that you Ed directly uh through the software wallet it will allow users to be able to use directly your uh your dap or non dap on the
companion app but you will need U something else on top of it type of plugin we call it uh because we promote that ledger what we call uh clear signing uh to know what you're signing uh directly on your device not to do uh blight signing and the plugin is kind of an embeded app also but a little more custom and same thing we have our repo which is open with the list of plugins uh and you can clone it work on it and also do your custom way so this is the third uh layer and the last one and the easiest one and the one that we will I will base uh my uh my uh next part of the presentation uh it's the what we
call the connector app uh integration this is is the this Integrations is uh the fastest one is just a bunch of Library you have to uh to import uh and to to put it inside your dab it will allow your dab to be able to interact with uh directly with a hardware device to be able uh depending on on the connectivity you would choose you have you will have different uh type of libraries and you will be able to allow your dap to be able to talk let's say like that uh with the uh the hard the your Hardware device so this will be quick uh kind of uh presentation slw Workshop we won't have
time to do it as a workshop but I will give you all the links if you want to to try it uh for the prerequisites so we we need so as I said uh this Workshop is based on the connector app integration the easiest one so for that you will need um to ensure that you have the right package manager your Ledger Hardware device if you have one hope so uh with the ethereum app installed generate an etherum address and use the right libraries I will show you just after so to get started so as I said uh ensure that you have everything set uh with the ethereum app your device and everything installed uh for this we will
be using the EIP 191 on signing messages this is the the one that we'll be using used to to sign uh messages on on this work workshop let's call it that way you have the link to the repo if you want to have a look at it so it's a ledger SL example Ledger sign personal message if you want to take a picture or as you want and once you clone uh this rippo you just have to launch these two uh commands npm install and npm Run start and this is is what you should have so as I said quick web app we don't do too complicated uh this is what the
how the web app look like uh and you can see that you have a hash my message button that will be explained just after um so the be depending on what you want to do on the hardware device you have first to think about the behavior so the behavior I choose for this uh uh this uh let's say Workshop is to open my uh so my Hardware device open my etherum app click on the hash my message on the web app it you will receive on your Hardware device a message test uh to sign and you will be able also to sign it or consel it on your Hardware
device so after signing the message um the web app will display two things uh the hash of your message and your your ethereum address displayed just below and if you want to ensure that it's your ethereum address uh that sign this message you can go on run.com enter these these two lines just replace the hash displayed comments by what you got on your on the web app and normally it should retrieve your etherum address so how does it work uh so as I said it's the connector app integration so depending on what you want to use on the
connectivity part of the device you will choose the right transport Library so on my side as I'm using the E theum app and there is the transport web hiid um Library uh for the connectivity I choose this one you also have the web USB you also have the the web Bluetooth so depending on on what you want to do you will choose the right transport Library so ensure that you're using the the using the right one and on the repo you will find uh kind of dock with a list of functions and as I said it depends on the behavior you want to get with your Hardware device So based on the behavior I wanted to get this these
are the different functions I choose to interact with my device uh the fourth line I don't know why it's looking like that but is the function that uh allow all you to uh hash the message so normally it's sign hash something like that I don't remember but this is this one and yeah so and as I said depending also on the behavior you want to to do you will have different uh uh calls between the hardware device your your web app you might be uh you might encounter uh errors and every at every step so depending on the error you also have a
list of of error that will be displayed and explained and depending on that you can uh uh you can manage to to do your integration and uh that's it uh quickly before ending this um as I said our repo is open so we welcome everyone to contribute to it um we have a double challenge uh the first one to uh to enhance enhance our open platform but also to uh to listen to external developers so we have to find the right balance between between these two uh these two uh groups let's say like that uh so but we prioritize customer
satisfaction so at the end we will have the final say on that uh and if you want to become a partner uh reach out so to us don't don't hesitate and a few links to from what on on what you can uh you can have a look the first one the developer portal uh everything I said is written also on it so you can have a look at it so it's on developers. ledger.com we also have a Discord server where you can ask your questions and if there is a uh Ledger developers free he will answer your questions um we have a kind of uh blog also uh explaining different Journeys and the last one our repository The
Ledger asq repo uh which is open so you have all inside uh embedded apps blockchain Integrations uh live apps documentation everything and that's it thank you very [Applause] much there's time for questions there any can you run over there thank you thank you uh so when Every Chain yeah every coin can create
their own uh app on Ledger doesn't it create some protocol or format compatibility issues like do you have Universal format how different chain build transactions and my next question also related is if this uh this this JavaScript libraries are also covering uh some apps written by like external entities like different protocols than um than what Ledger maintains okay so for the first one yes we might
encounter protocol compatibility issues sometimes so we have a let's say strategy we favoritize what we call evm like chains first uh for the rest when it's too complicated it depends on the let's say return on investment if it's if it's a chain for example on the top 100 on or on the top 50 if if it's complicated but that we can figure out a solution uh we can do it but it's uh it's um it's together so it will be done internally but we have kind of uh regular calls to explain how to do it and external Partners follow the the the road we explain to to them so depending
on the the complexity yes we prioritize and then we see at the end for the the more complex one at the end and for your second question uh yeah yeah go ahead so when there are this embedded apps right you call this embedded apps yeah so if embedded app apps are created by an external entity then do do you have like matching set of this Javas script or typescript libraries actually or uh Ledger needs to build it how does this work could you repeat the question uh so there is embedded app and then you have uh this uh JavaScript or typescript code
to interact with Ledger okay so these are two things so the first one the embedded up and then the Javas they need to be compatible with each other right the JavaScript side is when you're your for example you have your your dap your application that want to be able to directly interact with the the device and uh on the device it will depend of course of your chain if your chain is on it's evm compatible for example it will be easier for example it will be able assume it's not what assume that it's not yeah assume that it's not it will depend on if the embedded app is already uh integrated so if not there is a need to integrate the embedded app first and then do the the the rest okay and then
like both parts are maintained by the same entity uh the embedded app are maintained by the one who did it so either it's the foundation either is we external Partners we have and the libraries yes it's by us thank you you're welcome uh thank you um so non-technical question uh we looked into like using Ledger um I mean the whole point of using uh a cold wallet I suppose is that you don't want it online that you want to have that extra layer of security um at the same time it's not as practical as being online and connected so this connection layer that you explained
there to what extent does that open up risk and and how could that be mitigated because you are connecting then on line and and I mean God knows where the connection potentially comes from um if you're not a coder so how what's your recommendation for actually doing that connection but being on the definitely safe side of having the advantage why you chose ler okay so even if you're exposed online when using it um you have uh another layer of security we have a kind of uh so when you're using your device you you have inside it secure element uh so everything that is displayed on your screen is the truth so if you want to be sure that you're not
exposed you have to verify what you have on your screen and also what you have on your device so if you what you have on your screen and what you have on your device are different you potentially exposed to something so so that was the check you show the for examp yeah for example and you also have another thing is uh we we promote clear signing so uh many people when they sign something on on daps or other application um they is often sign type of hash so it's a line of uh letters and numbers you don't understand so they sign it because they know that they asked for it but they don't understand what they say so what
we want to promote is clear signing it kind of translates this ash into understandable uh sentences that will be showed on your device so then when you sign on your device you're understanding it that you're sending for example is to this address and you know what you're doing so these are two uh main element to take into account when doing this to be sure that you're not exposed on online complex yeah yeah send receive uh staking nfts uh when you send an nft or so
yeah it's pretty small but we we are launching uh I have it on me so I can showcase it uh we are launching a new uh new device with a with a bigger screen uh we promote it a year and a half ago but uh uh we we are a little late so you have a bigger screen with that and you will be able to display more more characters more information and you will have a better user experience also also for for non- crypto user for example amazing thank you so much welcome thank you everyone
Related talks
- Build and secure your use of a dApp with hardware device
- Connectivity between Ledger Hardware Device and Ethereum - Akram El Milligy | Ledger
- Securing DeFi - A sneak peek in the world of Ledger Nano Ethereum plugins
- What You Sign Is What You Get: Ending Blind Signing with ERC-8009
- ETHWarsaw 2023: Akram EL MILLIGY, Ledger - Ledger Integration
- Human Readable Ethereum Transactions - Alex Miller
- Building the Ethereum Universal Signer
- Ledger Workshop - ETHGlobal San Francisco 2024
- Building a unified Ethereum experience for Hardware Signers
