-
Notifications
You must be signed in to change notification settings - Fork 4
Home
This project has been entirely absorbed into the larger MultiBit Hardware project.
Trezorj is a support library, written in Java, that simplifies the code required to talk to a Bitcoin Trezor device.
It will allow your code to automatically interface with a Trezor giving your users the ability to use trusted hardware to keep their private keys away from viruses and malware.
Trezorj is built with Maven so you can just include the core
as a dependency. Then you can choose which Trezor devices you want to support. At the moment only the Shield board on a Raspberry Pi is available but others will come in time.
<!-- Trezorj Core -->
<dependency>
<groupId>uk.co.bitcoin-solutions</groupId>
<artifactId>trezorj-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
In general you will work with the following top-level objects:
-
TrezorFactory
- to provide you with a variety of different connection types (USB, Socket etc) -
Trezor
- the interface for the device allowing you to add a listener and send a message -
TrezorListener
- you'll implement this to receive events from the Trezor asynchronously via a blocking queue -
TrezorEvent
- received from the queue as a result of something occurring on the hardware (new message, USB signalling etc) -
TrezorMessage
- top-level class containing the protocol buffer message payload
That's pretty much it. Obviously you'll want to dig in deeper to TrezorMessage
but you won't need to learn much more than what is present in the examples module to get something up and running.
Here's a typical example of the API in action:
// Create a socket Trezor
Trezor trezor = TrezorFactory.INSTANCE.newSocketTrezor(host, port);
// Add this as the listener (sets the event queue)
trezor.addListener(this);
// Set up an executor service to monitor Trezor events
createTrezorEventExecutorService();
// Connect
trezor.connect();
// Send a message
trezor.sendMessage(TrezorMessage.Ping.getDefaultInstance());
The above is a snippet from the Rasberry Pi Shield Example.
If you have a Raspberry Pi and a Shield device, you'll want to read Trezor on Raspberry Pi from scratch.
TODO: The USB experience... :-)
Take a look at the Pages and explore from there.