Documentation
X - Create Coin Module

3 - Create Coin Module

Organization

All CoinModules are located in libs/coin-modules (opens in a new tab).

A CoinModule has the following directories/modules:

  • api (optional): interface for exposing the CoinModule to a backend service (cf. (TODO))
  • bridge: implementation of Bridges interface (cf. Bridge)
  • logic: contains all core logic of the blockchain. The code here is agnostic of all external interface (i.e. Bridge or Api) and relies only on external libs and network directory
  • network: communication logic with explorer/index/node (cf. How to wrap you api)
  • signer: defines the interface definition to the Embedded App and the logic to retrieve derive address

Some architectural decision

For consistency among all the CoinModule, please consider the following principles:

  • Always use an index.ts file in each directory. The goal is to "control" what is exposed from the module and allow to be used from outside.
  • The index.ts in the root of the CoinModule should only expose:
    • Bridge interface
    • Bridge type
    • bot test
    • ...
  • Inside CoinModule, the dependency between module is only one direction (avoid cyclic dependency or mutual ones). Example: From the logic module, it is forbidden to use some functions declared in bridge.
Coin Module inner dependency

...

The following steps (3-A to 3-D), your work will have some impact on the Ledger Live repository (opens in a new tab).

Therefore, make sure you have setup your environment to work with ledger-live.

Ledger
Copyright © Ledger SAS. All rights reserved. Ledger, Ledger Nano S, Ledger Vault, Bolos are registered trademarks of Ledger SAS