Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to recreate generating the address for SECP256K1 #74

Closed
Tracked by #14007
0xForerunner opened this issue Nov 30, 2022 · 4 comments
Closed
Tracked by #14007

Unable to recreate generating the address for SECP256K1 #74

0xForerunner opened this issue Nov 30, 2022 · 4 comments

Comments

@0xForerunner
Copy link

I've been following the spec written here using the cosmos app on my ledger, but I am getting rather unhelpful errors. The exact information that I am sending to my ledger lookalike this

running 1 test
command: ApduCommand {
    cla: 85,
    ins: 4,
    p1: 1,
    p2: 0,
    length: 27,
    data: [],
}
data: [6, 99, 111, 115, 109, 111, 115, 44, 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[ 64] << 01010500000005550401001b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
[  2] << 6984
Error: Ledger(Apdu("[APDU_CODE_DATA_INVALID] data reversibly blocked (invalidated)"))

If anyone has any info on what's going on here it would be greatly appreciated. This is specifically trying to return the SECP256K1 public key, and you can see above for the derivation path I am using [44, 118, 0, 0, 0] in 32bit little endian.
The HRP is "cosmos" and HRP_LENGTH is set to 6.

@0xForerunner
Copy link
Author

If someone is able to confirm the spec for me that would be amazing. Specifically the endianness of the bytes, and the last 3 entries for the derivation path. I can only assume they should be 0, but I can't confirm anywhere.

@ftheirs
Copy link
Contributor

ftheirs commented Dec 14, 2022

Hi @ewoolsey, you are using a wrong path. It should be [44, 118, 0, 0, 0] as you said but if you check the data:
data: [6, 99, 111, 115, 109, 111, 115, 44, 0, 0, 0, 118, 0, 0.... it seems that you change the order.
The app expects:
Path[0] = 44'. ---> 44 | 0x80000000 // Harden
Path[1] = 118' ---> 118 | 0x80000000 // Harden
Path[2] = any number hardened
Path[3] = 0
Path[4] = any number

I'll fix the documentation and make that clearer but that should solve your problem!

@0xForerunner
Copy link
Author

I'll fix the documentation and make that clearer but that should solve your problem!

Hey there! Really appreciate the reply, and thanks very much for taking the step to improve the docs. I managed to figure this out a few days ago and can confirm that was the problem. I'm so close to finishing my ledger project written in rust but I'm running into one last problem that I'm unable to solve, which is how to actually package up the signature with a cosmos message payload and transmit that to the chain! If you have some time and feel like lending a hand all of the info is over here

@ainhoa-a
Copy link
Contributor

ainhoa-a commented Jan 2, 2023

Documentation has been updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants