0

Hi guys inside my ICO website I want to create on the fly a tezos compliant wallet with the custom tokens for people once they purhcase. Is there a way to programatically create a wallet thanks peeps?

1
  • Have you looked into walletbeacon.io, which allows users to connect their existing wallet to your site? Creating single purpose wallets per application is a bad idea and is cumbersome for users to manage
    – Simon McLoughlin
    Commented Sep 28, 2023 at 14:03

1 Answer 1

0

Yes here are some approaches:

PyTezos: You can utilize PyTezos for key generation.

ConseilJS but I haven't seen any update for a while.

Custom JavaScript Method: While possible, managing keys yourself, especially with custom code, significantly increases security risks. That said, here's a simple (perhaps naive) way to generate a key in JavaScript:

import * as bip39 from 'bip39';
import sodium from 'libsodium-wrappers-sumo';
import base58check from 'bs58check';

public generateSecretKey = async (): Promise<string> => {
  const mnemonic = bip39.generateMnemonic(256);
  const seed = await bip39.mnemonicToSeed(mnemonic, '');
  await sodium.ready;
  const keys = sodium.crypto_sign_seed_keypair(
    seed.slice(0, 32),
    'hex'
  );
  return base58check.encode(
    Buffer.from('2bf64e07' + keys.privateKey, 'hex')
  );
};

After generating the key, you need to send some mutez to its associated address to activate it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.