Skip to content

ecc.isPoint is not a function #73

Description

@indexxai

Hi All,

`const ecc = require('tiny-secp256k1');
console.log(ecc.isPoint)
const { BIP32Factory } = require('bip32');
// You must wrap a tiny-secp256k1 compatible implementation
const bip32 = BIP32Factory(ecc);
const bip39 = require('bip39');
const bitcoin = require('bitcoinjs-lib');

export function generateBitcoinTestAddress(mnemonic) {
//const bip32 = BIP32Factory.default(ecc);
const seed = bip39.mnemonicToSeedSync(mnemonic);
const root = bip32.fromSeed(seed);

const path = "m/49'/1'/0'/0/0";
const child = root.derivePath(path);

const { address } = bitcoin.payments.p2sh({
redeem: bitcoin.payments.p2wpkh({
pubkey: child.publicKey,
network: bitcoin.networks.testnet,
}),
network: bitcoin.networks.testnet,
});
console.log(address, "address");
}

export function generateBitcoinMainAddress(mnemonic) {
//const bip32 = BIP32Factory.default(ecc);
const seed = bip39.mnemonicToSeedSync(mnemonic);
const root = bip32.fromSeed(seed);

const path = "m/49'/0'/0'/0";
const child = root.derivePath(path);

const { address } = bitcoin.payments.p2sh({
redeem: bitcoin.payments.p2wpkh({
pubkey: child.publicKey,
network: bitcoin.networks.bitcoin,
}),
network: bitcoin.networks.bitcoin,
});
} `

I could not able to bip32 throws following error
Unhandled Runtime Error
TypeError: ecc.isPoint is not a function

Source
Object.testEcc
node_modules\bip32\src\testecc.js (5:0)
BIP32Factory
node_modules\bip32\src\bip32.js (9:0)

`
pages\api\Utilities.js (5:14) @ BIP32Factory

3 | const { BIP32Factory } = require('bip32');
4 | // You must wrap a tiny-secp256k1 compatible implementation

5 | const bip32 = BIP32Factory(ecc);
`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions