obsidiansystems / ledger-app-tezos

Ledger app for Tezos
Apache License 2.0
102 stars 51 forks source link

Example APDU for INS_SETUP #162

Closed utdrmac closed 3 years ago

utdrmac commented 3 years ago

I've been wracking my head for two straight days trying to get this function to work.

80 0a 00 00 1e 7a06a770 00000002 000004d2 11 048000002c800006c18000000080000000

That should work (spaces added for clarity), according to the source in apdu_setup.c:handle_apdu_setup()

1e = LC length of 30 7a06a770 = mainnet (types.h:62, 0x7A06A770) (uint32) 00000002 = HWM for main '2' (uint32) 000004d2 = HWM for test '1234' (uint32) 11 = length of bip path (17) (uint8) remaining bytes are the bip path (32 bytes, 4 sections of 8 bytes)

I keep getting the error: 6c00, which is EXC_WRONG_LENGTH. I believe this is coming from apdu_setup.c:86:

if (consumed != buff_size) THROW(EXC_WRONG_LENGTH);

I don't understand why this is not working. Are there any examples of using this setup feature?

utdrmac commented 3 years ago

@jmininger @matthewbauer @mikereinhart Is there documentation on debugging the tezos app? This is my first time dealing with hardware programming. How do I see "print" messages that I might add to the c code? (apologies for direct tags)

utdrmac commented 3 years ago

Figured it out thanks to some dune documentation. CDATA below is formatted for easy reading.

CLA 80
INS 0a
P1 00
P2 00
LC 1d
CDATA ed9d217c 000572c0 000572c0 048000002c800006c18000000080000001