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

Invalid y value for curve on require('ontology-ts-sdk') #214

Open
congminh090800 opened this issue Jul 28, 2021 · 2 comments
Open

Invalid y value for curve on require('ontology-ts-sdk') #214

congminh090800 opened this issue Jul 28, 2021 · 2 comments

Comments

@congminh090800
Copy link

I got this error right at the require step

2021-07-28 09:37:19.427 ERROR 8476 Logger get balance and amount job error: Error: Invalid y value for curve.
    at Point.validate (/home/minhlpc/Desktop/staking-childpool-admin-web-backend/node_modules/bitcore-lib/lib/crypto/point.js:123:11)
    at new PresetCurve (/home/minhlpc/Desktop/staking-childpool-admin-web-backend/node_modules/elliptic/lib/elliptic/curves.js:22:17)
    at Object.get [as p256] (/home/minhlpc/Desktop/staking-childpool-admin-web-backend/node_modules/elliptic/lib/elliptic/curves.js:32:19)
    at new EC (/home/minhlpc/Desktop/staking-childpool-admin-web-backend/node_modules/elliptic/lib/elliptic/ec/index.js:22:21)
    at Module.<anonymous> (/home/minhlpc/Desktop/staking-childpool-admin-web-backend/node_modules/@ont-dev/hdkey-secp256r1/lib/index.js:1:1814)
    at t (/home/minhlpc/Desktop/staking-childpool-admin-web-backend/node_modules/@ont-dev/hdkey-secp256r1/lib/index.js:1:124)
    at /home/minhlpc/Desktop/staking-childpool-admin-web-backend/node_modules/@ont-dev/hdkey-secp256r1/lib/index.js:1:923
    at Object.<anonymous> (/home/minhlpc/Desktop/staking-childpool-admin-web-backend/node_modules/@ont-dev/hdkey-secp256r1/lib/index.js:1:932)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/minhlpc/Desktop/staking-childpool-admin-web-backend/node_modules/ontology-ts-sdk/lib/index.js:1:2731)

Got stuck in this line:

  if (p2.y.cmp(this.y) !== 0) {
    throw new Error('Invalid y value for curve.');
  }

Is there something new on curve function ?

@sinanouri
Copy link

sinanouri commented Mar 25, 2023

same error

const bip39 = require("bip39");
const hdkey = require('hdkey');
const { Account, Crypto } = require('ontology-ts-sdk')
function ont(data) {
    const mnemonic = data.mnemonic
    const mnemonicPath = data.mnemonicPath
    const seed = bip39.mnemonicToSeedSync(mnemonic);
    const hdWallet = hdkey.fromMasterSeed(seed).derive("m/0'/0'/0'/" + mnemonicPath + "'");
    const child = hdWallet._privateKey.toString('hex')
    const privateKey = new Crypto.PrivateKey(child);
    const account = Account.create(privateKey, '', 'account');
    const WIF = privateKey.serializeWIF();
    const address = account.address.toBase58()
    return { address: address, privateKey: WIF }
}
module.exports = {
    ont
}

@sinanouri
Copy link

@congminh090800 could you do anything about it since 2021? :))

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