nodejs-verge icon indicating copy to clipboard operation
nodejs-verge copied to clipboard

API to create new Verge Address

Open technotip opened this issue 7 years ago • 4 comments

Is there a simple API using which we can create XVG public address and private key? Without the need to install and run verged on the server.

technotip avatar Oct 10 '18 13:10 technotip

There's no simple option right now, but there's this:

https://github.com/vergecurrency/vWallet/blob/develop/src/crypto/Key.ts

marpme avatar Oct 10 '18 15:10 marpme

I'm trying my best to figure out way to implement in Nodejs application. https://nodejs.org/api/crypto.html

But am not good at crypto related programming.

I'm developing a mobile app which uses Verge currency for its transaction. I've been thinking of developing it from over a year. Now I've started coding it. It would be awesome if I can generate public and private key for users within the application. Is there a npm package for node.js ?

technotip avatar Oct 10 '18 17:10 technotip

// import that module as crypto (https://github.com/vergecurrency/vWallet/blob/develop/src/crypto/Key.ts)

const privateKeyBuffer = crypto.generateRandomSeed() // your private key :) 
const pubKeyBuffer = crypto.getPublicKeyFromPrivateKey(privateKeyBuffer)
const pubKeyHash = crypto.getPublicKeyHash(pubKeyBuffer)
// pubKeyHashVersion (number): 0x1e
const address = crypto.createAddress(pubKeyHash, pubKeyHashVersion)
console.log(address) // logs a fully compatible address 

marpme avatar Oct 11 '18 06:10 marpme

Thanks a lot. Trying it now.

Also trying to validate user entered XVG address.

technotip avatar Oct 12 '18 12:10 technotip