Create account / seed in nodejs


#1

Hello, how can i generate a new waves account (seed, address, keypair) in nodeJs?
Been using waves-api lib that had a Waves.Seed.create() method returning an object with seed, address and keypair but it is no longer maintained, waves-transactions is only offering transactions.
Any pointer on how to do that without waves-api?

Thank you.


#2

#3

Thanks a lot will check this :slight_smile:


#4

I tried this:

npm install @waves/waves-signature-generator --save

const sign_gen = require('@waves/waves-signature-generator')

const seed = sign_gen.Seed.create();
console.log(seed); 

But im getting this error:

App threw an error during load
Error: Secure random number generation is not supported by this browser.
Use Chrome, Firefox or Internet Explorer 11

Any idea ? not working with electron ?


#5

The same issue happened in waves-api so maybe the same fix could apply?


#6

My method to create a seed is:

import bip39 from 'bip39';
import { SeedAdapter } from '@waves/signature-adapter';

export const createWallet = () => {
  const words = bip39.generateMnemonic(160);
  const adapter = new SeedAdapter(words).seed;

  return adapter;
};

#7

Thanks bro, will try this as well :slight_smile: