예제 #1
0
func NewWalletEntry() WalletEntry {
	pub, sec := coin.GenerateKeyPair()
	return WalletEntry{
		Address: coin.AddressFromPubKey(pub),
		Public:  pub,
		Secret:  sec,
	}
}
예제 #2
0
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
}
예제 #3
0
파일: blockchain.go 프로젝트: up4k/skycoin
//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
}
예제 #4
0
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
	}
}
예제 #5
0
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)
	   }
	*/

}
예제 #6
0
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)
	   }
	*/

}
예제 #7
0
func makeAddress() coin.Address {
	p, _ := coin.GenerateKeyPair()
	return coin.AddressFromPubKey(p)
}
예제 #8
0
파일: entry.go 프로젝트: kinghuabg/skycoin
func NewWalletEntry() WalletEntry {
	pub, sec := coin.GenerateKeyPair()
	return NewWalletEntryFromKeypair(pub, sec)
}