status-go/src/gethdep.go

44 lines
709 B
Go
Raw Normal View History

package main
import (
2016-06-20 15:21:45 +00:00
"errors"
"fmt"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/node"
)
var (
scryptN = 262144
scryptP = 1
)
2016-06-20 02:01:28 +00:00
func createAccount(password, keydir string) error {
var sync *[]node.Service
w := true
2016-06-20 02:01:28 +00:00
accman := accounts.NewManager(keydir, scryptN, scryptP, sync)
2016-06-20 02:01:28 +00:00
account, err := accman.NewAccount(password, w)
if err != nil {
return err
}
address := fmt.Sprintf("{%x}", account.Address)
fmt.Println(address)
return nil
}
2016-06-20 15:21:45 +00:00
func createAndStartNode(datadir string) error {
currentNode := MakeNode(datadir)
if currentNode != nil {
StartNode(currentNode)
return nil
}
return errors.New("Could not create the in-memory node object")
}