Skip to content

Commit e0d0d79

Browse files
authored
Merge pull request #4 from muXxer/master
Added Ledger Blue
2 parents a9ff496 + 16a3101 commit e0d0d79

File tree

6 files changed

+168
-8
lines changed

6 files changed

+168
-8
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Intro
22

3-
You're about to install the IOTA beta app on the Ledger Nano S using our beta installer.
3+
You're about to install the IOTA beta app on the Ledger Nano S / Ledger Blue using our beta installer.
44

55
See [blue-app-iota GitHub repository](https://github.com/IOTA-Ledger/blue-app-iota) for the original source code.
66

@@ -15,6 +15,7 @@ Before getting started, please be sure you've [read the warnings](https://github
1515
## Requirements
1616

1717
Make sure that your Ledger Nano S is running firmware 1.4.2.<br>
18+
Make sure that your Ledger Blue is running firmware 2.1.1.<br>
1819
For update instructions see: [How to update my Ledger Nano S with the firmware 1.4](https://support.ledgerwallet.com/hc/en-us/articles/360001340473-How-to-update-my-Ledger-Nano-S-with-the-firmware-1-4)
1920

2021
## Installation of VirtualBox
@@ -32,13 +33,13 @@ You can download the latest version of the IOTA VM Installer Image here: [Releas
3233

3334
- Open VirtualBox
3435
- In VirtualBox, click "File" > "Import Appliance"
35-
- Browse to IOTA-Ledger-App-Loader.ova
36+
- Browse to "IOTA-Ledger-Nano-App-Loader.ova" or "IOTA-Ledger-Blue-App-Loader.ova"
3637
- Click "Next"
3738
- Click "Import"
3839

39-
## Installation on the Ledger Nano S
40+
## Installation on the Ledger
4041

41-
- Plug in your Ledger Nano S and enter your pin (you can leave it at the dashboard)
42+
- Plug in your Ledger device and enter your pin (you can leave it at the dashboard)
4243
- Open VirtualBox
4344
- Now select the new VM in the list on the left
4445
- Click "Start"
@@ -55,7 +56,7 @@ After the installation is done, you should see your IOTA app on the dashboard!
5556

5657
If it worked! Otherwise, feel free to head to issues and ask for help.
5758

58-
You can now continue to use the Ledger Nano S with a supported wallet app.
59+
You can now continue to use the Ledger Nano S / Ledger Blue with a supported wallet app.
5960

6061
## Contributing
6162

download_app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
min_version_os = 0x01040200 # e.g. 1.4.2 => 1.4.2.0 => 0x01040200
66
min_version_mcu = 0x01050000 # e.g. 1.5 => 1.5.0.0 => 0x01050000
77
file_name = "/root/iota-ledger/download/app.hex"
8-
data_size = 0x00000040 # `cat debug/app.map |grep _nvram_data_size | tr -s ' ' | cut -f2 -d' '`
8+
data_size = 0x00000000 # `cat debug/app.map |grep _nvram_data_size | tr -s ' ' | cut -f2 -d' '`
99
icon_hex = "0100000000ffffff00ffffffffffffffe7ffe75ffffff7e7ffe7fb7ffffffffff2fff3ffffffffffff" # python $(BOLOS_SDK)/icon.py $(ICONNAME) hexbitmaponly
1010
cmd_check_version = "-m get_ledger_version --targetId 0x%08X --minVersionOS 0x%08X --minVersionMCU 0x%08X" % (target_id, min_version_os, min_version_mcu)
11-
cmd_load_app = "-m ledgerblue.loadApp --path \"44'/4218'\" --path \"44'/01'\" --appFlags 0x00 --tlv --targetId 0x%08X --delete --fileName %s --appName \"IOTA\" --appVersion 0.0.1 --dataSize 0x%08X --icon %s" % (target_id, file_name, data_size, icon_hex)
11+
cmd_load_app = "-m ledgerblue.loadApp --path \"44'/4218'\" --path \"44'/01'\" --appFlags 0x40 --tlv --targetId 0x%08X --delete --fileName %s --appName \"IOTA\" --appVersion 0.0.1 --dataSize 0x%08X --icon %s" % (target_id, file_name, data_size, icon_hex)
1212

1313
exit_code = 1
1414
try:

download_app_blue.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import os, sys
2+
3+
python_cmd = "python3"
4+
target_id = 0x31010004
5+
file_name = "/root/iota-ledger/download/app.hex"
6+
data_size = 0x00000000 # `cat debug/app.map |grep _nvram_data_size | tr -s ' ' | cut -f2 -d' '`
7+
icon_hex = "0456572200585e34005e623f00636748006a6e510074775e007f806c008a8c79009a9a8b00a9a89e00b4b3aa00c1c0b800d0d1ce00e2e4e200edf0ee00f9f9f900ffffffffffdf8b0400000000000000000070cafdffffffffffffffffffad050000000000000000000000000060eaffffffffffffff8d0000000000000000000000000000000000e9ffffffffffbf00000000000000000000000000000000000000fcffffffff0a00000000000000000000000000000000000000b0ffffffcf000000000000000000000000000000000000000000fcffff0d000000000000000000000000000000000000000000e0ffff090000000000000000000000000000c91a0000000000a0ffdf000000000000000000000000000090ffbf000000000000feaf0000000000000000000000000000c0ffdf000000000000fc5f000000000000000011000000000090ffbf000000000000f70d000000000030ab51ee668c00000000c91a000000000000e00b0000000000b0ff89ffb9cfc60700000000000000000000c0080000000000b0ff19bb527cfa8a0500a26b001100000000b005000000000040ab0120010081e50c00fbdf71dd080000008000000000000000b608e80cb80480c804fcffc2ff1e0000000000000000000010fd5efb2efd891bc503e7bfc0ff1d000000000000000070dd18fe5fc509c8c56f1700200450cc070000000000000000d0ff0db70800000050978f00a5070000000000000000000000c0ff0d000000a50632302910fd5ea09d00000000000000000060cc0710ec0bfc2ded360410fe5fe5ff63490000000000000000208861ff3efb2cedd71e00c709d2dfe5df0100000000000000c0ff2afd1c610254c11c6018005059f7ef0200000000000000e0ff0d51000000000000e59f10bb02b18d0000000000007028c0ff0a0000a107000000e59f80ff095600000000000000fbdf1378000014f70c000040661840dd86ef06000000000020feff09009057ae91060000d08f00982290ff07000000000020feff0800c01a6b808d0000c17e40fe07328900000000000000e8cf0100a5338cc0cf00c02d0256cb42ee040000000000000020020000f978cf505a00c11d20de0050ee05000000000000000000000071015700c25d10328cab30bc55000000000000000000000000f909ea08f7af00309d1068ce00000000000000000000000000d808fc0bc25d0000208baf2500000000000000000000000000601883120080cd03506d380000000000000000000000000000d09f40dd06c0ff090001000000000000000008000000000000c07e80ff09b0ef16570000000000000000600a000000000000008118bb220157c0ff0800000000000000800c00000000000000f96f00fa4d00f5ff0c60170000000000b00e00000000000000f85e00fd8f00d1ff09fbcf0100000000d07f0000000000000070567aea4d94478950ffff0700000000f5bf0000000000000000d1ef3421fd8f0040feff0700000000faef0000000000000000e2ff0560ffbf0000eabf0000000000fdff0900000000000000809c0010fd8f000030040000000090ffff0e000000000000000000000082060000000000000000e0ffffcf000000000000000000000000000000000000000000fcffffff0b00000000000000000000000000000000000000b0ffffffffcf00000000000000000000000000000000000000fcffffffffff8e0000000000000000000000000000000000d8ffffffffffffffad040000000000000000000000000040daffffffffffffffffffdf8b0400000000000000000050b8fdffffffffff" # python $(BOLOS_SDK)/icon.py $(ICONNAME) hexbitmaponly
8+
cmd_load_app = "-m ledgerblue.loadApp --path \"44'/4218'\" --path \"44'/01'\" --appFlags 0x40 --tlv --targetId 0x%08X --delete --fileName %s --appName \"IOTA\" --appVersion 0.5.0 --dataSize 0x%08X --icon %s" % (target_id, file_name, data_size, icon_hex)
9+
10+
exit_code = 1
11+
try:
12+
exit_code = os.system("%s %s" % (python_cmd, cmd_load_app))
13+
if exit_code != 0: # muXxer: Otherwise it returned 256, which was recognized as 0 in the shell
14+
exit_code = 3
15+
except:
16+
pass
17+
sys.exit(exit_code)

install_alpine_environment_blue.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
apk update
3+
apk add --no-cache ncurses gnupg curl python3 python3-dev gcc git autoconf pkgconf musl-dev libffi-dev automake libtool libusb-dev eudev-dev linux-headers zlib-dev jpeg-dev
4+
gpg --import public.asc
5+
python3 -m ensurepip
6+
pip3 install --upgrade pip setuptools wheel
7+
pip3 install git+https://github.com/LedgerHQ/blue-loader-python.git
8+
cp iota_loader_blue /etc/init.d/
9+
rc-update add iota_loader_blue
10+
pip3 uninstall pillow
11+
apk del --purge python3-dev gcc git autoconf pkgconf musl-dev libffi-dev automake libtool eudev-dev linux-headers zlib-dev jpeg-dev
12+
rm -r /root/.cache
13+
rm -r /tmp/*
14+
dd if=/dev/zero of=/var/tmp/bigemptyfile bs=4096k ; rm /var/tmp/bigemptyfile
15+
history -c

iota_loader

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ start()
3131

3232
mkdir -p /root/iota-ledger/download/
3333
cd /root/iota-ledger/download/
34-
latest_file=`curl -s https://api.github.com/repos/IOTA-Ledger/blue-app-iota/releases | grep browser_download_url | grep app | grep .zip | head -n 1 | cut -d '"' -f 4`
34+
latest_file=`curl -s https://api.github.com/repos/IOTA-Ledger/blue-app-iota/releases | grep browser_download_url | grep nanos-app | grep .zip | head -n 1 | cut -d '"' -f 4`
3535
retVal=$?
3636
if [ $retVal -ne 0 ]; then
3737
echo ""

iota_loader_blue

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
#!/sbin/openrc-run
2+
# Copyright (c) 2018 muXxer
3+
4+
## Functions
5+
_bold=$(tput bold)
6+
_reset=$(tput sgr0)
7+
8+
_red=$(tput setaf 1)
9+
_green=$(tput setaf 2)
10+
_yellow=$(tput setaf 3)
11+
12+
function print_ok { printf "${_bold}${_green}%s${_reset}\n" "$@"; }
13+
function print_err { printf "${_bold}${_red}%s${_reset}\n" "$@"; }
14+
function print_warn { printf "${_bold}${_yellow}%s${_reset}\n" "$@"; }
15+
16+
depend()
17+
{
18+
after networking sshd
19+
}
20+
21+
start()
22+
{
23+
ebegin "Downloading IOTA-Ledger App..."
24+
25+
echo ""
26+
print_warn "Please read our documentation carefully at https://github.com/IOTA-Ledger/blue-app-iota/"
27+
28+
echo ""
29+
print_ok "Downloading latest compiled binary from https://github.com/IOTA-Ledger/blue-app-iota/releases..."
30+
echo ""
31+
32+
mkdir -p /root/iota-ledger/download/
33+
cd /root/iota-ledger/download/
34+
latest_file=`curl -s https://api.github.com/repos/IOTA-Ledger/blue-app-iota/releases | grep browser_download_url | grep blue-app | grep .zip | head -n 1 | cut -d '"' -f 4`
35+
retVal=$?
36+
if [ $retVal -ne 0 ]; then
37+
echo ""
38+
print_err "No compiled binary found in the GitHub repository! Do you have a working internet connection? Rebooting..."
39+
rm -R /root/iota-ledger/download/
40+
sleep 10
41+
reboot
42+
eend $retVal
43+
fi
44+
45+
curl -L $latest_file -O
46+
retVal=$?
47+
if [ $retVal -ne 0 ]; then
48+
echo ""
49+
print_err "Downloading the latest compiled binary from GitHub failed! Do you have a working internet connection? Rebooting..."
50+
rm -R /root/iota-ledger/download/
51+
sleep 10
52+
reboot
53+
eend $retVal
54+
fi
55+
56+
file_name=`echo $latest_file | rev | cut -d '/' -f 1 | rev`
57+
echo ""
58+
print_ok "Downloaded:"
59+
print_ok ' File name = "'${file_name}'"'
60+
61+
echo ""
62+
#echo "Unzipping the file and comparing the checksum..."
63+
print_ok "Unzipping the file and verifying the digital signature..."
64+
echo ""
65+
unzip ${file_name}
66+
echo ""
67+
#sha256sum -c app.hex.sha256
68+
gpg --verify app.hex.asc
69+
retVal=$?
70+
if [ $retVal -ne 0 ]; then
71+
echo ""
72+
#echo "Checksum missmatch! Something went wrong! Please try again! Rebooting..."
73+
print_err "Digital signature not valid! Something went wrong! Please try again! Rebooting..."
74+
rm -R /root/iota-ledger/download/
75+
sleep 10
76+
reboot
77+
eend $retVal
78+
fi
79+
echo ""
80+
print_ok "File unzipped and digital signature valid!"
81+
82+
echo ""
83+
print_warn "Plugin your Ledger Blue now and forward it in VirtualBox! You have 5 minutes to do this."
84+
print_warn "Searching for Ledger Blue..."
85+
echo ""
86+
87+
time_ms=0
88+
while [ $time_ms -le 300000 ]
89+
do
90+
if [ -e /dev/hidraw1 ]; then
91+
break
92+
fi
93+
94+
usleep 500000
95+
time_ms=$(( $time_ms + 500 ))
96+
done
97+
98+
cd /root/iota-ledger/
99+
python3 download_app_blue.py
100+
retVal=$?
101+
rm -R /root/iota-ledger/download/
102+
if [ $retVal -ne 0 ]; then
103+
echo ""
104+
if [ $retVal -eq 2 ]; then
105+
print_err "Ledger Blue Firmware is too old! Please update your Ledger Blue Firmware and try again! Shutting down VM..."
106+
sleep 5
107+
poweroff
108+
else
109+
print_err "Something went wrong! Please try again! Rebooting..."
110+
sleep 5
111+
reboot
112+
fi
113+
else
114+
echo ""
115+
print_ok "IOTA App installed successfully! Shutting down VM..."
116+
sleep 3
117+
poweroff
118+
fi
119+
eend 0
120+
}
121+
122+
stop()
123+
{
124+
ebegin ""
125+
eend 0
126+
}
127+

0 commit comments

Comments
 (0)