elliptic icon indicating copy to clipboard operation
elliptic copied to clipboard

Error: Unknown point format secp256k1

Open harveyconnor opened this issue 6 years ago • 5 comments


Error: Unknown point format
    at ShortCurve.decodePoint

I'm getting this error after using the following code:


const ec = new EC('secp256k1');

const publicKey = ec.keyFromPublic("022e0ab4358780d72a4cac22ab75b257757663e5b204d96ccdce62f780536dac6a", 'hex');

Can somebody please help me as I need to generate a keypair based on that string to use:

return privateKeyPair.derive(publicKey.getPublic());

harveyconnor avatar Aug 01 '19 07:08 harveyconnor

Can specify which version you use?

This code works fine with [email protected]

const EC = require('elliptic').ec
const ec = new EC('secp256k1');
const publicKey = ec.keyFromPublic("022e0ab4358780d72a4cac22ab75b257757663e5b204d96ccdce62f780536dac6a", 'hex');

fanatid avatar Aug 02 '19 20:08 fanatid

You will get that error if you forget the 'hex' parameter when you use keyFromPublic.

dsharhon avatar Sep 29 '19 18:09 dsharhon

@dsharhon look at my code, I clearly have that there

harveyconnor avatar Sep 30 '19 03:09 harveyconnor

Can you show us the code that generates privateKeyPair?

dsharhon avatar Sep 30 '19 04:09 dsharhon

I no longer use this. I opted in for a plain old js implementation of it.

harveyconnor avatar Sep 30 '19 04:09 harveyconnor