javascript – Elliptic, genkeypair, not generating, html, js-ThrowExceptions

Exception or error:

so I am trying to create a key pair for a blockchain using the elliptic library. When I try to generate the keypair, then console.log it to the console, it does not seem to appear, meaning it is not generating. How would one solve this?

relevant code:

<script src=""></script>
const EC = new;
const ec = new EC('secp256k1');
const keyPair = ec.genKeyPair(); // {ec: EC, priv: BN, pub: null}
const pk = JSON.stringify(keyPair.getPublic());

web browser console:

elliptic.js:3 Uncaught ReferenceError: exports is not defined
    at elliptic.js:3
(anonymous) @ elliptic.js:3
VM298:137 DomDistiller debug level: 0

specifically line that reads “var elliptic = exports;”

'use strict';

var elliptic = exports;

elliptic.version = require('../package.json').version;
elliptic.utils = require('./elliptic/utils');
elliptic.rand = require('brorand');
elliptic.curve = require('./elliptic/curve');
elliptic.curves = require('./elliptic/curves');

// Protocols = require('./elliptic/ec');
elliptic.eddsa = require('./elliptic/eddsa');


How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *