Created
October 24, 2022 20:01
-
-
Save matinkaboli/a60e6d298a860c6081d65f2b616ec6c1 to your computer and use it in GitHub Desktop.
Create addresses in the Stellar network that end with X.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from "fs"; | |
import { Keypair } from "stellar-sdk"; | |
const END_WITH = "PAL"; | |
const COUNT = 2; | |
const OUTPUT_FILE = "./keys.json"; | |
let foundCounter = 0; | |
let foundKeys = []; | |
while (foundCounter <= COUNT) { | |
const k = Keypair.random(); | |
if (k.publicKey().endsWith(END_WITH)) { | |
console.log(k.publicKey()); | |
const key = { | |
secret: k.secret(), | |
publicKey: k.publicKey(), | |
}; | |
foundKeys.push(key); | |
foundCounter++; | |
} | |
} | |
fs.writeFileSync(OUTPUT_FILE, JSON.stringify(foundKeys, null, 2), "utf-8"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment