Skip to content

Instantly share code, notes, and snippets.

@bradylove
Created January 29, 2018 02:20
Show Gist options
  • Save bradylove/0ada9730dbdb48c8661854bd921c06f5 to your computer and use it in GitHub Desktop.
Save bradylove/0ada9730dbdb48c8661854bd921c06f5 to your computer and use it in GitHub Desktop.
Stellar Key Pair Generator
package main
import (
"flag"
"fmt"
"os"
"runtime"
"strings"
"sync"
"time"
"github.com/stellar/go/keypair"
)
var (
suffix = flag.String("suffix", "", "suffix that the public key should end with.")
)
func main() {
flag.Parse()
procs := runtime.NumCPU()
var wg sync.WaitGroup
wg.Add(procs)
startTime := time.Now()
for i := 0; i < procs; i++ {
go func(startTime time.Time) {
for {
kp, err := keypair.Random()
if err != nil {
panic(err)
}
if strings.HasSuffix(kp.Address(), *suffix) {
fmt.Println("Public Key: ", kp.Address())
fmt.Println("Private Key:", kp.Seed())
fmt.Println("Time Taken: ", time.Since(startTime))
os.Exit(0)
}
}
}(startTime)
}
wg.Wait()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment