-
Notifications
You must be signed in to change notification settings - Fork 28
How to run the examples
This article describes how to run the examples in the project from the command line.
Make sure you have a paper copy of your seed phrase before attempting any of these examples
Some examples will wipe your device (you'll have to confirm on the Trezor before anything happens) and others will attempt to spend from your wallet. Make sure that any funds loaded to a seed phrase used in these examples are kept to a minimum (about $1 worth should be sufficient).
You may want to have a second Bitcoin wallet available to receive the funds
After cloning and building the project (mvn clean install
), do the following at the command line
cd examples
mvn clean compile exec:java -Dexec.mainClass="org.multibit.hd.hardware.examples.trezor.usb.TrezorV1FeaturesExample"
If you have a V1 production Trezor attached this will perform an initial conversation and provide a summary of the device to the console.
You can now explore the other examples by modifying the above snippet accordingly. To gain confidence in working with the library you should run up the examples in the order shown below and follow the instructions in the console and on the Trezor screen as required.
- TrezorV1FeaturesExample - Read some information from your device
- TrezorV1WipeDeviceExample - Resets your device back to factory settings
- TrezorV1WipeAndCreateWalletExample - Reset device and generate a seed phrase from the device
- TrezorV1GetAddressExample - Read the first receiving address from the device (you can send to this)
- TrezorV1WatchingWalletExample - Run a basic Bitcoinj wallet and spend 1 millibit to a supplied address
- TrezorV1WipeAndLoadAbandonWalletExample - Wipe then load (restore) a seed phrase externally (less secure)
Additional examples that demonstrate other features of the library are:
- TrezorV1ChangePinExample - Change your PIN
- TrezorV1CipherKeyExample - Ask the device to encrypt a small piece of information (good for an ID)
- TrezorV1GetDeterministicHierarchyExample - Provides the master public key to allow monitoring of all receiving addresses
- TrezorV1SignMessageExample - Sign some text using the private key associated with a given path
- TrezorV1StopExample - Technical example for managing start/stop of the hardware wallet service
Here are the detailed instructions for loading your own seed phrase:
- Open gedit and edit
TrezorV1WipeAndLoadAbandonWalletExample.java
- Navigate to line 104 and add in your own seed phrase between the double quotes
- Navigate to line 112 to change the Trezor label
- Save and quit from gedit
- Run the Maven commands above
- Follow the instructions from the console and the Trezor
Bear in mind that exposing a real seed phrase outside of paper or Trezor is reducing its security so only do this with seed phrases that don't contain significant amounts of bitcoin.
For an example of a real Bitcoin wallet that uses MultiBit Hardware see MultiBit HD.