A CLI tool that, given a private key, computes the corresponding public key as a point on the BabyJubjub elliptic curve subgroup. This tool is particularly useful for working with private keys extracted from MetaMask.
- Computes public key points on the BabyJubjub elliptic curve subgroup
- Uses circomlibjs for cryptographic operations
- Supports hex-format private keys (including those from MetaMask)
- TypeScript implementation for type safety
- Node.js (v14 or higher)
- npm (v6 or higher)
- Clone the repository:
git clone git@github.com:pantherfoundation/babyjubjub-pubkey-calculator.git
cd babyjubjub-pubkey-calculator- Install dependencies:
npm installRun the script with a private key as an argument:
npm start <privateKey>Example with a MetaMask private key:
npm start 123...abcNote: When copying a private key from MetaMask, it will be a 64-character hexadecimal string without the "0x" prefix.
The output will be in the format:
Public Key:
X: <x-coordinate>
Y: <y-coordinate>
To compile the TypeScript code to JavaScript:
npm run buildThe compiled files will be available in the dist directory.
The project uses:
- TypeScript for type safety
- circomlibjs v0.0.8 for cryptographic operations
- ts-node for running TypeScript directly
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.