Skip to content

A fast vanity (Nostr) bech-32 npub address generator

Notifications You must be signed in to change notification settings

Eriner/vanity-npub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vanity npub

A vanity prefix bech-32 nostr generator.

What

Do you want a nostr public key like:

npub1swag7ws4yul24p0pf7cacn7cghqkutdnm35z075vy68ggqpqjcyswn8ekc?

If so, this is the tool for you.

How

$ go install github.com/eriner/vanity-npub

$ vanity_npub swag

Notes

The characters b, i, o, and 1 are not valid bech-32 characters, so they may not be used in the vanity prefix.

Benchmarks

This program uses a modified version of the nbd-wtf/go-nostr's GeneratePrivateKey function, intended for speed.

Namely, sync.Pools are used to reduce memory allocations and frand (a CSPRNG) is used instead of crypto/rand.

The benchmarks below show an approximate 2x speed increase while maintaining the cryptographic security of key generation.

% go test -bench=. -benchtime=3s
goos: linux
goarch: amd64
pkg: github.com/eriner/vanity-npub
cpu: AMD Ryzen 7 2700X Eight-Core Processor         
BenchmarkGeneratePrivateKey-16        	1671508	     2076 ns/op
BenchmarkGenerateFastPrivateKey-16    	3191943	     1107 ns/op
PASS
ok  	github.com/eriner/vanity-npub	10.318s

About

A fast vanity (Nostr) bech-32 npub address generator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages