New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

Quick Start Your Project with Ledger - Singapore 2024

ETHGlobal — 2024ETHGlobalWed, Oct 9, 2024, 12:00 AM

This workshop from Alexis Grojean titled, "Quick Start Your Project with Ledger" anticipates ETHGlobal Singapore, a 3-day hackathon happening from September 20 to 22, 2024, bringing together the most skilled web3 developers, designers and product builders from all around the globe for a weekend-long adventure to advance the Ethereum ecosystem! ----------------- Follow us: https://x.com/ethglobal Check us out: https://ethglobal.com/ Email us at: hello@ethglobal.com

Transcript

hello everyone my name is Alexi and I'm a fare engineer in the embeded apps team at Ledger today we'll see how easy it is to develop your own app for Ledger devices based on the boilerplate app in this short video we are going to set up the app development environment on a Mac in a few short steps first we are going to install and configure Docker and X squats then we will install BS code and The Ledger Dev tools extension and finally I'm going to show you how to start building an embedded app all right let's go let's go to the docker website and download the latest version of Docker desktop let's go ahead and copy Docker to the applications folder and let's open it we have to wait for the docker engine to start next we're going to go on the xqu website and download the latest version we install it here we need to open squats and configure it let's go into the settings in the security tab make sure we uncheck authenticate connections and check allo client connections it is important to restart X squats so that the settings are properly applied this video is meant for Mac users if you are on Linux or Windows you will find there are only small differences on ubun to Linux it is simpler as there is no need to install a NYX server on Windows just remember to check the box to disable Access Control during the first launch of vcx serve now that we have the two prequisites installed and running we can go on the vs code website and download it let's open vs code go to the extensions tab look for Ledger Dev tools and install it the EXT extension is now installed and we can see there's a ledger logo that has been added to the sidebar when we click there we go to the extension since we don't yet have any apps open in the workspace we see the default welcome screen now let's go to the boilerplate app GitHub Page look for the HTTP link then open a terminal and clone the app now we can go back to the extension click on the open app folder button and look for the boiler plate app that we have just closed go back to The Ledger extension as you can see the welcome screen has disappeared and the extension features displayed we need to wait for the extension to start the docker container the first time this is done it can take a few minutes because it needs to pull the latest version of the docker developer tools image that contains the latest SDK and all the required tools to build and test applications okay the container is now running let's build the app we can go and select the target device in the drop down list and click on build it's as simple as that the operation is finished finally we can run the app on the emulator from inside the vs code extension you can play with the left and right keys of your keyboard just as you would with the Nano X buttons to summarize we set up our Mac by installing Docker xquartz vs code and The Ledger Dev tools extension then we clone the boiler plate up and finally we build the app and run it on the emulator so where do you go from here well go ahead and try running the functional tests you can also load and run the app on a real device or you can visit the developer portal for more information my name was Alexi see you soon hello everyone my name is Alexi and I'm a fer engineer in the embedded apps team in this video I will guide you through writing functional test of apps developed for Ledger devices first I'll tell you why functional tests are an important part of the development process then we'll look at the framework you will use for writing tests which we have developed called ragger Next I'll walk you through the setup process and pinpoint what files you you need for these tests finally we'll wrap up with a comprehensive demo using The Ledger ofs code extension and a code work through this tutorial requires having the prerequisites set up on your computer for more information on these please watch the video called development environment quick start in this series right let's go functional tests are essential to ensure that the features of your app work as intended they confirm that your app can handle all the implemented commands properly that the screen information is correct and that the right data is sent back by the app to the client that is why having the functional tests in the repository of your app is mandatory before we deploy your app on The Ledger Live app store writing tests can be challenging if you depend only on the speculo simulator or libraries that have low-level apis to communicate with a physical device how do we create tests that automate the execu of the endtoend scenarios we want to validate in the embeded app team we have developed a python tool for this it is called the ragger framework ragger offers a unified backend interface for writing tests where the application can run on either a physical device or the specul simulator removing the complexity from the test code also any test duplication is avoided because it is shared across all the supported devices enabling it to run seamlessly on any of them a comprehensive high level API is available it is used to define the instructions and string them together to automate navigation in the application flows on the speculo emulator finally when navigating in the user interface flows the ragger API can also compare the screens displayed with reference snapshots okay now let's go ahead and take a look at the test folder of the boiler plate app in vs code so that we can identify the important files required for setting up ragger here we will focus on the application client code the com test file and the requirements file let's look at the application client code it includes the classes and functions to communicate with the application it is important to note that the communication protocol is to be defined according to your specific needs the specification includes the apdu parameter values the status words return by the app the transaction serialization format and so on in boiler plate command sender the functions to send commands to the app use the backend interface class provided by rger which exchanges data with the app running on an emulator or a real device all right let's move on to the com test file this file is required by the P test framework the test Runner used by ragger there's not much here because the complexity is hidden in ragger where a similar file is defined the base com test pile this is where so-called fixtures or object instances are created and passed as parameters to all the test cases these fixtures include the device name on which the test is run the Navigator used to automate navigation the back end used to communicate with the device or the emulator and so on this file is also where we can modify configuration for instance the seed used by the emulator okay let's go to the requirements file here we list the dependencies required by python to run the tests you will find ragger py test and other libraries once this file is written it is possible to use the python package manager also known as peep to automatically install all these dependencies it's especially useful when tests are run by scripts in the context of continuous integration or by The Ledger vs code extension all right let's now take a closer look at the test case in test P key command this test checks that the app handles the get public key command correctly with the confirmation mode enabled it verifies that the user is prompted to confirm the address generated from the public key on the device screen additionally it confirms that when the user validates it the app Returns the public key derived from the path parameter and the seed used by the emulator okay let's go to The Ledger extensions tab select stacks and click on build we can now execute the test with display of the emulator enabled when running tests the extension uses peip to install the packages from the requirements file in a Docker container the whole test shoit is executed but let's fast forward to the test case we discussed a moment ago let's go over it line by line and see what's happening this is the entry point of the test the py test Runner calls it and passes the fixtures as arguments as we have seen previously the fixtures are defined in the com test file and are instantiated by py test when entering this function a client instance is created with the back end provided it is then used to send the get public key command to the app which in turn displays the first screen of the flow on Stacks tap events are needed to reach the confirmation screen so they are defined in this list the rager Navigator API is used to execute the instruction list and to compare the screen content with reference snapshots at each step after the address is confirmed the response from the app is retrieved and checked to summarize in this video we looked at the importance of functional tests we introduced the ragger framework and how to set it up and we saw it in action with the demo detailing the automation of an end to end use case now you can see how powerful it is so where do you go from here don't hesitate to play around with the many functional test of the boilerplate app you can also visit the developer portal for more information my name was Alexi see you soon hello everyone my name is Alexi and I'm a FAL engineer in the embeded ab team in this video we'll see how to perform device operations in The Ledger vs code extension we'll look at the quick initial setup which is a fast way of getting a new device ready with a developer seed and we'll learn how to load and delete apps on a device this tutorial requires having the prerequisites set up on your computer for more information on these please watch the video called development environment quick start in this series right let's go before we move on you need to know that device operations are not possible on Nano X okay let's talk about the quick initial device setup this operation is an easy way of getting a device ready with a seed also known as secret recovery phrase and pin code keep in mind that the seat phrase used during the quick setup is exclusively for testing the only safe seat phrase is the one generated by your device as part of the classic setup the quick initial device setup requires the device to be uninitialized and in recovery mode if your device is already initialized you'll need to perform a reset first there are two ways for that you can enter three wrong PIN codes when you turn on your device or you can use the available option in the settings menu let's see how to use the second option on an Nanos plus with the device turned on and unlocked do a long press on both buttons to enter the control center then go to manage device and security from here you can find reset option press both buttons to validate now let's see how to enable the recovery mode with the device turned off press and hold down the left button connect the device to turn it on and keep holding the left button until the boot menu appears select recovery mode and press both buttons to enable it okay let's head over to vs code first let's take a look at the extension settings it allows you to set the PIN code as well as the 12 or 24 word b 39 seat phrase once these are properly set with the device in recovery mode plugged into the computer you can select it in the extension and click the quick initial device setup button the extension is calling The Ledger blue python script to perform the operation it can take a few minutes but let's fast forward that's it the device is now properly initialized great now let's talk about loading and deleting apps on a device for these operations the device needs to be plugged into the computer and unlocked the firmware should be updated with the latest version from The Ledger Live app finally for loading you need to make sure you have built the app for the correct device let's go back to vs code for a demo let's open the target selection menu choose Nanos plus and build the app now with the device plugged to the PC and unlocked just click on the load button after that navigate on the device screen to validate the different steps if the app is already installed on the device it will be deleted and installed again deleting an app is just as easy keep the device plugged and unlocked and click on the delete button then validate the steps on the device screen to summarize in this video we looked at the device operations in the vs code DE tools extension we saw how to get a new device up and running and how to load and delete apps feel free to visit the developer portal for more information my name was Alexi see you soon

Automatic transcript — names and jargon may be misspelled.