Skip to content

React-native use RELEASE scheme crash, HDNode.fromSeedBuffer #1008

@yinchengvy

Description

@yinchengvy

React-native, iOS, RELEASE

Hi, I got a crash on iOS platform only use release scheme.

function generatorBIP44() {
    const mnemonic = bip39.generateMnemonic();
    assert(bip39.validateMnemonic(mnemonic));

    const seed = bip39.mnemonicToSeed(mnemonic);
    const bitcoinNetwork = bitcoin.networks.bitcoin;
    const master = bitcoin.HDNode.fromSeedBuffer(seed, bitcoinNetwork);

    const derivePath = `m/44'/0'/0'/0/0`;
    const node = master.derivePath(derivePath);

    const keyPair = node.keyPair;

    const privateKey = keyPair.toWIF();

    const publicKeyBuffer = keyPair.getPublicKeyBuffer();
    const publicKey = publicKeyBuffer.toString('hex');

    const address = keyPair.getAddress();

    return {
        mnemonic,
        address,
        privateKey,
        publicKey,
    };
}

I found crash here

    const master = bitcoin.HDNode.fromSeedBuffer(seed, bitcoinNetwork);
    
    typeforce(types.tuple('ECPair', types.Buffer256bit), arguments)

If i remove typeforce check code, it's OK.

It's amazing when i run it OK on debug scheme, but always crash on release scheme.
Someone please help me?
Thx.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions