Creating a Wallet

Seed Phrase

A vocabulary of 5,000 or more words is generally considered secure. In practice, we typically use a 12-word phrase.

Generate Key

const seedPhraseTextarea = 'word1 word2 ...';
const EC = elliptic.ec;
const ec = new EC('secp256k1');

// Create a SHA-256 hash of the seed phrase
const hash = sha256.sha256.array(seedPhrase);

// Generate the private key from the hash
const keyPair = ec.keyFromPrivate(hash);

// Generate the public key from the private key
const publicKey = keyPair.getPublic(false, 'hex');

// Generate private key in PKCS1 format
const privateKeyPKCS1 = keyPair.getPrivate('hex');

Generate Wallet Address

const Address = sha256.sha256(publicKey);

Last updated