Last active
September 5, 2024 14:54
-
-
Save earthchie/108fe7e2d0462e27e1eb02bed53ab701 to your computer and use it in GitHub Desktop.
find a nip19 key with specific prefix for using on Nostr
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
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); | |
} | |
} |
Author
earthchie
commented
Dec 28, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment