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

ecc.isPoint is not a function #73

Open
skullpunks opened this issue Feb 14, 2023 · 1 comment
Open

ecc.isPoint is not a function #73

skullpunks opened this issue Feb 14, 2023 · 1 comment

Comments

@skullpunks
Copy link

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);
`

@skullpunks skullpunks changed the title ecc. ecc.isPoint is not a function Feb 14, 2023
@nospher3x2
Copy link

nospher3x2 commented Mar 1, 2024

I'm having the same issue

\node_modules\.pnpm\[email protected]\node_modules\bip32\src\testecc.js:6 assert(ecc.isPoint(h('0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798'))); ^ TypeError: Cannot read properties of undefined (reading 'isPoint')

EDIT: I fixed using import * as ecc from 'tiny-secp256k1';

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

2 participants