Step by Step Development Guide for Tron App on Ledger Hardware Wallet

in #tron3 years ago

This is a step-by-step tutorial to test Tron App code on Ledger Hardware Wallet. It is based on Ledger Nano S - but should also work for other hardware wallets such as Nano X

Prerequisites

You need to have hardware wallets (at least one).

  1. https://shop.ledger.com/pages/ledger-nano-x
  2. https://shop.ledger.com/products/ledger-nano-s

Fork and clone https://github.com/LedgerHQ/app-tron

Development OS

We can develop using Windows, MAC or Linux. But Linux (Ubuntu) is preferred. Virtual Machine is a good idea such as VirtualBox

Download Ubuntu: https://ubuntu.com/download/desktop

Fork and Compile

  1. git clone https://github.com/LedgerHQ/app-tron
  2. Download clang (for ARM) and unzip it

wget -c "https://releases.llvm.org/9.0.0/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz"

  1. unzip it via

tar -xvf "clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz"

  1. Download prebuilt gcc

wget -c "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2?revision=ca0cbf9c-9de2-491c-ac48-898b5bbc0443&la=en&hash=68760A8AE66026BCF99F05AC017A6A50C6FD832A"

  1. Unzip it

tar -xvjf "the tar.bz2 file you downloaded in step 4"

  1. rename both folders

mv clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04 clang-arm-fropi
mv gcc-arm-none-eabi-10-2020-q4-major gcc-arm-none-eabi-5_3-2016q1

Setting up the SDK

Now that you have your toolchain set up, you need to download / clone the SDK for the appropriate Ledger device you’re working with. Make sure you checkout the tag matching your firmware version.

  1. Ledger Nano S SDK: https://github.com/LedgerHQ/nanos-secure-sdk
  2. Ledger Nano X SDK: https://github.com/LedgerHQ/nanox-secure-sdk
  3. Ledger Blue SDK: https://github.com/LedgerHQ/blue-secure-sdk

Finally, link the environment variable BOLOS_SDK to the SDK you downloaded.

export BOLOS_SDK='/path/to/sdk'
//for example, /home/justyy/tron/nanos-secure-sdk

Also,

export BOLOS_ENV='/path/to/your/workspace'
//this is one directory up where you cloned app-tron

Install Dependency

sudo apt install libncurses5
sudo pip3 install ledgerblue
sudo pip install ledgerblue

Change python to python3 in Makefile

image.png

Make some code changes

For example, let's modify the text at src/main.c

image.png

Run make load to compile your latest changes:

image.png

"No dongle found" means that you need to plugin the Ledger Wallet.

Testing

Allow Unsafe Manager
b18392959c954d027b8b14138477c57.jpg

Confirm Action
image.png

Loading

image.png

Install App Tron

image.png

Perform Action

image.png

And it works!

image.png

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Thank you for reading ^^^^^^^^^^^^^^^

NEW! Following my Trail (Upvote or/and Downvote)

Follow me for topics of Algorithms, Blockchain and Cloud.
I am @justyy - a Steem Witness
https://steemyy.com

My contributions

Delegation Service

  1. Voting Algorithm Updated to Favor those High Delegations!
  • Delegate 1000 to justyy: Link
  • Delegate 5000 to justyy: Link
  • Delegate 10000 to justyy: Link

Support me

If you like my work, please:

  1. Delegate SP: https://steemyy.com/sp-delegate-form/?delegatee=justyy
  2. Vote @justyy as Witness: https://steemyy.com/witness-voting/?witness=justyy&action=approve
  3. Set @justyy as Proxy: https://steemyy.com/witness-voting/?witness=justyy&action=proxy
    Alternatively, you can vote witness or set proxy here: https://steemit.com/~witnesses

Sort:  

看不懂,感觉很牛逼

请验证🙏🏻帮助我

😄😁😀

[WhereIn Android] (http://www.wherein.io)

Why run as root in /home/justyy? Do you need to be root to compile or exec?

maybe not.

Ok. Didn't know if access to the wallet required root or something.