Generate a random address

Paper wallet

To generate a new random address you can use Obyte paper wallet offline here: https://bonustrack.github.io/obyte-paperwallet/

Node.js

Open your terminal and run:
1
npm i byteball bitcore-mnemonic --save
Copied!
Then run this script to generate a new wallet:
1
const { toWif, getChash160 } = require('byteball/lib/utils');
2
const Mnemonic = require('bitcore-mnemonic');
3
4
const testnet = false; // Change to "true" to generate testnet wallet
5
const passphrase = ''; // Add a passphrase for encryption
6
7
const path = "m/44'/0'/0'/0/0";
8
let mnemonic = new Mnemonic();
9
while (!Mnemonic.isValid(mnemonic.toString())) {
10
mnemonic = new Mnemonic();
11
}
12
const xPrivKey = mnemonic.toHDPrivateKey(passphrase);
13
const { privateKey } = xPrivKey.derive(path);
14
const privKeyBuf = privateKey.bn.toBuffer({ size: 32 });
15
const wif = toWif(privKeyBuf, testnet);
16
const pubkey = privateKey.publicKey.toBuffer().toString('base64');
17
const definition = ['sig', { pubkey }];
18
19
const { privateKey: devicePrivateKey } = xPrivKey.derive('m/1');
20
const devicePubKey = devicePrivateKey.publicKey.toBuffer().toString('base64');
21
22
console.log(
23
'Root private key:', xPrivKey.toString(),
24
'\nSeed words:', mnemonic.phrase,
25
'\nPath:', path,
26
'\nWIF:', wif,
27
'\nWallet public key:', pubkey,
28
'\nWallet address:', getChash160(definition),
29
'\nDevice address:', `0${getChash160(devicePubKey)}`
30
);
Copied!
Last modified 3mo ago
Copy link