Skip to content

Instantly share code, notes, and snippets.

@matinkaboli
Created October 24, 2022 20:01
Show Gist options
  • Save matinkaboli/a60e6d298a860c6081d65f2b616ec6c1 to your computer and use it in GitHub Desktop.
Save matinkaboli/a60e6d298a860c6081d65f2b616ec6c1 to your computer and use it in GitHub Desktop.
Create addresses in the Stellar network that end with X.
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