ton-blockchain / ledger-app-ton

TON Ledger Nano App
Apache License 2.0
36 stars 11 forks source link

V5R1 custom add #9

Open XopMC opened 2 weeks ago

XopMC commented 2 weeks ago

Hello! I am implementing custom support for V5R1 addresses for Ledger.

However, I have encountered some difficulties with specifying constants. As far as I understand, adding 1 bit at the beginning of the Cell when initializing the contract gives a data_header in this format:

const uint8_t v5_data_header[] = {
    0x00, 0x51, 0x80, 0x00, 0x00, 0x00
};

Also, the subwallet_id is filled with zeros here.

These seem to be all the differences I've found from V4R2 (excluding, of course, the contract hash). Here’s the full list of constants that I use when creating:

const uint8_t v5r1_root_header[] = {
    0x02, 0x01, 0x34, 0x00, 0x07, 0x00, 0x00,
    0x20, 0x83, 0x4B, 0x7B, 0x72, 0xB1, 0x12, 0x14,
    0x7E, 0x1B, 0x2F, 0xB4, 0x57, 0xB8, 0x4E, 0x74,
    0xD1, 0xA3, 0x0F, 0x04, 0xF7, 0x37, 0xD4, 0xF6,
    0x2A, 0x66, 0x8E, 0x95, 0x52, 0xD2, 0xB7, 0x2F
};
const uint8_t v5_data_header[] = {
    0x00, 0x51, 0x80, 0x00, 0x00, 0x00
};
const uint8_t data_tail[] = { 0x40 };
const uint8_t subwallet_id[] = {0x00, 0x00, 0x00, 0x00};

However, the address I get does not match a known V5R1 address. I would greatly appreciate any advice on what I might be missing. Thank you!

V5R1.txt V5R1 source code (need to rename .txt to .fif)