Hardware wallets are one of the most secure way to handle your cryptocurrency like bitcoin.
The trezor is a hardware bitcoin and other cryptocurrency wallet made by satoshilabs used to secure online transactions. The security reside in the fact that the private key used to sign a transaction never leave the device to your computer.
The hardware wallet device connect via USB to a host computer. Any transaction that would imply sending money to someone must be signed to be considered valid by the cryptocurrency network, like the bitcoin network. To perform that, the transaction is sent to the hardware wallet device via USB. The user can confirm its authenticity on the device display and press a button on the device to sign it with the private key. The hardware wallet device will send back the signed transaction to the computer to be broadcasted to the internet. In this process, the private key is never accessed by the computer.
On the other hand, the raspberry pi zero is a low cost and small but powerful computer. It is used on numerous projects by ton of developers and hobbyists around the world.
In this web page I will show you how to create your own hardware bitcoin wallet based on the original trezor source code and that run on it on a raspberry pi zero (or pi 4). This is a fun, low cost, D.I.Y. project for any cryptocurrency enthusiasm!
Last minute note: with the latest Trezor application, if you see an issue about the device compromised, don’t panic. The latest update of the application validates if the firmware is legit. Since this is a custom firmware for the raspberry pi, it is not officially supported. But here is how to modify the app to support it:
Click the gear in the top right corner.Select the device tab. Scroll to the bottom and click “turn off firmware revision check”. Select the “I understood” option and click “Turn off” button
News:
refer to update procedure below before reflashing the SD card- Update 10 May 2023: pitrezor 1.12.1.0
- Based on trezor firmware 1.12.1
- Update 28 August 2022 : pitrezor 1.11.2.0
- Based on trezor firmware 1.11.2
- Update 31 May 2022: pitrezor 1.11.1.0
- Based on trezor firmware 1.11.0
- Update 3 February 2021: pitrezor 1.10.5.0
- Based on trezor firmware 1.10.5
- Now support Pi 0-2w. Still supporting Pi 0 and Pi 4
- Migrated yocto to version "honister"
- Update 20 December 2021: pitrezor 1.10.4.0
- Based on trezor firmware 1.10.4
- Update 29 September 2021: pitrezor 1.10.3.0
- Based on trezor firmware 1.10.3
- Update 26 July 2021: pitrezor 1.10.2.0
- Based on trezor firmware 1.10.2
- Update 23 May 2021: pitrezor 1.10.0.0
- Based on trezor firmware 1.10.0
- Update 30 March 2021: pitrezor 1.9.4.1
- Support of raspberry pi 4
- Update 18 February 2021: pitrezor-1.9.4.0.zip
- Based on trezor firmware 1.9.4
- Updated linux yocto platform to dunfell
Features:
- Low cost
- Easy to build if an existing raspberry pi hat is used
- Run on pi zero, pi zero 2w and pi 4.
- Use the original trezor One code. Only a thin layer is used to adapt the code to the raspberry pi Linux platform.
- All code modifications are open source, like the original trezor code.
- 100% Compatible with trezor web wallet to perform transactions.
- Use the hardware random number generator of the raspberry pi for more security.
- Can be very secure if you use a pass phrase (see security section below)
- Support small 128x64 OLED display and/or display via HDMI output.
- Adjustable display scale factor on HDMI output
- Fast boot (around 5 seconds)
- Software is free (but donations are accepted!)
Block diagram
- A raspberry 0 or raspberry pi 4 can be used
- An HDMI monitor can be used as the only display or as a second display with the OLED
- The OLED must have a 128x64 resolution, I2C or SPI
- The OLED and the the push buttons can be installed manually or a HAT can be used, as long as the OLED resolution is 128x64
- For the pi 4, a keyboard can be used as input.
Thus for the pi 4, it is possible to build a pitrezor with just the pi 4, a keyboard and a hdmi screen.
For the pi 0, you need the buttons as input (as part of the hat or soldered directly). The display can be HDMI and/or OLED. Starting with HDMI is a simpler solution when beginning and testing.
Photos
OLED Display:
Raspberry pi HAT:
(Picture courtesy of Damian Bevan)
It is also possible to use the Adafruit bonnet (see https://www.adafruit.com/product/3531) or similar HAT. In that case you just have to install the pins on the pi if required and connect the bonnet!
Quick start guide:
List of required components:
Required components for the PiTrezor |
- A raspberry pi zero (v1.3 to avoid unknown compatibility issue). You don't need the pi zero W, it cost probably a little bit more than the regular pi zero, but it will work anyway. The difference is that pi zero W has wifi and bluetooth but this project don't use it. The network drivers are not loaded by the platform so the W can be considered as secure. As mentionnend, you can use a pi 4 also if you already have one but it is more expensive than the pi 0.
- An SD card. The image to write on the SD card is very small (around 100 Megs) so virtually any decent SD card should work. Make sure you have one that is compatible with the pi.
- A good micro-usb to usb cable.
- A mini HDMI male to HDMI female adapter to verify the output via the HDMI output. You need HDMI cable and a TV or monitor too!
- Two push buttons (normally open contact, SPST)
- Some wires to solder the buttons to the p.
- Optionally, an I2C or SPI OLED display. Supported OLED are based on the SH1106 controller or Adafruit controller.
- Optionally, a box or enclosure for a more professional look.
You will also need standard tool like solder iron, pliers, ...
Of course, If you are using the Adafruit bonnet, you don't need separate
push buttons or OLED. Refer to Hat documentation about how to
connect the bonnet to the pi zero.
Videos:
(English): https://youtu.be/YrKo0QGWIuY
(Spanish): https://lbry.tv/@Loquesemepone:a/DIY-hardware-wallet-basada-en-Trezor:3
https://www.youtube.com/watch?v=smNDVt1GyL0
Step-By-Step instructions:
- If you don't have the software called "etcher" already installed in your computer, download it here : https://etcher.io/ . This software is used to write the program image to the SD card.
- Download the latest pitrezor SD card image by clicking here and select "save" to save the zip file
- Start etcher and follow the instructions. You will need to connect the SD card to your computer to flash the pitrezor image file.
- After the card is flashed, put it in the SD card slot in the pi.
- Connect the HDMI output to a monitor or tv using the cable and adapter. On the pi 4, use the mini HDMI connector just beside the usb-c connector.
- Connect the USB cable in the USB port near the center of the pi, not the one near the corner. Refer to next picture. For the pi 4, the usb-c connector is used.
- Connect the other end of the USB cable to your computer or a USB power supply. You should see the pi boot sequence in the monitor and after 4-5 seconds the trezor logo should appear. Good! That confirms that your pi and SD card are working correctly.
- At this point you cannot do much, so disconnect the USB cable, HDMI adapter and cable and remove SD card.
- If you are using the Adafruit bonnet, it is time to connect it and go straight to the "Configuration" section below. Otherwise, continue reading
- Solder the 2 buttons to the pi as showed in the following diagram. The left button (called "no") is connected to the pins 30 and 32 (in yellow in the next picture). The right button (called "yes") is connected to the pins 34 and 36 (in red in the picture). This is the default setup but can be tweaked from configuration file. The pi 4 use the same pins.
connecting the button - Put back the SD card in the pi and reconnect the HDMI and USB cable back to your computer.
- It should boot again, otherwise that means something went bad during the soldering of the buttons :(
- Open a browser on your computer and navigate to https://suite.trezor.io/web/
- You can be requested to install the trezor bridge but on chrome it is not absolutly necessary if your system support webusb. Select your operating system to download the correct bridge software if required and perform installation
- If you installed the bridge, close and reopen your browser and go back to https://suite.trezor.io/web/
- If you don't plan to use the bridge on Linux, don't forget to set the permission accordingly. Refer to setting up chrome on linux.
- If the bridge is already installed, you should see a message that invites you to connect your trezor. Connect the USB cable of your pi.
- The browser application should detect the device and invite you to perform the trezor setup.
- During the setup you will need the buttons to, at least, go from one seed word to another.
- If all is working correctly you can disconnect everything to solder the OLED display. The I2C OLED display need 4 wires to solder and the SPI OLED uses 7 wires. Refer to the next picture to determine how to solder the OLED depending on interface. The pins are the same for the pi 4:
- Connect the SD card back to your computer and refer to the configuration section below to correctly configure your OLED model and orientation. Their is only 2 possibles orientations so you can try both and see which one is better for you.
- Reconnect everything and retry your device. Now you should see the output on the HDMI connector if connected and also on the OLED at the same time.
- If that work, put everything in a box!
- Enjoy! And please don't forget to send a donation to continue the support this project update (see below). Any amount is welcome.
Download
The latest pitrezor SD card images:
For Pi 0 : click here for version 1.12.1.0
md5sum of the zip is e1140edb9b73270b02066d202d8ae665
For Pi 0 2W : click here for version 1.12.1.0
md5sum of the zip is 54a17e6afa7555af6a6471dfa1926f94
For Pi 4: click here for version 1.12.1.0
md5sum of the zip is 9497443c921375a508bf5429779d7917
Configuration
If you connect the SD card in your computer you should see a file named "pitrezor.config" in the first partition (boot partition). You can open this file with your favorite text editor. You will be able to change the configuration variables which are:- TREZOR_OLED_SCALE : This control the scale factor of the display to apply when using the HDMI output. A scale factor of 1 means the default size of 128x64 pixel. A scale factor of 2 will stretch the image to 256x128 and so on.
- TREZOR_OLED_TYPE: Specify the type of OLED connected to the pi zero. The file enumerate the different value and their meaning. Select the one that match your OLED display.
- TREZOR_OLED_FLIP: Set to 0 or 1 to control the image vertically (normal or inverted) This is useful depending how you assemble the OLED in n enclosure.
- TREZOR_GPIO_YES and TREZOR_GPIO_NO : Specify the GPIO number to use for the yes/no button. If you soldered the buttons like mentionned in the tutorial, you can keep the default values.
For the Adafruit bonnet, you must change the values to these:
export TREZOR_OLED_TYPE=1
export TREZOR_OLED_FLIP=1
export TREZOR_GPIO_YES=6
export TREZOR_GPIO_NO=5
Is this secure ?
The main difference of this device versus the real trezor device is that the pi zero stores everything on the SD card. The equivalent of the flash memory for the trezor is stored in a file on the first partition. That means that anybody that has your SD card can access your seed words and private key.However, the wallet supports the usage of a passphrase. The passphrase is a kind of an extra seed word that is not stored on SD card. By using a passphrase, you would prevent a thief that could have your SD card to empty your wallet.
Thus, the recommendation is to always use a passphrase!
Updating from previous pitrezor image
If you are updating your pitrezor to the latest image you will need your seed words with you:- Make sure that you have seed backup available. This mean your word list !! If not, you'll need to transfer all your funds to another wallet and disconnect other services (like U2F, password manager etc.
- Erase (Wipe) your pitrezor from trezor wallet or trezor suite application. This step improve the security before putting back the SD card in a PC in case it is infected.
- Put the SD card in a PC and copy your pitrezor.config file from the SD card to the computer
- Flash the SD card with the latest downloaded image
- Disconnect and reconnect the SD card to your computer
- Copy your pitrezor.config file from the computer to the SD card to overwrite the default version with your own version.
- Eject the SD card from your computer and install it in the pi zero
- Boot your pitrezor as usual
- When you will go to the wallet web site, your pitrezor will be detected as a new device. Select the recover option. You will have to enter all the words of your seed word list (advanced recovery mode is recommended so that your seed will never be entered on a computer).
- Don't
forget to enable the passphrase option after if you were using one
before. You should! If you haven't you can create new hidden wallet with
a passphrase.
For developers
The modification to trezor original code are available in this repo: https://github.com/heneault/trezor-firmware
The platform code is based on yocto to which I added my own layer and some build scripts. The repo is there: https://github.com/heneault/yocto-pitrezor
Questions ?
Comments are welcome in the comment section below. You can also reach me at info@pitrezor.com
Scan to send bitcoin donation! |
Donation !
A lot of work and effort has been put in this project and still needed to keep it up to date. If you like it, please consider giving a donation. Any amount is welcome!Bitcoin: 1trezor8MpRmFHcMCLdANpiVoEM9zqe2n
Paypal:
Copyright and Legal Warning
There are inherent dangers in the use of any software available for download on the Internet, and I caution you to make sure that you completely understand the potential risks before downloading any of the software.The Software and SD card image available on this website are provided "as is" without warranty of any kind, either express or implied. Use at your own risk.
The use of the software and SD card image downloaded on this site is done at your own discretion and risk and with agreement that you will be solely responsible for any damage to your computer system or loss of data that results from such activities. You are solely responsible for adequate protection and backup of the data and equipment used in connection with any of the software, and I will not be liable for any damages that you may suffer in connection with using, modifying or distributing any of this software. No advice or information, whether oral or written, obtained by you from me or from this website shall create any warranty for the software.
I make no warranty that:
- the software will meet your requirements
- the software will be uninterrupted, timely, secure or error-free
- the results that may be obtained from the use of the software will be effective, accurate or reliable
- the quality of the software will meet your expectations
- any errors in the software obtained from me will be corrected.
- could include technical or other mistakes, inaccuracies or typographical errors. I may make changes to the software or documentation made available on its web site at any time without prior-notice.
- may be out of date, and I make no commitment to update such materials.
In no event shall I be liable to you or any third parties for any special, punitive, incidental, indirect or consequential damages of any kind, or any damages whatsoever, including, without limitation, those resulting from loss of use, data or profits, and on any theory of liability, arising out of or in connection with the use of this software.
© Yannick Heneault, 2018 and up. Unauthorized use and/or duplication of this material without express and written permission from this blog’s author and owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Yannick Heneault with appropriate and specific direction to the original content.
The name and logo trezor are the properties of satoshilabs
The name and logo raspberry pi and raspberry pi zero are properties of the raspberry pi foundation
awesome work
ReplyDeleteWow this is very good. I will test this once I got the parts.
ReplyDeleteQuestion: In future, how about updates to the software?
Make sure you get the proper oled device. Right now I'm supporting only I2C (not SPI).
ReplyDeleteFor the update, I will align my updates on the official firmware release from trezor. Basically you will have 2 options. I will post a page with the details on first update. 1) You simply reflash the sd card. That mean you will lost all your data and will have to reenter your seed words via the wallet application. 2) You backup the emulator.img file in the boot partition on a computer. then you flash the sd card and you move back the emulator.img file. This is an extra manipulation but will save time.
Are there any pitrezor images to RPI 1, RPI2 or RPI3 variants? (What's the modification that are needed to pizero image?)
ReplyDeleteNo I only have pizero image because only this model can be used as a USB device.
DeleteOn regular pi, you can recompile trezor code in "emulator" mode to play with. You will simply need a keyboard and a screen to interact with it.
Is there a way to change the pins that the buttons use?
ReplyDeleteThis can be easily changed in the code but will require to recompile pitrezor. I'm about to release a new image, I could make it configurable via the config file if you need this feature.
DeleteThat would be awesome if you can make it configurable via the config file.
DeleteWould it be possible to add g_mass_storage to use the rest of the sd card?
ReplyDeletee.g. a third partition that takes up the remaining space and gets mounted as a usb drive when plugged in to devices.
I guess it would only be useful if the pi doesn't get unpluged
Exactly, I think their will be some risk of corruption if not disconnected at the right moment but that would be possible. A bootup script could extend the partition, format it and export it as usb key. Do you have an idea in mind about its usage?
Deletewell I would like to use it to carry around the browser Plugin for TREZOR and possibly a portable version of a web browser with the trezor wallet site as the homepage.
Deletemostly read-only files
DeleteThe different bridges and the chrome plugin could be downloaded and put in a usb image but the trezor javascript wallet code doesn't seem to be on trezor github anymore. Maybe an alternative like electrum, that can use the trezor hardwarde, could be preinstalled.
Deleteif config file had way to enable/disable and set read/write or read only mode
Deletemaybe it can be used to boot a pc to a Live OS
That could probably work. An iso could probably be exported (and kept read only) to avoid security breach from the host computer. Something to look at!
Deletehello,
ReplyDeletei'm using an ssd 1306 1.3" 128x64 OLED display from adafruit. it doesnt power on. is the wiring scheme the same? do i need to install any additional software? thanks.
Look at the pitrezor.config file on the sd and check that TREZOR_OLED_TYPE is set to the Adafruit SSD 1306 I2C
Delete'Adafruit SSD 1306 I2C' is 'OLED_ADAFRUIT_I2C_128x64'
Deleteso you change the number in the line
export TREZOR_OLED_TYPE=3
to a 1
export TREZOR_OLED_TYPE=1
Please let me know if that work correctly. I don't have myself this oled to test but the driver code in the platform should work. The I2C wiring is the same. I only tested using oled with sh1106 controller.
DeleteBtw, next release will also have SPI interface oled driver code in it.
Hi Yannick,
DeleteI changed the config to type=1 but it still wont power on. FYI my wiring scheme is (from OLED to pi zero):
Vin to pin 1
Gnd to pin 6
Data to pin 3
Clk to pin 5
Rst to pin 18
I bridged connections of the back of the OLED on pads SJ1 and Sj2, as mentioned by Adafruit to enable I2C functionality.
Is this correct? I can email you screenshots of the wiring if that helps. Thanks.
It works with the 'Adafruit 128x64 OLED Bonnet for Raspberry Pi'
Deletehttps://www.adafruit.com/product/3531https://ibb.co/nmzi1n
but the buttons and joystick on it need the pin config feature
pic of the screen working
https://image.ibb.co/dtZGMn/2018_04_15_170032_workingCopy.png
I used some jumper wires to get the buttons to work
-Damian
https://learn.adafruit.com/monochrome-oled-breakouts/wiring-128x64-oleds
Deleteif I'm reading this right Vin needs 5v but you have it plugged into pin 1 and that's 3.3v
http://webofthings.org/wp-content/uploads/2016/10/pi-gpio.png
pin 2 and 4 are 5v
Awesome work with the Bonnets! Would you mind sending some good pic to info@pitrezor.com. I could add it to the blog. I could also provide you a test image with gpio buttons configurable to test it.
DeleteI don't think you need rst to be connected in i2c mode. Maybe the 3.3v / 5v is the solution. Otherwise, you can probably follow adafruit tutorial to make sure its driver is working correctly. I found some tutorial for the 128x32 at https://learn.adafruit.com/adafruit-pioled-128x32-mini-oled-for-raspberry-pi?view=all to start playing with.
DeleteYannick I sent you an email just wondering if you have received it yet?
ReplyDelete-Damian
I just answered. You can check your email.
DeleteHi Yannick
DeleteIf we send you an email how long should we wait for a reply?
Hi Yannick
ReplyDeleteAre the pitrezor image is not available, links is not works.
I just restored the link for download. It seems my file hosting provider has some issue...
DeleteThank you for tutorial,
ReplyDeleteTrezor update firmware to 1.6.1, how can we update too?
I'm in the process of updating the image and documentation. It should be ready in the next few days.
DeleteHi Yannick, any good news on 1.6.1?
DeleteFinally I got the time to update the site! It is there!
DeleteHi,
ReplyDeleteAwesome tutorial.
I am also using the "Adafruit 128x64 OLED Bonnet for Raspberry Pi". (https://www.adafruit.com/product/3531).
I change the config file to use the OLED Bonnet. The OLED Bonnet powers up and displays the Lock with the "Go to trezor.io/start" text.
I installed the Trezor Bridge but the raspberry pi w does not connect to the Trezor Wallet. The browser application DOES NOT detect the device. Not sure what is the problem..... Any help would be appreciated.
Also, is there a way to configure the buttons on the Bonnet OLED screen?
Thanks,
Tony
Is the usb plugged into the port labeled "usb" on the pi?
DeleteThe next image will support the bonnet as-is, it should be available in the next few days.
DeleteYes, I plugged the usb cable into the port labeled "usb" on the pi and plugged the other end into the computer. It was not detected by the computer. At one point the computer did say "unrecognized usb", but it was not detected by the Wallet.
DeleteCool, cant wait for the new image.
Thanks for the help,
Tony
What operating system are you guys using? I am using Windows 10. Maybe that is the issue.... I also tried using the chrome extension, still didn't get recognized. The raspberry pi is not recognized by windows....
DeleteTony
Windows in general can be a bit fussy with usb devices.
Deletehave you tried plugging it into a different usb port on the windows system end (sometimes that works as it thinks its a new device and installs the driver)
But you still would need to wait until Yannick releases the next image to use the buttons on your Bonnet OLED screen.
If it still won't get recognized by windows let me know.
-Dave
Check with another usb cable if you can. Sometime a bad quality cable can cause this
DeleteStill working on it. I tried another usb port, still doesnt work. I tried a new usb cable, still doesnt work. I will wait for the new image that utilizes the Bonnet OLED.
DeleteThanks,
Tony
New image is there if you want to give it a shot. Maybe trying on another computer could be something worth to try.
DeleteAwesome! Thanks. So, I used windows 7 and it took a while to install drivers, but it worked. The raspberry pi finally connected to the computer and connected to the website. The buttons for the OLED Bonnet works too.
DeleteI'm glad to hear that! Congratulation!
DeleteDo you have a 3d-model (.stl) file for the closing box? I appreciate if you upload it as well!
ReplyDeleteI don't have the files but that would be awesome if someone could send them to me. For my version I used a standard ABS box and I cut plastic with a dremel cutting disc. My main concern with 3D files would be the buttons. Depending on the type of buttons, the position/size would not be the same. At least, Oled on the other hand are relatively standard.
DeleteAfter some research, I'll try to print the following module: https://www.thingiverse.com/thing:1193350 . Though, I agree with the concerns about the buttons.
DeleteSome things I noticed about it. The usb port opening is not the correct one. It seems to expose the usb power. Also it doesn't seem to have scoket to use screws to maintain the back in place.
DeleteThat is correct! After some modification it works great . I will upload the new stl files in the following week.
DeleteAny chance to get this working with the new firmware for the Trezor Model T? https://github.com/trezor/trezor-core
ReplyDeleteIt would require a touchscreen to be hooked to the Pi Zero.
Yes I was thinking of it but the price of a touchscreen color display make me think that this port would be less interesting as a DIY project.
DeleteWould such one be sufficient ?
Deletehttps://www.aliexpress.com/item/for-Raspberry-Pi-3-Model-B-3-5-Inches-Touch-Screen-Display-Monitor-480x320-LCD-Kit/32837597848.html?spm=a2g0s.13010208.99999999.267.6f6f3c008zzUkQ
seems to be already done https://gk2.sk/trezor-emulator-on-raspberry-pi/
DeleteCan you highlights the modification that you were doing to the trezor's source code ? (For security reasons, and to learn more about how to add new feature to it..). I found it really hard to make a diff with the trezor repo.
ReplyDeleteyou can see the diff to original trezor code directly in github : https://github.com/trezor/trezor-mcu/compare/master...heneault:pitrezor
DeleteFell free to ask questions if something is not clear
Hi Yannick,
ReplyDeleteGreat tutorial! I was wondering if I can get some help.
I am new to yocto. I am trying to understand yocto and the layers. Why did you created meta-pitrezor layer? Could you have just built a generic raspberry pi distro and run the trezor code on it? Is that possible? Im just trying to learn and understand. Thanks.
The meta-pitrezor layer allow me to add my port of the trezor application as part of yocto build. It also contain the image file that list the applications to install in the image file. This allow me to create a very small distro with only was is required to run. The layer also contains some fixes to other application and some custom configurations to reduce the image footprint.
DeleteI think yocto was the best choice for this project. Distro for the pi like raspbian contain a lot of softwares not required for pitrezor because they are more desktop oriented. Using a distro like this would have implied to remove or cleanup a lot of packages. With yocto I can select what I want to be installed more granulary.
I you have some other questions about yocto, feel free to PM me.
Hey, thank you for the tutorial! Unfortunately I'm having some trouble. I can get the device to show the Trezor screen on a TV connected via HDMI, but when I go to the trezor.io/start page, it never gets past asking me to connect my device to start.
ReplyDeleteAs a separate issue I can't seem to get the Adafruit Bonnet to work, but I think that's just my own problem with being unfamiliar with it.
some things you could try: Check with another usb cable, check with another monitor, check in system manager for the list of usb device connected to see if it is there. You can also try to reflash the sd card with an original Pi distro like raspbian to see if it boot correctly and if you have hdmi output.
DeleteHi friends. It's a great project, I've ordered parts and waiting for delivery. But I wanted to inform you that I am a graphic designer and a 3D designer. How will everything be made up at home, I will make a box and a public. If the interest and creator of the PiTrezor project will want, I can present myself as part of this blog. I ordered the Adafruit 128x64 OLED Bonnet. If I get in the Czech Republic, I will make a second modification. (or you can send it to me - I'll pay). Here it is just in the Czech Republic OLED model http://rpishop.cz/displeje/874-adafruit-128x32-pioled.html.
ReplyDeleteI apologize for poor English I am from the Czech Republic. My nick is MoDDO / fX - (moddo@moddo.cz)
I would also like to try this. Has anyone not tried yet? https://bit.ly/2IQZ6Fu
DeleteWOW! This is awesome. I have a few Pi Zero W units laying around, so I popped in a new 2G MicroSD card and followed your tutorial. I have a couple of cheap Ebay SPI OLED (128x64 .96") also which work perfectly with the following layout.
ReplyDeleteChanged the config file to use #4, with a zoom of 1.
RPI Pin OLED Pin
#17 -> DC
#18 -> VCC
#19 -> GND
#20 -> D1
#21 -> RES
#22 (not used)
#23 -> CS
#24 -> D0
The setup on the Trezor site was very easy, and worked perfectly using the buttons also. I have now ordered a non-wifi model of the PiZero dedicated for this purpose. I also have a 3D which I'll have to look at designing a case for this unit now. Something to hang off my car or house keys maybe.
Ok, I have made a 3D case for this as a thanks. It fits my unit just fine. Also, the RPI Pin# I quoted yesterday were reversed, sorry. Brain fade. The correct pin names here.
ReplyDeleteSPI - Your image
GND (GND)
VCC (VCC)
D0 (CLK)
D1 (MOSI)
RST (RST)
DC (DC)
CS (CS)
Hope you like it, feel free to modify for yourself.
https://www.thingiverse.com/thing:2984762
Wow impressive! Thank you for sharing the 3D files. I'm sure some people will use them!
DeleteThanks Yannick, the update worked fine. Entering the passphrases was simple enough to recover, and no more "Firmware Update requrired" on the trezor page. Appreciate the effort you have done here.
ReplyDeleteincredible work ..... is an update to the new firmware 1.6.3 planned? THANK YOU
ReplyDeleteThank you! Yes update is on the way
ReplyDeleteThank you for update version.!
Deletethanks for that quick update!
ReplyDeleteIs there a way to see the private keys by looking at the sd card on a pc? Could I enter my own private key on the sd?
ReplyDeleteby dumping the emulator.img file in the sd card you could retrieve the seed words that were used to generate the private keys. This is why you should always use a passphrase. The passphrase is not stored on the sd card and act as an extra word in the conversion from the word seed list to private keys.
ReplyDeleteHave you considered encrypting the SD card with LUKS?
ReplyDeleteSeems this could drastically increase security.
Would also be good to limit number PIN tries + auto wipe seed.
The protection would be limited. I'm trying to minimize the changes with the original trezor code to avoid to introduce all kinds of possible errors (security, malfunction..) and to keep 100% compatibility with the online wallet. Also, all the code is open source, so anybody could review it and see how encryption is used. The passphrase could in theory be used to protect the partition that hold the flash image, but, when the online wallet is asking for it when the trezor is connected, the flash image is already loaded by the pitrezor to tell wallet to ask for the password. This is a chicken'n'egg problem. I could solve it by breaking the flash in 2 parts (one encrypted, one not) but that will be a big change from the original code.
DeleteThe pin is not a real protection because it can be extracted from a dump of the flash image. The best protection is the passphrase because it is never stored.
For the 'ultra paranoid' security conscious people, couldn't you just add passphrase protection, then remove the SD card from your Pi-Trezor, put it in your "Etcher" application and create a new image, then encrypt the image with say TrueCrypt (yes I know about it's apparent flaws) and store it on a second USB drive somewhere offline, and extract the encrypted image only when needed?
ReplyDeleteThis is untested by myself, just theory in my head.
Hello there! Thank you for this amazing work.
ReplyDeleteLooking at build-pitrezor.sh I noticed that it is using /dev/random as a source. How safe it is? Shouldn't it use /dev/hwrng instead?
https://www.raspberrypi.org/forums/viewtopic.php?t=127706
The daemon rng-tool is running as a separate process. This is the one that read from /dev/hwrng and feeds /dev/random to keep entropy high. The kernel will mix that source of entropy with others sources. This way, reading from /dev/random cannot block because you always have the hw generator as a fallback source of entropy. It still secure because it is not the only one source and it is better than urandom because the kernel avoid the pseudo software number generator (/dev/urandom)
DeleteLGTM. Thanks for detailed answer.
ReplyDeleteIs there anyway to change the welcome image?
ReplyDeleteyes, you can follow information from here https://wiki.trezor.io/User_manual:Homescreen
DeleteHi there. Yannick, you made a great job! I followed your instructions and made this device. I had no Pi Zero available, only Raspberry Pi Model A+ and 3B, fortunately Pi Model A+ allows similar configuration, but you need USB Type A (Male to Male) cable to connect to PC and replace string in config.txt file on SDcard "dtoverlay=dwc2" to this one "dtoverlay=dwc2,dr_mode=peripheral". Hope this helps someone.
ReplyDeleteHi. I was unaware the model a+ could work as usb gadget! I will try it. Did you had to add the proper boot files in the boot partition because my image contains only the file for the pizero? Thanks for sharing.
DeleteI just used precompiled firmware that you provide, because A+ and Zero share the same hardware, no additional boot files needed. Good luck.
DeleteJust finished the assembly, works great, thanx Yannick!
ReplyDeleteProtected all the solder joints and reinforced the usb connector with the steel epoxy.
The case is 3d printed, just slightly larger than the pi zero itself.
Feel free to check the photos:
https://i.imgur.com/aiXNuaT.jpg
https://i.imgur.com/EWt60JR.jpg
https://i.imgur.com/bfAlP8f.jpg
Hey! Great Works. Look professional. Thanks for the good word!
DeleteI like how slim you made the unit! Congrats. I'll have to do some thorough redesign of my quick hack case to look as good as yours :)
DeleteGreat 3d printed design! Could you share your 3d design?
DeleteThis comment has been removed by the author.
ReplyDeletedo i need a mini HDMI male to HDMI female adapter? i dont have one. can i directly connect with jumper cables plugged in to the OLED display via GPIO PINS????
ReplyDeleteBTW can u tell me the OLED TYPE for this one? https://www.aliexpress.com/item/32595065663.html
This comment has been removed by the author.
DeleteThe hdmi connector is needed only if you dont have an oled. But because you seems to have one, it can be used to help troubleshoot if the oled is not working, i.e. the hdmi clone the oled output so it should shows that pi is running software correctly.
DeleteThe oled is probably one of two type OLED_ADAFRUIT_ SPI OR I2C depending on interface.
works perfectly. There is a new Trezor version btw ;-)
ReplyDeleteThanks! Yeah I will deploy the update soon :)
DeleteHello, i will be also writing this via e-mail. I was wondering if it would be possible to use this with a 16x2 LCD display? Thank you so much.
ReplyDeleteGreat Work!
ReplyDeleteIs there a way to way to run this and an alternative OS?
A dual boot option selectable on the screen perhaps?
Is the model T code able to be emulated in this way?
Just questions, thank you for your hard work!
The current OS is based on yocto but yes in theory another OS like raspbian should work. However, it would require to apply the same patch (kernel linux patch) to work properly.
DeleteFor the model T, I didn't invest time into it as it would require a color touch screen LCD and that would increase the cost of this project.
I meant like a dual boot situation.
DeleteHold one button to boot into the wallet, hold nothing for say, raspbian to load.
More stealthy...
I see about the model T as far as touchscreen goes.
Thank you, once again, for your hard work. It is awesome.
Would love to see the key/passphrase encrypted on the SD card, and unlockable via added NFC, such as an NFC ring or yubi key.
ReplyDeleteThat would be great as a fork project because I try to keep 100% compatibility with original trezor
DeleteThis comment has been removed by the author.
ReplyDeleteHi Yannick!
ReplyDeleteFirst of all awesome work thanks for your effort! :)
I was just logging in in my pitrezor and realized there is a new firmware. (1.9.0)
Can we expect an update in the near future?
Hi Yannik.
ReplyDeleteThanks for your great work.
Any plans for an update of the firmware?
Yes update is in progress. I'm doing the testing...
DeleteThat's great news.
DeleteThanks again for your great work.
Thanks for the update! :)
DeleteNo problem. Don't forget that donation are always welcome!
Deletehey bro are you working on the new version too . thank you
ReplyDeleteCould you explain to me how to solder the buttons. I tried and they didn’t work for me . What pins should I be soldering ?
ReplyDeletelook carefully at step 10 to know where to sold them. You must use buttons that make contact when you press them (current flowing when pressed). You can try with a tester on that back of the pcb to check if current is flowing when pressed. Could be a bad solder.
DeleteThis comment has been removed by the author.
ReplyDeleteIs it possible to encrypt the sd card in a way that it will work ? do u have any suggestion how i can do it ? or is it not possible ? I looked it up and a lot of answers says its in general very difficult to encrypt a sd card or not worth bc of the power and so on. How can i secure the hardware wallet more? Thank you very much! :)
ReplyDeleteEncryption would require to change the original firmware and wallet software to let the user input the key to unlock part of the SD that contain the firmware (at least the seed). This change would made the pitrezor not compatible with the current trezor ecosystem. The best thing right now is to use a passphrase when you open the trezor wallet. This is fully supported by the trezor wallet and the passphrase is not stored on the SD card so it provides a good protection.
DeleteHello, thank you very much for such a good tutorial, I have applied it and I just have my wallet working perfect. Now Trezor has just released a firmware update, how should I apply the update, can I do it directly from the Trezor page, how to follow the steps for the commercial device, or should I do it by loading the new firmware to SD memory? I have that little question. I appreciate the information.
ReplyDeleteThank for the good feedback. No, you cannot use the official firmware from trezor because it is not compatible with the pi. I will provide a new firmware update on this site in the next few days...
Deletedoes this version of setup support all the coins? such as XRP?
ReplyDeleteIt supports the same coins as the original trezor https://trezor.io/coins/
Deletehello im using the Waveshare oled LCD 1.3 i got a black screen can you help me ? thank you yan
ReplyDeletefixed not but windows 10 can't show the trezor it's not detected
DeleteHello Yann sorry can you help me about my issue my pitrezor is not recognized
ReplyDeletesome things to check:
Delete- make sure the usb cable is connected in the proper usb port of the pi zero (refer to image)
- try to use the wallet with the latest version of chrome.
- try to install the trezor bridge
- make sure your usb cable can transfer data.
- try different usb ports on the computer (front/back)
- to make sure it this not an hardware issue, you can try the standard raspberry pi image configured as a usb network connection : https://www.instructables.com/id/Raspberry-Pi-Zero-USB-Dongle/
Thank you very much for your work.
ReplyDeleteThere is a new firmware update for trezor. Are you planning to update the piTrezor?
Thank you very much
yes the update should come in the next few days
DeleteThanks Yannick!!
DeleteI have made a video about the pitrezor in Spanish
https://lbry.tv/@Loquesemepone:a/DIY-hardware-wallet-basada-en-Trezor:3
I hope it helps to publicize the Pitrezor
Thank you very much or the video. I had the idea of doing something similar but I don't have the talent for that. I put the link to your video in the page just beside the instructions.
DeleteCurious, I am looking at using the Adafruit minipitft display (https://www.adafruit.com/product/4393) because it has 2 buttons built in and just thought it would be slick. However I'm not sure if it's compatible do you have any knowledge of this working?
ReplyDeleteit seems to have a kernel driver so maybe the SDL layer that is used to drive the frame buffer for the HDMI output could be used as-is or with few modifications.
DeleteThat is the info I needed, thank you so much for responding!
Deletedid you get this working? if so, would you mind sharing the config you used?
Deletethat looks like a very neat option.
This comment has been removed by the author.
ReplyDeleteYannick, this is a really great work! Congratulations! I have two small questions, you mention that it can be created a wallet passphrase to add more security, where do you create it? And second one, with this image you can create either a Trezor One or Trezor T wallet? Thanks in advance.
ReplyDeleteThank you. Here is the link that explain passphrase https://wiki.trezor.io/Passphrase
Delete. For the image it support only the Trezor One
Hi Yannick!
DeleteIf I've already a wallet created and I want now to add a passphrase, is it possible? I have to make a new wallet with the passphrase and send the crypto from one to the other? Sorry my noob question :)
Unfortunately, you will have to make a transaction (and pay the transaction fee) to move the fund from the original account to an address controlled by the password protected account
DeleteHello, ask. Has anyone used pioled tft 1.3" inch 240x240 tft add-on oled spi interface for raspberry pi (https://a.aliexpress.com/_BTzImT) successfully for pi trezor configuration? I intend to buy this model.
ReplyDeleteHello! Coukd you solve this? Im using an OLED SPI of 128x128 and cant get the image working
Deletehello dude, usually i dont comment out on anything however I would like to thank you for the excellent job on this one! i just managed to install on my new pi zero w + waveshare display from aliexpress, I really hope you can keep up updating new versions as they come.
ReplyDeletethanks!
Thank you for the comments (and don't forget small donations are always welcome). I usually post update a few days after they are released officially by trezor.
DeleteWould you share the config you use for the waveshare display and in which mode you configured it ? Thank you
DeleteYes definitely! I am using pi zero w as mentioned, My display in question is from ali express: Waveshare sh1106 > https://pt.aliexpress.com/item/4000266744249.html?spm=a2g0s.9042311.0.0.5e2ab90a3k9CMC
DeleteThis display has 3 KEY buttons and a FULL joystick although we are only using KEY1 (CONFIRM) and KEY2 (CANCEL). The config file looks like this:
# Scale factor of display when using hdmi
export TREZOR_OLED_SCALE=2
# Type of oled to use
export TREZOR_OLED_TYPE=5
# Flip the display vertically. Set to 0 or 1
export TREZOR_OLED_FLIP=0
# Set gpio number to use for the yes/no buttons
export TREZOR_GPIO_YES=21
export TREZOR_GPIO_NO=16
Those last 2 numbers from GPIO Pins were taken from waveshare PDF documentation about the display (over their website)
Here you have some pics so you can add to the post.
- https://preview.redd.it/vhwuxkg4i8061.jpg?width=3024&format=pjpg&auto=webp&s=726a9d190908304ce668918959f7d4a2d2222ee4
- https://preview.redd.it/jluo5a6hi8061.jpg?width=3024&format=pjpg&auto=webp&s=1234da1db2df67abe20f7046c287600e3ca619b2
thanks again for your time yannick really appreciate it
Thank you. This will help other guys with the same display!
DeleteStrange question can i try it on my pi4 ?!
ReplyDeleteI think it could be possible but not with the current image (1.9.3) I hosted here. I think the pi4 can be used in usb otg mode (i.e. as a slave usb device) However, that would be overkill to run the trezor firmware ! If their is interest, I could try to update my next platform release to support it.
Deleteyeahh for sure if you can just do it for the pi4. could be good for some people i know its not for the pi4 but why not and thank you again! Yannick really really i appreciate what you do for us . iam a pi4 and pizero w owner btw
DeleteHello I just noticed that something is wrong with the firmware. It's OK with my pizero wh but won't work with the pizero 1.3
ReplyDeleteIt is strange because is should be the same board. The WH has the GPIO header presoldered
Deletehello you think its possible to build a model t firmware for this board ? https://www.st.com/en/evaluation-tools/32f429idiscovery.html
ReplyDeleteI am not sure that board is touch screen. Otherwise from a quick reading of the spec that would seem possible but that would be a totally different project of the one
Deletecool thank you
DeleteExtremely well-documented and satisfying project! Small donation does not reflect my massive appreciation!
ReplyDeleteThank you very much for you good feedback and donation. This is always appreciated! I hope you had fun building it.
DeleteHi, Please can I connect LCDTFT ili9341 320x240 ? pinout ? Thanks.
ReplyDeleteNo it will not work
DeleteThank you.
Deleteis this still stable using the pi zero w?
ReplyDeletedoes the trezor build disable the onboard wifi?
Yes, in the default image I don't initialize the wifi nor the Bluetooth to improve security so it is safe to use the pi zero w. Personally, I use this model only for debugging or troubleshooting (via network) by using a special debug image.
DeleteThanks for your great work and happy new year:) Do you accept donations in other currencies? Network fee on btc currently is almost as big as donation I would like to make.
ReplyDeleteI have a paypal link also that you can use if this is easier. Thank you very much in advance!
DeleteHi Yannick, I tested this on my Pi zero using firmware 1.9.3. I noticed a bug which caused it to crash.
ReplyDeleteWhen using non-English characters in the passphrase (i.e. Japanese) the pitrezor process seems to crash with a flash of text on the screen. This is followed by the pitrezor process restarting. I also tried a passphrase using Chinese characters, the same thing happened.
Note: I use Japanese characters on my existing Trezor wallet which is running firmware 1.8.1. It doesn't have any problem.
Interesting, can you update your existing trezor to firmware 1.9.3 to compare. I will check this on my side too.
DeleteDoes it work on 128x128 displays? I am using this one:
ReplyDeletehttps://www.amazon.ca/gp/product/B07RLPL7FS/ref=ppx_yo_dt_b_asin_title_o01_s01?ie=UTF8&psc=1
I am able to output to my pc screen but the LCD is only displaying a white screen
no it require oled of proper dimension to match firmware (128x64)
DeleteGreat work man. Installed and works as intended although I couldn't create xlm wallets through stellar account viewer (webUSB) and it just keeps loading nor sync with exodus even with the latest bridge installed.
ReplyDeleteTrezor Suite works fine too. Thanks again man
Your welcome! I never tried stellar. If that help, I know that it works with electrum on a local PC.
DeleteI just bought the parts for this. I can't wait to set this up and keep my ERC20 tokens safe
ReplyDeleteAny progress on your side?
DeleteHi Yannick, awesome work! Based on your guide I am planning to build my own trezor as well. Could you just tell me, since I am not that skilled in the problematics, what happens if you will one day decide not to support the development of this beautiful solution any more? Will still my own built hardware trezor be still compatible with the online trezor interface? Or would I need to transfer my hardware bitcoin wallet somewhere else? Just trying to assess all the risks... Thanks a lot for your time!
ReplyDeleteAs long as trezor respects the same communication protocol it should work. I doubt they will change it for backward compatibility with old devices. In the eventuality of an issue, you can download and use the electrum wallet on your computer which can connect to the pitrezor/trezor. A third alternative could be to switch to a real trezor and recover the wallet with the exacts same seed words.
DeleteHello , Can I do this with a raspberry pi pico or I need to do with a raspberry pi zero ?
ReplyDeleteFor the moment, this only work on the pi zero.
DeleteIs there a way to get the 240x240 1.3" hat from adafruit to work?
ReplyDeletenot out-of-the-box. That would require to modify the code
DeleteHi, thank you for making this and sharing with us. I have the same question about adafruit bonnet 1.3 TFT 240x240, how can I use it, can you share settings or code to change that so we can use this bonnet please? I'm willing to give donation for this to work ;-) Thanks
DeleteThank you for your work. Do you have any plans in the future to have support for firmware for Trezor T?
ReplyDeleteNot for the moment. The trezor T need a OLED with touchscreen which would increase the price to this project
DeleteHello Yannick,
ReplyDeleteFirst of all great work.
I just made two of them one for me and one for a friend.
I want to ask if its ok to edit pitrezor.config after storing some coins(lets say im using my computer screen for now and im going to buy a screen(an I2C or SPI OLED or even Adafruit bonnet) after some months.
Thanks in advance!
Their is no problem. You can edit the config anytime. This doesn't interfere with the normal operation of the trezor/pitrezor.
Deletecould this also work with an Kobo mini?
ReplyDeleteI don't think so. I don't think kobo as open sourced their platform and I would doubt they have a good random number generator.
DeleteHello, I would like to compliment you, your work is precious! As a designer I am proud to contribuite to this project, I made a case for the PiTrezor, let me know what you think of it https://www.thingiverse.com/thing:4749545
ReplyDeleteI'm having troubles with your paypal link for the donation, let me know if it works for you
Wow I am impress, very nice design! Mine is more thick but I will give your a shot eventually because it look like more compact. Adding the name on it (pitrezor) add to the elegance :)
DeleteThanks to tell me about the broken Paypal link. I refresh it. It should work now.
Anyone know for sure that the PiTrezor below Zero v1.3 does not work?
ReplyDeleteThe best is to try it!
DeleteHi, perfect project. I ordered the stuff to build one and am really looking forward. I have one question. Would it be possible to use a epaper screen on the pi for this, it would look really cool and the buttons could be on the back or sides...
ReplyDeleteright now the driver for the epaper screen is not there but that would be great
Deletefrom my understanding 128x128 SPI OLED will not work because of firmware.
ReplyDeletebut, is it possible to edit the code to make it match ?
alos, it possible, i dont mind if half of the screen will be off to match 128x64.
is is possible ?
where should i look ?
this is the screen i am talking about: https://www.waveshare.net/wiki/1.44inch_LCD_HAT
many people ask this question but unfortunately I didn't added other drivers than for the 128x64 displays. To support the 128x128 or other format would required to add new driver for the device variation. I added a command line tool that could help to implement it in C.
ReplyDeleteHowever, I am in the process of leverage the platform and the kernel. This should enable me to use the builtin linux lcd driver which cover more model.
New versions of Trezor firmware are now available.
ReplyDeleteyes I know. I will try to perform the update and the tests for this week.
DeleteSince the pi 0 is many times faster than the Original trezor 1, is it possible to run trezor model t firmware except still have the trezor 1 interface? I want to store monero on the trezor but it seems like its not possible with the slower speed of the original trezor one... Is there any way I can bypass this?
ReplyDeleteI second this. I wish to store Monero among other coins.
DeleteAlso, is it possible to use the Raspberry Pi Pico in the future?
For the model T, I was not considering whenit I started this project as it required a touchscreen color lcd and that was expensive. However, things have change since, price are going down and trezor support only some coins on the model T. So this is something I am considering to check in a near future.
DeleteFor the pico am not quite sure. Since their is no Linux OS, the emulator would have to be ported to the provided sdk directly.
I look forward to your future plans. Thank you for this project. I love it so much. If you can get the model T features that would be great but you've done a lot already :))
DeleteThe SD card capacity matter ?
ReplyDeleteNo. The firmware is so small any today's SD cards will work.
DeleteThank's for your reply
DeleteGood evening,
DeleteWhen do you think the latest firmware will be available to load on to the device? Also I just built mine today following your guide it works flawlessly! Expect donation soon, fun and cost saving project.
So, I have a few 128mb SD cards from flashing BTT 3d printer boards. With these cards it did NOT work. When I flashed an 8gb card, it worked.
DeleteI read online that the pi zero cant be used in "gadget mode" with a card less than 4GB.
However, I am having another issue, I have a few of these OLEDS:
https://www.amazon.com/gp/product/B076PM5ZSJ/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&th=1
I have used them in other projects without issue, however, they are not working for this. I have tried both I2C options in the config file to no avail. Is it possible they need to be connected to different pins?
For the oled, it seems they use an i2c address that is different from the standard. Contact my in private. I will try to send you a new build to test if we can make it work.
DeleteI seem to be having trouble with the actual connections of the device and I can't find a fix. The image works perfectly and displays, however the Trezor website wont recognize it. I've tried every single USB cable I own and bought high quality ones hoping to fix the issue, but no dice.
ReplyDeleteAny idea what might be the problem here? It only seems to be a connection problem. I'm using the most recent firmware for the PiTrezor and have reimaged and tried virtually everything I can think of.
This comment has been removed by the author.
ReplyDeleteHi! I uploaded a video of the building of the pitrezor with the case I designed. Check it out: https://youtu.be/jHhMpy6VFOI
ReplyDelete