Skip to content

Instantly share code, notes, and snippets.

@earthchie
Last active September 5, 2024 14:54
Show Gist options
  • Save earthchie/108fe7e2d0462e27e1eb02bed53ab701 to your computer and use it in GitHub Desktop.
Save earthchie/108fe7e2d0462e27e1eb02bed53ab701 to your computer and use it in GitHub Desktop.
find a nip19 key with specific prefix for using on Nostr
const {nip19, generatePrivateKey, getPublicKey} = require('nostr-tools');
let found = false;
let counter = 0;
while(!found){
counter++;
if(counter%100000 == 0){
console.log('Reached iteration #' + counter.toLocaleString());
}
const sk = generatePrivateKey();
const pk = getPublicKey(sk);
const addr = nip19.npubEncode(pk);
if(addr.indexOf('earthchie') === 4){
found = true;
console.log(counter, addr, pk, sk);
}
if(addr.indexOf('thanarat') === 4){
found = true;
console.log(counter, addr, pk, sk);
}
}
@earthchie
Copy link
Author

npm i nostr-tools
node NostrKeyFinder.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment