You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
990 B

7 years ago
7 years ago
  1. package main
  2. import (
  3. "flag"
  4. "os"
  5. crypto "github.com/tendermint/go-crypto"
  6. cmn "github.com/tendermint/tmlibs/common"
  7. "github.com/tendermint/tmlibs/log"
  8. priv_val "github.com/tendermint/tendermint/types/priv_validator"
  9. )
  10. func main() {
  11. var (
  12. addr = flag.String("addr", ":46659", "Address of client to connect to")
  13. chainID = flag.String("chain-id", "mychain", "chain id")
  14. privValPath = flag.String("priv", "", "priv val file path")
  15. logger = log.NewTMLogger(
  16. log.NewSyncWriter(os.Stdout),
  17. ).With("module", "priv_val")
  18. )
  19. flag.Parse()
  20. logger.Info(
  21. "Starting private validator",
  22. "addr", *addr,
  23. "chainID", *chainID,
  24. "privPath", *privValPath,
  25. )
  26. privVal := priv_val.LoadPrivValidatorJSON(*privValPath)
  27. rs := priv_val.NewRemoteSigner(
  28. logger,
  29. *chainID,
  30. *addr,
  31. privVal,
  32. crypto.GenPrivKeyEd25519(),
  33. )
  34. err := rs.Start()
  35. if err != nil {
  36. panic(err)
  37. }
  38. cmn.TrapSignal(func() {
  39. err := rs.Stop()
  40. if err != nil {
  41. panic(err)
  42. }
  43. })
  44. }