func NewWalletEntry() WalletEntry { pub, sec := coin.GenerateKeyPair() return WalletEntry{ Address: coin.AddressFromPubKey(pub), Public: pub, Secret: sec, } }
func makeUxBodyWithSecret(t *testing.T) (coin.UxBody, coin.SecKey) { p, s := coin.GenerateKeyPair() return coin.UxBody{ SrcTransaction: coin.SumSHA256(randBytes(t, 128)), Address: coin.AddressFromPubKey(p), Coins: 10e6, Hours: 100, }, s }
//Generate Blockchain configuration for client only Blockchain, not intended to be synced to network func NewLocalBlockchain() Blockchain { pubkey, seckey := coin.GenerateKeyPair() //generate new/random pubkey/private key fmt.Printf("NewLocalBlockchain: genesis address seckey= %v \n", seckey.Hex()) VC := NewBlockchain() VC.SecKey = seckey VC.Genesis.GenesisAddress = coin.AddressFromPubKey(pubkey) VC.Genesis.GenesisTime = uint64(time.Now().Unix()) VC.InjectGenesisBlock() return VC }
func createWalletEntry(filename string) (*visor.ReadableWalletEntry, error) { pub, sec := coin.GenerateKeyPair() addr := coin.AddressFromPubKey(pub) w := visor.WalletEntry{ Address: addr, Public: pub, Secret: sec, } rw := visor.NewReadableWalletEntry(&w) if err := rw.Save(filename); err == nil { fmt.Printf("Wrote wallet entry to \"%s\"\n", filename) return &rw, nil } else { fmt.Fprintf(os.Stderr, "Failed to write wallet entry to \"%s\"\n", filename) return nil, err } }
func main() { registerFlags() parseFlags() if seed == "" { for i := 0; i < genCount; i++ { pub, sec := coin.GenerateKeyPair() fmt.Printf("%s\n", tstring(pub, sec)) } } if seed != "" { seckeys := coin.GenerateDeterministicKeyPairs([]byte(seed), genCount) for _, sec := range seckeys { pub := coin.PubKeyFromSecKey(sec) fmt.Printf("%s\n", tstring(pub, sec)) } //pub, sec := coin.GenerateDeterministicKeyPair([]byte(seed)) //fmt.Printf("%s\n", tstring(pub, sec)) } /* if outFile != "" { w := createWalletEntry(outFile, testNetwork) if w != nil { printWalletEntry(w, labelStdout, PrintAddress, printPublic, printSecret) } } if inFile != "" { printWalletEntryFromFile(inFile, labelStdout, PrintAddress, printPublic, printSecret) } */ }
func main() { registerFlags() parseFlags() if seed == "" { for i := 0; i < genCount; i++ { pub, sec := coin.GenerateKeyPair() fmt.Printf("%s\n", tstring(pub, sec)) } } if seed != "" { if genCount != 1 { log.Panic("multiple deterministic addresses not implemented yet") } pub, sec := coin.GenerateDeterministicKeyPair([]byte(seed)) fmt.Printf("%s\n", tstring(pub, sec)) } /* if outFile != "" { w := createWalletEntry(outFile, testNetwork) if w != nil { printWalletEntry(w, labelStdout, PrintAddress, printPublic, printSecret) } } if inFile != "" { printWalletEntryFromFile(inFile, labelStdout, PrintAddress, printPublic, printSecret) } */ }
func makeAddress() coin.Address { p, _ := coin.GenerateKeyPair() return coin.AddressFromPubKey(p) }
func NewWalletEntry() WalletEntry { pub, sec := coin.GenerateKeyPair() return NewWalletEntryFromKeypair(pub, sec) }