I’m making an attempt to make use of the cryptowallet library LibWally to transform a 12-word mnemonic right into a set of derived addresses. I imagine my mistake is just not with the library itself, however a course of move/algorithmic one, so even should you do not aren’t aware of the library, you could possibly assist.

First I validate and convert the mnemonic to a seed with the next code:

    char *mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about";
    bip39_mnemonic_to_seed((const char *)mnemonic, "",
                          (unsigned char *)bytes_output, HMAC_SHA512_LEN,
                           &size_written)
     wally_hex_from_bytes((unsigned char*)bytes_output, size_written, &hex_output)

This provides me the right seed worth; not less than it matches what I see on Ian Coleman’s Site. Subsequent I take the seed worth in bytes_input (not the hex coded worth) and name:

bip32_key_from_seed( (unsigned char*) bytes_output, 
    BIP32_ENTROPY_LEN_128,
    BIP32_VER_MAIN_PRIVATE,
    0,
    &key_structure)

After which retrieve the personal key with:

bip32_key_to_base58(&key_structure, BIP32_FLAG_KEY_PRIVATE, &output_privkey);

The worth in output_privKey doesn’t match the Bip32 root key proven in Ian’s web site, although apparently sufficient, it matches on the primary 15 characters, earlier than diverging (and winding up four chars longer in size).

Am I lacking a step right here? Or doing one thing else unsuitable?

Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here