func (s *Service) Commit(ctx context.Context, peer *core.Endpoint, account string, confirmationData []byte) ([]byte, []byte, error) {
	connResource, err := s.obtainConnection(ctx, peer.ConnectAddress())
	if err != nil {
		return nil, nil, errors.Wrap(err, "Failed to obtain connection for Commit()")
	}
	defer connResource.Release()
	client := pb.NewDKGClient(connResource.Value().(*grpc.ClientConn))
	req := &pb.CommitRequest{
		Account:          account,
		ConfirmationData: confirmationData,
	}
	res, err := client.Commit(ctx, req)
	if err != nil {
		return nil, nil, errors.Wrap(err, "Failed to call Commit()")
	}
	return res.PublicKey, res.ConfirmationSignature, nil
}
Commit sends a request to the given participant to commit the given DKG.
package grpc
import (
	"context"
	"crypto/tls"
	"crypto/x509"
	"sync"
	"github.com/attestantio/dirk/core"
	"github.com/herumi/bls-eth-go-binary/bls"
	"github.com/jackc/puddle"
	"github.com/pkg/errors"
	"github.com/rs/zerolog"
	zerologger "github.com/rs/zerolog/log"
	pb "github.com/wealdtech/eth2-signer-api/pb/v1"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials"
)
type Service struct {
	name                 string
	credentials          credentials.TransportCredentials
	connectionPoolsMutex sync.Mutex
	connectionPools      map[string]*puddle.Pool
}
var log zerolog.Logger
func New(ctx context.Context, params ...Parameter) (*Service, error) {
	parameters, err := parseAndCheckParameters(params...)
	if err != nil {
		return nil, errors.Wrap(err, "problem with parameters")
	}
	log = zerologger.With().Str("service", "sender").Str("impl", "grpc").Logger()
	if parameters.logLevel != log.GetLevel() {
		log = log.Level(parameters.logLevel)
	}
	credentials, err := composeCredentials(ctx, parameters.serverCert, parameters.serverKey, parameters.caCert)
	if err != nil {
		return nil, errors.Wrap(err, "failed to compose client credentials")
	}
	service := &Service{
		name:            parameters.name,
		credentials:     credentials,
		connectionPools: make(map[string]*puddle.Pool),
	}
	return service, nil
}
func (s *Service) Prepare(ctx context.Context,
	peer *core.Endpoint,
	account string,
	passphrase []byte,
	threshold uint32,
	participants []*core.Endpoint) error {
	connResource, err := s.obtainConnection(ctx, peer.ConnectAddress())
	if err != nil {
		return errors.Wrap(err, "Failed to obtain connection for Prepare()")
	}
	defer connResource.Release()
	client := pb.NewDKGClient(connResource.Value().(*grpc.ClientConn))
	pbParticipants := make([]*pb.Endpoint, len(participants))
	for i, participant := range participants {
		pbParticipants[i] = &pb.Endpoint{
			Id:   participant.ID,
			Name: participant.Name,
			Port: participant.Port,
		}
	}
	req := &pb.PrepareRequest{
		Account:      account,
		Passphrase:   passphrase,
		Threshold:    threshold,
		Participants: pbParticipants,
	}
	if _, err := client.Prepare(ctx, req); err != nil {
		return errors.Wrap(err, "Failed to call Prepare()")
	}
	return nil
}
func (s *Service) Execute(ctx context.Context, peer *core.Endpoint, account string) error {
	connResource, err := s.obtainConnection(ctx, peer.ConnectAddress())
	if err != nil {
		return errors.Wrap(err, "Failed to obtain connection for Execute()")
	}
	defer connResource.Release()
	client := pb.NewDKGClient(connResource.Value().(*grpc.ClientConn))
	req := &pb.ExecuteRequest{
		Account: account,
	}
	if _, err := client.Execute(ctx, req); err != nil {
		return errors.Wrap(err, "Failed to call Execute()")
	}
	return nil
}