prysm-pulse/tools/cluster-pk-manager/server/main.go
Preston Van Loon 5eb5f6afa9
Faucet enhancements + cluster private key management system (#1679)
* second pass at faucet, no rate limiting yet

* Add authentication support, step 1. This stuff needs to be refactored and tested

* move deposit input to keystore pkg, add proof of possession and withdrawal addr

* checkpoint on progress with cluster private key manager

* checkpoint w/ bootnode config

* checkpoint

* resolve todo

* encrypt the secrets

* add note about querying testnet

* workspace

* checkpoitn

* remove limits

* update

* checkpoint

* checkpoint

* remove jwt stuff

* fix build

* lint

* lint

* remove init

* remove jwt

* update

* checkpoint
2019-03-07 11:14:57 -05:00

53 lines
1.6 KiB
Go

package main
import (
"flag"
"fmt"
"net"
pb "github.com/prysmaticlabs/prysm/proto/cluster"
"github.com/prysmaticlabs/prysm/shared/prometheus"
"github.com/sirupsen/logrus"
"google.golang.org/grpc"
)
var (
port = flag.Int("port", 8000, "The port to server gRPC")
metricsPort = flag.Int("metrics-port", 9090, "The port to serve /metrics")
privateKey = flag.String("private-key", "", "The private key of funder")
rpcPath = flag.String("rpc", "", "RPC address of a running ETH1 node")
depositContractAddr = flag.String("deposit-contract", "", "Address of the deposit contract")
depositAmount = flag.Int64("deposit-amount", 0, "The amount of wei to deposit into the contract")
dbPath = flag.String("db-path", "", "The file path for database storage")
disableWatchtower = flag.Bool("disable-watchtower", false, "Disable kubernetes pod watcher. Useful for local testing")
verbose = flag.Bool("verbose", false, "Enable debug logging")
)
func main() {
flag.Parse()
if *verbose {
logrus.SetLevel(logrus.DebugLevel)
}
db := newDB(*dbPath)
srv := newServer(db, *rpcPath, *depositContractAddr, *privateKey, *depositAmount)
if !*disableWatchtower {
wt := newWatchtower(db)
go wt.WatchPods()
}
s := grpc.NewServer()
pb.RegisterPrivateKeyServiceServer(s, srv)
go prometheus.RunSimpleServerOrDie(fmt.Sprintf(":%d", *metricsPort))
lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port))
if err != nil {
panic(err)
}
log.Infof("Listening for gRPC requests on port %d", *port)
if err := s.Serve(lis); err != nil {
log.Fatal(err)
}
}