Bitcoin Forum
June 19, 2024, 05:15:53 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: Trezor developer coordination  (Read 8033 times)
jim618 (OP)
Legendary
*
Offline Offline

Activity: 1708
Merit: 1066



View Profile WWW
September 17, 2013, 05:34:33 PM
Last edit: September 17, 2013, 05:49:29 PM by jim618
 #1

Hello fellow Trezor developers !

I presume there are a few of us "alts" working on Trezor support at the moment so I would like to have a thread where we can share ideas about implementation.

For instance:


At the moment I am looking at when the user plugs in their Trezor and they want their wallet to appear.
If they have already used that particular Trezor on this machine, I want it to reopen the previous wallet and start syncing from where it was before.

Thus I want a naming convention for the wallet file that's stored on the machine (in their user data area most likely).

I was thinking: "trezor-" + hex(hash(master public key from device)) + ".wallet"

The thinking being:
+ use the 'trezor-" prefix so the user knows what the wallet is. Also this gives some namespace for when other types of hardware wallets come along.
+ you want to have the name of the wallet based on the MPK rather than the serial id of the device as the user can:
    1. Reprogram the device with another seed.
    2. Put the seed on another device.

It's the seed that determines the wallet, not the serial id of the Trezor.

I am thinking you'd want to hash the MPK to make it a bit shorter and for privacy reasons. Not sure what length to hash it to yet. Shorter is "friendlier" but you'll get more collisions (in theory). Then convert the hash into simple hex, lowercase.


It is not really a big deal if other wallets use a different naming convention but we will all most likely be tackling the same problems. I would be interested in what other people think.

MultiBit HD   Lightweight desktop client.                    Bitcoin Solutions Ltd   Bespoke software. Consultancy.
stick
Sr. Member
****
Offline Offline

Activity: 441
Merit: 266



View Profile
September 17, 2013, 06:04:47 PM
 #2

Another option would be:

"trezor-" + hex(hash(serial number of the device || master public key from device)) + ".wallet" (where || means concatenation)

I think we have to decide if we want to treat two different devices loaded with the same seed as the same wallet (first option) or not (second one).

jim618 (OP)
Legendary
*
Offline Offline

Activity: 1708
Merit: 1066



View Profile WWW
September 17, 2013, 06:24:39 PM
Last edit: September 17, 2013, 06:44:55 PM by jim618
 #3

There are the following possibilities as you state:

Same seed, different Trezor.

Alice has Trezor #1. She initialises it and write down her mnemonic phrase.   She uses it for a while and then loses the Trezor #1.
She gets hold of Trezor #2 and loads in her previous seed. When she plugs it in, would she expect to:

1) use the same wallet as she had with Trezor #1
2) have a new wallet, which then syncs so she has the same transactions (but she might lose any extra data like labels).

?

edit: or you might have two people with their Trezors programmed with the same seed e.g. husband and wife using the same wallet (?) but they both have their own Trezors.


Same Trezor, different seed.
Bob has Trezor #3. He initialises it with one seed. Uses it for a while with a particular wallet.
Reprograms it. Pretty clearly the new seed needs a new wallet.

(He could then reprogram it back to the first seed and then the old wallet would be used).

This case isn't a problem I don't think.




MultiBit HD   Lightweight desktop client.                    Bitcoin Solutions Ltd   Bespoke software. Consultancy.
jim618 (OP)
Legendary
*
Offline Offline

Activity: 1708
Merit: 1066



View Profile WWW
September 17, 2013, 06:32:28 PM
 #4

Is there anything _different_ to one Trezor wallet with a particular seed and _another_ wallet with the same seed ?

Are they distinguishable to the user ?

I guess they may have a different device name and serial id (not sure that is a good enough reason to "split" the wallet) but is there anything else that is different ?

MultiBit HD   Lightweight desktop client.                    Bitcoin Solutions Ltd   Bespoke software. Consultancy.
jim618 (OP)
Legendary
*
Offline Offline

Activity: 1708
Merit: 1066



View Profile WWW
September 18, 2013, 07:46:22 PM
 #5

Gary has been writing the trezorj Java library which deals with the Trezor communications.

To make it a bit easier to see what is going on I have started a TrezorEmulatorUI. Once it's done you'll be able to see the messages going to and fro.
Here's what I have so far:




It does not do much for real yet.
In the great tradition of emulators it is pig-ugly. :-)

I am thinking it could either be used for:
1) wrapping the datastreams to and from your trezor (like a port forwarding network sniffer)
or
2) a full emulation (which is why I have added a field for the display and the two soft buttons "Trezor Left Button' and 'Trezor Right Button').

Slush and stick have also created a python emulator but I figure there should be one in the trezorj library. Also I reckon you don't really understand something until you can replicate it.

MultiBit HD   Lightweight desktop client.                    Bitcoin Solutions Ltd   Bespoke software. Consultancy.
slush
Legendary
*
Offline Offline

Activity: 1386
Merit: 1097



View Profile WWW
September 22, 2013, 02:10:34 PM
 #6

Is there anything _different_ to one Trezor wallet with a particular seed and _another_ wallet with the same seed ?

Are they distinguishable to the user ?

Yes, there's at least these settings: PIN, language, selected coin (you need to be sure that the device is in "btc" mode, as we discussed over email).

Personally I prefer the option that two devices will act as one, when they have the same master public key.

However what if user connects two devices with the same seed at the same time? :-) What if you'll have the same seed in Trezor and in software walelt? I think client should somehow distinguish between logical wallet (show history, send transaction) and physical device (factory reset, set language, ...).

slush
Legendary
*
Offline Offline

Activity: 1386
Merit: 1097



View Profile WWW
September 22, 2013, 02:13:04 PM
 #7

FYI feel free to use git master at https://github.com/trezor/trezor-emu . There should be always the code which passed all my unit tests, because I'm doing active development in other git branches.

jim618 (OP)
Legendary
*
Offline Offline

Activity: 1708
Merit: 1066



View Profile WWW
September 22, 2013, 03:44:36 PM
 #8

Yeah I think we'll have to distinquish between BOTH different seeds and different physical trezors as you suggest.

Something, somewhere will break if we don't.

For issues such as 'I created a new wallet and all my labels are missing' I expect we will go down the route Electrum has taken and have a label sync system (if not the exact same one so you can sync labels across multibit and electrum HD wallets).

MultiBit HD   Lightweight desktop client.                    Bitcoin Solutions Ltd   Bespoke software. Consultancy.
slush
Legendary
*
Offline Offline

Activity: 1386
Merit: 1097



View Profile WWW
September 22, 2013, 04:23:51 PM
 #9

For issues such as 'I created a new wallet and all my labels are missing' I expect we will go down the route Electrum has taken and have a label sync system (if not the exact same one so you can sync labels across multibit and electrum HD wallets).

The idea of label syncing is perfect and we like it as well. Having description of all transactions and addresses on every client is very nice. However, as many other things in Electrum, the implementation is far from optimal. I mean that such system can be designed to work transparently, like all data can be encrypted and signed with key derived directly from the seed, so there's no need for handling the API key, email registration, password recovery and other stuff.

Shortly said, lets finalize all current project and then we can prepare new BIP for that :-).

jim618 (OP)
Legendary
*
Offline Offline

Activity: 1708
Merit: 1066



View Profile WWW
September 22, 2013, 04:36:45 PM
 #10

Ha ha yes - one thing at a time !

:-)

MultiBit HD   Lightweight desktop client.                    Bitcoin Solutions Ltd   Bespoke software. Consultancy.
Andreas Schildbach
Hero Member
*****
Offline Offline

Activity: 483
Merit: 501


View Profile
September 23, 2013, 09:13:03 AM
 #11

Can we go one step back and explain how to set up the thing? For example, my Raspberry + Trezor sandwich has 3 USB ports - which one is the correct one? Do I need an SD card to boot up? I've never used a Raspberry before.
jim618 (OP)
Legendary
*
Offline Offline

Activity: 1708
Merit: 1066



View Profile WWW
September 23, 2013, 10:31:28 AM
 #12

Gary wrote a useful guide on setting up the trezor emulator here:
https://github.com/bitcoin-solutions/trezorj/wiki/Trezor-on-Raspberry-Pi-from-scratch

The operating system is on an SD yes. I must admit I bought a prebuilt one when I bought the RasPi so cannot tell you exactly what the distribution is.

To talk to it you can plug in an an ethernet cable and use SSH.

The little (micro?) USB on the RasPi is power and I think you can use either of the 2 stacked USB for the 'trezor' cable back to your PC.

I also got a HDMI cable to hook up a monitor but I know Gary uses ethernet/ssh for everything so does not bother with a monitor. I also plugged in a little wireless keyboard but again you can do without.

MultiBit HD   Lightweight desktop client.                    Bitcoin Solutions Ltd   Bespoke software. Consultancy.
jim618 (OP)
Legendary
*
Offline Offline

Activity: 1708
Merit: 1066



View Profile WWW
September 23, 2013, 10:39:38 AM
 #13

@Andreas

Are you thinking of adding Trezor support into Bitcoin Wallet using USB on-the-go ?

MultiBit HD   Lightweight desktop client.                    Bitcoin Solutions Ltd   Bespoke software. Consultancy.
stick
Sr. Member
****
Offline Offline

Activity: 441
Merit: 266



View Profile
September 23, 2013, 12:47:40 PM
 #14

The little (micro?) USB on the RasPi is power and I think you can use either of the 2 stacked USB for the 'trezor' cable back to your PC.

For power you can use either of microUSB connectors. If you want to communicate with TREZOR, use the one on the shield (it will also provide power for the RasPi).

Andreas Schildbach
Hero Member
*****
Offline Offline

Activity: 483
Merit: 501


View Profile
September 23, 2013, 01:42:07 PM
 #15

The little (micro?) USB on the RasPi is power and I think you can use either of the 2 stacked USB for the 'trezor' cable back to your PC.

For power you can use either of microUSB connectors. If you want to communicate with TREZOR, use the one on the shield (it will also provide power for the RasPi).

Ok so I take it the only connection I have to make is the USB port on the shield?
Andreas Schildbach
Hero Member
*****
Offline Offline

Activity: 483
Merit: 501


View Profile
September 23, 2013, 01:43:21 PM
 #16

@Andreas

Are you thinking of adding Trezor support into Bitcoin Wallet using USB on-the-go ?

Well I wanted to try if communication is possible. For it to be usable, I guess someone should build a "mobile" version of the Trezor.
stick
Sr. Member
****
Offline Offline

Activity: 441
Merit: 266



View Profile
September 23, 2013, 02:31:50 PM
 #17

Ok so I take it the only connection I have to make is the USB port on the shield?

Right.

Trongersoll
Hero Member
*****
Offline Offline

Activity: 490
Merit: 501



View Profile
September 23, 2013, 07:27:31 PM
Last edit: September 23, 2013, 08:38:35 PM by Trongersoll
 #18

What happens to your coin if your trezor device gets broken?
jim618 (OP)
Legendary
*
Offline Offline

Activity: 1708
Merit: 1066



View Profile WWW
September 23, 2013, 08:23:13 PM
 #19

When you initialize your trezor it shows on it's screen a 12 word passphrase (similar to Electrum's mnemonic phrase) that you write down.

If you lose your trezor you can then either:
+ reprogram another trezor with the seed
+ create a new wallet in a HD compatible wallet client with the new seed. (HD compatible wallet clients don't exist yet but Electrum, Armory and MultiBit are all planning to support it).

If you lose both your trezor AND your 12 word passphrase then you have lost access to your bitcoin.

MultiBit HD   Lightweight desktop client.                    Bitcoin Solutions Ltd   Bespoke software. Consultancy.
Mike Hearn
Legendary
*
Offline Offline

Activity: 1526
Merit: 1129


View Profile
September 24, 2013, 01:20:46 PM
 #20

Label syncing isn't the right model IMHO.

The right model is that the same private key seed generated by Trezor/your wallet is both used to control your Bitcoins and encrypt your wallet file (literally the .wallet protobuf generated by bitcoinj or other wallet equivalents). Once encrypted that file can then be uploaded to some cloud service, perhaps a P2P DHT run by the community. The files are only small. The public key (or hash of it) would act as the document name to let you redownload the wallet if you need it.

In the case where the cloud backup fails for some reason, it isn't there any more or whatever, the private key you wrote down can be used to get access to your money even if all the other data is lost.

Remember that in future wallets will hold not only keys and labels, but also things like signed payment requests (receipts), micropayment channel state, info for dispute mediation and so on. Lots of stuff.
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!