|
|
@ -27,10 +27,23 @@ import ( |
|
|
|
"io" |
|
|
|
"io" |
|
|
|
"io/ioutil" |
|
|
|
"io/ioutil" |
|
|
|
"os" |
|
|
|
"os" |
|
|
|
|
|
|
|
"path" |
|
|
|
"strconv" |
|
|
|
"strconv" |
|
|
|
"time" |
|
|
|
"time" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ( |
|
|
|
|
|
|
|
version string |
|
|
|
|
|
|
|
builtBy string |
|
|
|
|
|
|
|
builtAt string |
|
|
|
|
|
|
|
commit string |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func printVersion(me string) { |
|
|
|
|
|
|
|
fmt.Fprintf(os.Stderr, "Harmony (C) 2018. %v, version %v-%v (%v %v)\n", path.Base(me), version, commit, builtBy, builtAt) |
|
|
|
|
|
|
|
os.Exit(0) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// AccountState includes the state of an account
|
|
|
|
// AccountState includes the state of an account
|
|
|
|
type AccountState struct { |
|
|
|
type AccountState struct { |
|
|
|
balance *big.Int |
|
|
|
balance *big.Int |
|
|
@ -81,6 +94,8 @@ func main() { |
|
|
|
|
|
|
|
|
|
|
|
// Switch on the subcommand
|
|
|
|
// Switch on the subcommand
|
|
|
|
switch os.Args[1] { |
|
|
|
switch os.Args[1] { |
|
|
|
|
|
|
|
case "-version": |
|
|
|
|
|
|
|
printVersion(os.Args[0]) |
|
|
|
case "new": |
|
|
|
case "new": |
|
|
|
randomBytes := [32]byte{} |
|
|
|
randomBytes := [32]byte{} |
|
|
|
_, err := io.ReadFull(rand.Reader, randomBytes[:]) |
|
|
|
_, err := io.ReadFull(rand.Reader, randomBytes[:]) |
|
|
|