()
| 275 | return err |
| 276 | } |
| 277 | func 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 | |
| 303 | func actionCreateWallet(c *cli.Context) (err error) { |
| 304 | // check if there is an account |
no test coverage detected