summaryrefslogtreecommitdiff
path: root/vanity_algo_wallet_gen.go
blob: 631b9d9bb5bbe950a27f343cc65dde510703a7e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main

import (
	"fmt"
	"github.com/algorand/go-algorand-sdk/crypto"
	"github.com/algorand/go-algorand-sdk/mnemonic"
	"os"
	"regexp"
	"runtime"
)

func main() {
	walletChan := make(chan string)
	pattern := os.Args[1]
	for i := 0; i < runtime.NumCPU(); i++ {
		go func() {
			for {
				account := crypto.GenerateAccount()
				go func(acc crypto.Account) {
					m, _ := mnemonic.FromPrivateKey(acc.PrivateKey)
					wallet := fmt.Sprintf("%s:%s\n", acc.Address, m)
					matched, _ := regexp.MatchString(pattern, wallet)
					if matched {
						walletChan <- wallet
					}
				}(account)
			}
		}()
	}

	fmt.Println(<-walletChan)
	os.Exit(0)

}