diff options
author | Robby Zambito <contact@robbyzambito.me> | 2021-02-28 16:52:45 -0500 |
---|---|---|
committer | Robby Zambito <contact@robbyzambito.me> | 2021-02-28 16:52:45 -0500 |
commit | 4b30f6e1e1a38be23a4c6beb145d99d0347b2206 (patch) | |
tree | 6c1f63a5131d653f2b942c7c3581657c9875ae33 | |
parent | ccc5364a4e3f5c2681c1926abd59c65e465a848a (diff) |
How to generate a Vanity Algorand Address
-rw-r--r-- | content/posts/how-to-generate-a-vanity-algorand-address/index.md | 84 | ||||
-rw-r--r-- | content/posts/how-to-generate-a-vanity-algorand-address/license/LICENSE.txt | 6 |
2 files changed, 90 insertions, 0 deletions
diff --git a/content/posts/how-to-generate-a-vanity-algorand-address/index.md b/content/posts/how-to-generate-a-vanity-algorand-address/index.md new file mode 100644 index 0000000..30aba55 --- /dev/null +++ b/content/posts/how-to-generate-a-vanity-algorand-address/index.md @@ -0,0 +1,84 @@ +--- +title: "How to Generate a Vanity Algorand Address" +date: 2021-02-28T11:24:16-05:00 +type: "post" +draft: false +tags: [free-software, internet, software, cryptocurrency, software-release] +--- + +A vanity address is an address that has been generated such that it has some recognizable pattern. +For example, if you want to accept Algorand at your business, you could generate a wallet whose address resemblese or matches a portion of your business name. +Personally, I have an address which mathes my nickname, which is quite nice. + +To generate addresses, I created this Go program (Repo can be found [here](https://git.robbyzambito.me/Zambyte/vawg)). + +``` +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) + +} +``` +*This script is made available under the [0-clause BSD license](license/LICENSE.txt)* + +To run this program, you must have Go installed on your machine. +I will assume you have it installed for this post. +If you need help installing it, you can reach out to me, and I will try to help you get set up. + +You can install the this by running the following command, which should automatically build and install the dependencies. + +``` +$ go install git.robbyzambito.me/Zambyte/vawg/v2@latest +``` + +If you have go installed properly, this should add the vawg binary to your $PATH. +You can then generate a wallet by passing a regular expression as an argument. +Here is an example of running the program: + +``` +$ vawg "^H[E3]LL[0O]" +H3LLOVA5RAKHN5ZDL6TMO5UF3XH5VS4UWELAL7UUFWKO6NUFALLK3BPM3I:number frog indicate over verb stable ignore salute leopard loop merit neither attract wrap assume pluck rely firm album deny shield dumb visit absent canal +``` +*I advise against using this wallet since I posted it on the internet.* + +This took about two minutes to run on my machine with a Ryzen 7 3700X. +If it seems to hang and eat up a lot of CPU, that means it's working :) + +A few things to note: +- Wallet addresses are in full caps, so if you do not pass it a full caps string it will never find a wallet. +- The regular expression matches against the whole output. + The ^ means that it should match against the beginning of the output. + This is usually what you want. +- Since it uses regular expressions, you could increase the results you would accept (and potentially cut down on search time) by providing accepted alternatives. + This is shown in the example, where a 3 is accepted in place of an E, and a 0 would be accepted in place of an O. + +The seed phrase (the sequence of words after the "`:`") can be used to add the wallet to whatever wallet app you use. diff --git a/content/posts/how-to-generate-a-vanity-algorand-address/license/LICENSE.txt b/content/posts/how-to-generate-a-vanity-algorand-address/license/LICENSE.txt new file mode 100644 index 0000000..9be764a --- /dev/null +++ b/content/posts/how-to-generate-a-vanity-algorand-address/license/LICENSE.txt @@ -0,0 +1,6 @@ +Copyright (C) 2021 by Robert Zambito contact@robbyzambito.me + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. |