Providers that have registered in the mev-commit registry will automatically start receiving bids on the mev-commit p2p network from bidders. In order to see incoming bids, providers need to communicate with their mev-commit node:
Use the official go RPC client to communicate with your mev-commit node. Go get the mev-commit package and then import the generated client as below:
Install the mev-commit package:
❯_ terminal
Copy
Ask AI
go get github.com/primev/mev-commit
Incorporate the generated client into your Go application as follows:
Copy
Ask AI
import providerapiv1 "github.com/primev/mev-commit/gen/go/rpc/providerapi/v1"conn, err = grpc.DialContext( context.Background(), "localhost:13524", grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials()),)if err != nil { // handle error}client := providerapiv1.NewProviderClient(conn)bidStream, err := client.ReceiveBids(context.Background(), &providerapiv1.EmptyMessage{})if err != nil { // handle error}bidC := make(chan *providerapiv1.Bid)go func() { defer close(bidC) for { bid, err := bidStream.Recv() if err != nil { // handle error } select { case <-bidStream.Context().Done(): case bidC <- bid: } }}()stream, err := client.SendProcessedBids(context.Background())if err != nil { // handle error}for bid := range bidS { // check the bid details and communicate with the block-building // infrastructure to make a decision status := getDecision(bid) err := stream.Send(&providerapiv1.BidResponse{ BidDigest: bid.BidDigest, Status: status, }) if err != nil { // handle error }}
There is an example implementation of a dummy provider client which blindly accepts all the bids it sees from its mev-commit node. This could be a good starting point for providers implementing their commitment decision logic in golang.