-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
79 lines (76 loc) · 2.83 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import { ethers } from "ethers"
import { Keypair } from "@solana/web3.js";
import { HDKey } from "micro-ed25519-hdkey";
import * as bip39 from "bip39";
(async () => {
const mnemonic = ""
const seed = bip39.mnemonicToSeedSync(mnemonic, ""); // (mnemonic, password)
const hd = HDKey.fromMasterSeed(seed.toString("hex"));
for (let i = 0; i < 10; i++) {
const path = `m/44'/501'`;
const keypair = Keypair.fromSeed(hd.derive(path).privateKey);
console.log(`${path} => ${keypair.publicKey.toBase58()}`);
}
for (let i = 0; i < 10; i++) {
const path = `m/44'/501'/${i}'`;
const keypair = Keypair.fromSeed(hd.derive(path).privateKey);
console.log(`${path} => ${keypair.publicKey.toBase58()}`);
}
for (let i = 0; i < 10; i++) {
const path = `m/44'/501'/${i}'/0'`;
const keypair = Keypair.fromSeed(hd.derive(path).privateKey);
console.log(`${path} => ${keypair.publicKey.toBase58()}`);
for (let j = 0; j < 10; j++) {
const path = `m/44'/501'/${i}'/0'/${j}'`;
const keypair = Keypair.fromSeed(hd.derive(path).privateKey);
console.log(`${path} => ${keypair.publicKey.toBase58()}`);
}
}
/**
for (let i = 0; i < 10; i++) {
const path = `m/44'/60'`;
const wallet = ethers.Wallet.fromMnemonic(mnemonic, path);
console.log(`${path} => ${wallet.address}`);
}
for (let i = 0; i < 10; i++) {
const path = `m/44'/60'/${i}'`;
const wallet = ethers.Wallet.fromMnemonic(mnemonic, path);
console.log(`${path} => ${wallet.address}`);
}
for (let i = 0; i < 10; i++) {
const path = `m/44'/60'/0'/${i}`;
const wallet = ethers.Wallet.fromMnemonic(mnemonic, path);
console.log(`${path} => ${wallet.address}`);
}
for (let i = 0; i < 10; i++) {
const path = `m/44'/60'/0'/${i}'`;
const wallet = ethers.Wallet.fromMnemonic(mnemonic, path);
console.log(`${path} => ${wallet.address}`);
}
for (let i = 0; i < 10; i++) {
const path = `m/44'/60'/${i}'/0`;
const wallet = ethers.Wallet.fromMnemonic(mnemonic, path);
console.log(`${path} => ${wallet.address}`);
for (let j = 0; j < 10; j++) {
const path = `m/44'/60'/${i}'/0'/${j}`;
const wallet = ethers.Wallet.fromMnemonic(mnemonic, path);
console.log(`${path} => ${wallet.address}`);
}
}
for (let i = 0; i < 10; i++) {
const path = `m/44'/60'/${i}'/0`;
const wallet = ethers.Wallet.fromMnemonic(mnemonic, path);
console.log(`${path} => ${wallet.address}`);
for (let j = 0; j < 10; j++) {
const path = `m/44'/60'/${i}'/0/${j}`;
const wallet = ethers.Wallet.fromMnemonic(mnemonic, path);
console.log(`${path} => ${wallet.address}`);
}
for (let j = 0; j < 10; j++) {
const path = `m/44'/60'/${i}'/0'/${j}`;
const wallet = ethers.Wallet.fromMnemonic(mnemonic, path);
console.log(`${path} => ${wallet.address}`);
}
}
**/
})();