MCPcopy Create free account
hub / github.com/DOSNetwork/core / createWallet

Function createWallet

main.go:277–301  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

275 return err
276}
277func createWallet() (string, error) {
278 first := getPassword("Generating node wallet...\nEnter passphrase (empty is not allowed): ")
279 if first == "" {
280 return "", errors.New("Empty string is not allowed")
281 }
282 second := getPassword("Confirm passphrase again: ")
283 if first != second {
284 fmt.Println("Unmatched Password")
285 return "", errors.New("Unmatched Password")
286 }
287 err := onchain.GenEthkey(dosPath, first)
288 if err != nil {
289 fmt.Println("GenEthkey error : ", err)
290 return "", err
291 } else {
292 key, err := onchain.ReadEthKey(dosPath, first)
293 if err != nil {
294 fmt.Println("Error :", err)
295 return "", err
296 }
297 fmt.Println("wallet keystore file has been saved under", dosPath)
298 fmt.Println("Your node wallet address is:", fmt.Sprintf("0x%x", key.Address))
299 }
300 return first, nil
301}
302
303func actionCreateWallet(c *cli.Context) (err error) {
304 // check if there is an account

Callers 2

actionStartFunction · 0.85
actionCreateWalletFunction · 0.85

Calls 2

getPasswordFunction · 0.85
NewMethod · 0.65

Tested by

no test coverage detected