The ripple client application can generate new accounts using the elliptic curve algorithm. Is there a high-level function to perform this task?
Asked
Active
Viewed 4,299 times
2 Answers
2
Yes, there's a nice script written by you. https://github.com/stevenzeiler/ripple-wallet
Vahe Hovhannisyan
- 311
- 2
- 5
0
You can use this script for it. It generates a secret and an address, and with using library ripple-keypairs you can get private and public keys too.
'use strict';
const RippleAPI = require('ripple-lib').RippleAPI;
var test_server = 'wss://s2.ripple.com';
var keypairs = require('ripple-keypairs');
const api = new RippleAPI({
server: test_server // Public rippled server
});
api.connect().then(() => {
/* begin custom code ------------------------------------ */
return api.generateAddress();
}).then(address_info => {
console.log("Secret: " + address_info.secret);
console.log("Address: " + address_info.address);
var keypair = keypairs.deriveKeypair(address_info.secret);
var privateKey = keypair.privateKey;
console.log("Private key: " + privateKey);
var publicKey = keypair.publicKey;
console.log("Public key: " + publicKey);
var address = keypairs.deriveAddress(keypair.publicKey);
console.log("Address: " + address);
/* end custom code -------------------------------------- */
}).then(() => {
return api.disconnect();
}).then(() => {
console.log('done and disconnected.');
}).catch(console.error);
Good luck =)
MCCCS
- 10,097
- 5
- 27
- 55
Дима Марков
- 314
- 1
- 10