Official Go RPC Client
For Go developers, leveraging the official Go RPC client is the recommended approach. Start by installing the mev-commit package:❯_ terminal
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
go install github.com/primev/mev-commit@latest
import bidderapiv1 "github.com/primev/mev-commit/p2p/gen/go/bidderapi/v1"
conn, err := grpc.DialContext(
context.Background(),
"localhost:13524",
grpc.WithBlock(),
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
if err != nil {
// Error handling logic here
}
currentTime := time.Now().UnixMilli()
bid := &pb.Bid{
TxHashes: []string{
"fe4cb47db3630551beedfbd02a71ecc69fd59758e2ba699606e2d5c74284ffa7",
"71c1348f2d7ff7e814f9c3617983703435ea7446de420aeac488bf1de35737e8",
},
Amount: "1000000000", // Specify amount in wei
BlockNumber: 123456,
DecayStartTimestamp: currentTime - (time.Duration(8 * time.Second).Milliseconds()),
DecayEndTimestamp: currentTime + (time.Duration(8 * time.Second).Milliseconds()),
}
rcv, err := bidderClient.SendBid(context.Background(), bid)
if err != nil {
// Error handling logic here
}
for {
pc, err := rcv.Recv()
if err == io.EOF {
break
}
if err != nil {
// Error handling logic here
}
fmt.Println("Received preconfirmation:", pc.String())
}
curl -X POST http://localhost:13523/v1/bidder/bid \
-d '{
"txHashes": [<the hash of the transaction>],
"amount": <amount in wei>,
"blockNumber": <l1blocknumber>
"decayStartTimestamp": <timestamp>,
"decayEndTimestamp": <timestamp>
}'
curl -X POST http://localhost:13523/v1/bidder/bid \
-d '{
"txHashes": ["91a89B633194c0D86C539A1A5B14DCCacfD47094"],
"amount": 10000000000000000,
"blockNumber": 4123456,
"decayStartTimestamp": 1716935571901,
"decayEndTimestamp": 1716935572901
}'