|
| 1 | +# Ethereum plugin documentation |
| 2 | + |
| 3 | +This documentation will help you design your own ethereum plugin. |
| 4 | + |
| 5 | +## What is a plugin? |
| 6 | + |
| 7 | +A plugin is a lightweight application that only performs smart contract parsing and leverages the Ethereum application for the rest. |
| 8 | + |
| 9 | +Your plugin will allow your users to clear-sign your smart contracts when using a Ledger device. |
| 10 | + |
| 11 | +Plugins are designed to work hand-in-hand with the Ethereum application: |
| 12 | + |
| 13 | +- The plugin handle the smart contract parsing |
| 14 | +- The Ethereum application handles everything else (APDU reception, signature, screen management, bluetooth, etc) |
| 15 | + |
| 16 | +Upon your smart contract reception, the Ethereum application will call your plugin to query the elements to display and your plugin will be responsible for: |
| 17 | + |
| 18 | +- Extracting the relevant information from the smart contract. |
| 19 | +- Replying the string to be displayed back to the Ethereum App. |
| 20 | + |
| 21 | +## Coding my own plugin |
| 22 | + |
| 23 | +### Use the Ethereum Plugin SDK |
| 24 | + |
| 25 | +Use the Ledger developed [Ethereum Plugin SDK](https://github.com/LedgerHQ/ethereum-plugin-sdk).<br/> |
| 26 | +The SDK will do all the busy work of your plugin and leave you with only a few handlers to code.<br/> |
| 27 | +The SDK is designed to be used as a git submodule. |
| 28 | + |
| 29 | +!!! note |
| 30 | + Always keep your SDK up to date with its **develop** branch.<br/> |
| 31 | + We are providing a CI workflow to help you check that the latest version is being used. |
| 32 | + |
| 33 | +### Fork the Plugin Boilerplate |
| 34 | + |
| 35 | +While starting a new plugin application from a blank repository + the SDK is technically possible, it is not *at all* recommended and support would not be provided.<br/> |
| 36 | +Instead, fork our official template application [Plugin Boilerplate](https://github.com/LedgerHQ/app-plugin-boilerplate) and start from there. |
| 37 | + |
| 38 | +You will start with a correct build structure, examples of handlers, our test framework working, and the CI workflows already setup. |
| 39 | + |
| 40 | +## Plugin file structure |
| 41 | + |
| 42 | +- `.github/workflows`: the [CI workflows](test_framework/ci.md) required to showcase your plugin's quality. |
| 43 | +- `Makefile`: The entry point of the compilation of your plugin. |
| 44 | +- `PLUGIN_SPECIFICATION.md`: The specification of the supported smart-contract and selectors of your plugin. |
| 45 | +- `ethereum-plugin-sdk/`: This repository contains the interface between the Ethereum app and your plugin, as well as a lot of utility functions. |
| 46 | +- `fuzzing/`: the [Fuzzer](test_framework/fuzzing.md) folder. |
| 47 | +- `glyphs/`: The icon displayed by the Ethereum application when using the plugin on a Touchscreen device. |
| 48 | +- `icons/`: The icons displayed on the device dashboard on any device. |
| 49 | +- `ledger_app.toml`: the [Manifest](https://github.com/LedgerHQ/ledgered/blob/master/doc/manifest.md) of your plugin, used to bridge with the Ledger developed tools. |
| 50 | +- `src/`: the source code of the plugin (in C). |
| 51 | +- `tests/`: the [tests](test_framework/ragger.md) folder. |
0 commit comments