diff --git a/README.md b/README.md index 3a23b684..572f4946 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Build an offline, airgapped Bitcoin signing device for less than $50! -![Image of SeedSigner in an Orange Pill enclosure](https://github.com/SeedSigner/seedsigner/blob/main/Orange_Pill.JPG) +![Image of SeedSigner in an Orange Pill enclosure](docs/img/Orange_Pill.JPG) --------------- @@ -77,56 +77,63 @@ https://youtu.be/aIIc2DiZYcI --------------- ## MANUAL BUILD INSTRUCTIONS: +Begin by preparing a copy of the Raspberry Pi Lite operating system (https://www.raspberrypi.org/software/operating-systems/) on a MicroSD card. Their [Raspberry Pi Imager](https://www.raspberrypi.org/software/) tool makes this easy. -The software can also be manually installed using an internet-connected Raspberry Pi 2/3/4 or Zero W are as follows: +SeedSigner installation and configuration requires an internet connection on the device to download the necessary libraries and code. But because the Pi Zero 1.3 does not have onboard wifi, you have two options: -Install the Raspberry Pi Lite operating system (https://www.raspberrypi.org/software/operating-systems/) on a MicroSD card and install the card in a Raspberry Pi 2/3/4 or Zero W. +1. Run these steps on a separate Raspberry Pi 2/3/4 or Zero W which can connect to the internet and then transfer the SD card to the Pi Zero 1.3 when complete. +2. OR configure the Pi Zero 1.3 directly by relaying through your computer's internet connection over USB. See instructions [here](docs/usb_relay.md). -Connect a keyboard & monitor, or SSH into the Pi if you're familiar with that process. +Connect a keyboard & monitor to the device or SSH into the Pi if you're familiar with that process. -* `sudo raspi-config` +### Configure the Pi +On the Pi bring up its system config: +``` +sudo raspi-config +``` -(set your localization options, configure WiFi if necessary, but most important: navigate to the "interface options" and enable the "SPI" interface; also make sure to enable the camera interface in raspi-config) +Set the following: +* `Interface Options`: + * `Camera`: enable + * `SPI`: enable +* `Localisation Options`: + * `Locale`: arrow up and down through the list and select or deselect languages with the spacebar. + * `en_US.UTF-8 UTF-8` for US English + * `Timezone`: Select region first, then timezone (e.g. America; Central). +* WiFi settings (only necessary for the option #1 setup above) -Reboot when prompted within the raspi-config interface +Reboot when prompted within the raspi-config interface. Install these dependencies: -* `sudo apt-get update` -* `sudo apt-get install wiringpi` -* `sudo apt-get install python3-pip` -* `sudo apt-get install python3-numpy` -* `sudo apt-get install python-pil` -* `sudo apt-get install libopenjp2-7` -* `sudo apt-get install ttf-mscorefonts-installer` -* `sudo apt-get install git` -* `sudo apt-get install python3-opencv` -* `sudo apt-get install libzbar0` -* `sudo apt-get install python3-picamera` +``` +sudo apt-get update && sudo apt-get install -y wiringpi python3-pip python3-numpy python-pil libopenjp2-7 ttf-mscorefonts-installer git python3-opencv libzbar0 python3-picamera +``` -Install this: -* `wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.60.tar.gz` -* `tar zxvf bcm2835-1.60.tar.gz` -* `cd bcm2835-1.60/` -* `sudo ./configure` -* `sudo make && sudo make check && sudo make install` -* `cd ..` +Install the [C library for Broadcom BCM 2835](http://www.airspayce.com/mikem/bcm2835/): +``` +wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.60.tar.gz +tar zxvf bcm2835-1.60.tar.gz +cd bcm2835-1.60/ +sudo ./configure +sudo make && sudo make check && sudo make install +cd .. +rm bcm2835-1.60.tar.gz +``` -Install these python dependencies: -* `sudo pip3 install --verbose spidev` -* `sudo pip3 install --verbose RPi.GPIO` -* `sudo pip3 install --verbose pillow` -* `sudo pip3 install --verbose embit` -* `sudo pip3 install --verbose qrcode` -* `sudo pip3 install --verbose imutils` -* `sudo pip3 install --verbose pyzbar` -* `sudo pip3 install --verbose argparse` -* `sudo pip3 install --verbose imutils` +Install python dependencies: +``` +sudo pip3 install -r requirements.txt +``` Download SeedSigner -* `sudo git clone https://github.com/SeedSigner/seedsigner` +``` +sudo git clone https://github.com/SeedSigner/seedsigner +``` Modify the systemd to run SeedSigner at boot: -* `sudo nano /etc/systemd/system/seedsigner.service` +``` +sudo nano /etc/systemd/system/seedsigner.service +``` Add the following contents to the file: ``` @@ -154,9 +161,11 @@ add `CONF_SWAPSIZE=100` to `CONF_SWAPSIZE=0` Use Control + O, then [enter], to write the file. Then use Control + X, to exit the program. -To shut down the pi: -* `sudo shutdown --poweroff now` +If you completed these steps on a separate Pi (option #1), shut down the pi with `sudo shutdown --poweroff now` and then transfer the SD card to the Pi Zero 1.3 (_note: the LCD Hat will also run fine on a Raspberry Pi 2/3/4 or Zero W; just remember to disable networking if you want to run the software in isolation)_. -Now either move the MicroSD card to a Pi Zero 1.3 with the 1.3-inch LCD Hat and camera installed, or the LCD Hat will also run fine on a Raspberry Pi 2/3/4 or Zero W; just remember to disable networking if you want to run the software in isolation. +OR if you're working directly on the Pi Zero 1.3 (option #2), just reboot it: +``` +sudo reboot +``` -It will take a couple of minutes after the Pi is powered on for the GUI to launch -- be patient! +It will take about a minute after the Pi is powered on for the GUI to launch -- be patient! diff --git a/Orange_Pill.JPG b/docs/img/Orange_Pill.JPG similarity index 100% rename from Orange_Pill.JPG rename to docs/img/Orange_Pill.JPG diff --git a/docs/img/usb_relay_01.png b/docs/img/usb_relay_01.png new file mode 100644 index 00000000..10726731 Binary files /dev/null and b/docs/img/usb_relay_01.png differ diff --git a/docs/img/usb_relay_mac_01.png b/docs/img/usb_relay_mac_01.png new file mode 100644 index 00000000..283d14ec Binary files /dev/null and b/docs/img/usb_relay_mac_01.png differ diff --git a/docs/img/usb_relay_mac_02.png b/docs/img/usb_relay_mac_02.png new file mode 100644 index 00000000..dfb614dc Binary files /dev/null and b/docs/img/usb_relay_mac_02.png differ diff --git a/docs/img/usb_relay_mac_03.png b/docs/img/usb_relay_mac_03.png new file mode 100644 index 00000000..a2e9a082 Binary files /dev/null and b/docs/img/usb_relay_mac_03.png differ diff --git a/docs/img/usb_relay_mac_04.png b/docs/img/usb_relay_mac_04.png new file mode 100644 index 00000000..7841a388 Binary files /dev/null and b/docs/img/usb_relay_mac_04.png differ diff --git a/docs/usb_relay.md b/docs/usb_relay.md new file mode 100644 index 00000000..1e77aac7 --- /dev/null +++ b/docs/usb_relay.md @@ -0,0 +1,96 @@ +## Relaying internet access to the Pi Zero 1.3 over USB +Insert the SD card with your Raspberry Pi OS image into a regular computer. Open a terminal window (macOS: Terminal; Windows: Command Prompt) and navigate to the SD card: +``` +# mac/Linux: +cd /Volumes/boot + +# Windows (alter with correct drive letter) +cd e: +``` + +We need to create an empty file called "ssh" to enable us to remotely terminal into the Pi via SSH. +``` +# max/Linux: +touch ssh + +# Windows +type nul > ssh +``` + +Now we have some incomprensible configuration steps to set up the internet access relay. + +Add a line to the end of `config.txt`: +``` +# mac/Linux/Windows: +echo dtoverlay=dwc2 >> config.txt +``` + +Open `cmdline.txt` in a basic text editor: +``` +# mac/Linux: +nano cmdline.txt + +# Windows +notepad cmdline.txt +``` + +Add `modules-load=dwc2,g_ether` **directly after** `rootwait`: +``` +blah blah rootwait modules-load=dwc2,g_ether [possibly more blah] +``` + +Then if on mac/Linux, hit `CTRL-X` to exit and `y` to save your changes. In Notepad just save and close. + +Eject the SD card and insert it into your Pi Zero 1.3. Plug a USB cable into your computer and into the Pi's USB connector that is closer to the center. It will draw power from the USB cable and begin powering up. + +The Pi will take a minute or so to boot up its OS. After waiting a bit, try to communicate with the Pi over SSH: +``` +ssh pi@raspberrypi.local +``` + +If you see the following prompt, type `yes` to continue: +``` +The authenticity of host 'raspberrypi.local (192.168.2.3)' can't be established. +ECDSA key fingerprint is SHA256:go4yVgii1GcvyxzhOe03atLn5bl2NhZlOR04tJHBo+k. +Are you sure you want to continue connecting (yes/no/[fingerprint])? +``` + +At the password prompt enter the Pi's default password: `raspberry` + +If you now see the Pi's command prompt, you're in! + + + +## Configure host computer to share internet access with the Pi + +### macOS +Open the "Network" system settings. You should see an entry called "RNDIS/Ethernet Gadget": + + + +Click "Advanced" and change "Configure IPv6" to "Link-local only": + + + +Click "OK" and save your changes. + +Now go to the "Sharing" system settings. Click on "Internet Sharing" and check the "RNDIS/Ethernet Gadget". + + + +Click the "Internet Sharing" checkbox to activate. + +Back at your SSH terminal, test the connection: +``` +ping 8.8.8.8 +``` + +_Hit `CTRL-C` to abort the ping_ + +If you see a ping response, the Pi has internet access! + + + + +### Windows +see: https://www.circuitbasics.com/raspberry-pi-zero-ethernet-gadget/ \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..f786e1a3 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,28 @@ +asn1crypto==0.24.0 +certifi==2018.8.24 +chardet==3.0.4 +colorzero==1.1 +cryptography==2.6.1 +embit==0.4.2 +entrypoints==0.3 +gpiozero==1.5.1 +idna==2.6 +imutils==0.5.4 +keyring==17.1.1 +keyrings.alt==3.1.1 +numpy==1.16.2 +picamera==1.13 +Pillow==8.2.0 +pycrypto==2.6.1 +PyGObject==3.30.4 +python-apt==1.8.4.3 +pyxdg==0.25 +pyzbar==0.1.8 +qrcode==6.1 +requests==2.21.0 +RPi.GPIO==0.7.0 +SecretStorage==2.3.1 +six==1.12.0 +spidev==3.4 +ssh-import-id==5.7 +urllib3==1.24.1 \ No newline at end of file