Created
October 4, 2017 16:05
-
-
Save lukechampine/69b90ad627d76d434364ec647b10abec to your computer and use it in GitHub Desktop.
Cold wallet address generator
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
package main | |
import ( | |
"bufio" | |
"fmt" | |
"log" | |
"os" | |
"strconv" | |
"github.com/NebulousLabs/Sia/crypto" | |
"github.com/NebulousLabs/Sia/modules" | |
"github.com/NebulousLabs/Sia/types" | |
"github.com/NebulousLabs/entropy-mnemonics" | |
) | |
func main() { | |
log.SetFlags(0) | |
if len(os.Args) != 2 { | |
log.Fatal("Usage: cold index") | |
} | |
n, err := strconv.Atoi(os.Args[1]) | |
if err != nil { | |
log.Fatal("expected number, got", os.Args[1]) | |
} | |
os.Stdout.WriteString("Seed: ") | |
s := bufio.NewScanner(os.Stdin) | |
s.Scan() | |
seed, err := modules.StringToSeed(s.Text(), mnemonics.English) | |
if err != nil { | |
log.Fatal(err) | |
} | |
_, pk := crypto.GenerateKeyPairDeterministic(crypto.HashAll(seed, uint64(n))) | |
fmt.Println(types.UnlockConditions{ | |
PublicKeys: []types.SiaPublicKey{types.Ed25519PublicKey(pk)}, | |
SignaturesRequired: 1, | |
}.UnlockHash()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment