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
945 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. "github.com/tendermint/tendermint/privval"
  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. pv := privval.LoadFilePV(*privValPath)
  27. rs := privval.NewRemoteSigner(
  28. logger,
  29. *chainID,
  30. *addr,
  31. pv,
  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. }