Skip to content

Latest commit

 

History

History
134 lines (101 loc) · 4.3 KB

File metadata and controls

134 lines (101 loc) · 4.3 KB
title Submitting Bids
sidebarTitle Submitting Bids

Introduction

Once you've funded your bidder node wallet, you're ready to start submitting bids to the network. It's crucial to verify that your bidder node is connected to at least one provider node. This connectivity can be confirmed via the localhost:13523/topology endpoint.

💳 Prepay For Bids

Run this command to load your account with funds to start bidding:

curl -X POST http://localhost:13523/v1/bidder/prepay/1000000000000000000

This tops up your account with 1000000000000000000 wei (1 ETH), ensuring you're all set to send bids!

Sending Bids

Open a new terminal window. To send bids, we simply run the following command:

curl -X POST http://localhost:13523/v1/bidder/bid \
-d '{
    "txHashes": ["0549fc7c57fffbdbfb2cf9d5e0de165fc68dadb5c27c42fdad0bdf506f4eacae"],
    "amount": "<amount in wei>",
    "blockNumber": <integer blocknumber>
}'

To include bundles of transactions, add them in the atomic sequence in which they exist in the bundle, as follows:

curl -X POST http://localhost:13523/v1/bidder/bid \
-d '{
    "txHashes": ["0549fc7c57fffbdbfb2cf9d5e0de165fc68dadb5c27c42fdad0bdf506f4eacae", 22145ba31366d29a893ae3ffbc95c36c06e8819a289ac588594c9512d0a99810, 7e1506f266bc86c81ae46018053a274a3bd96a9eff17392930707bf8fa5ff6be],
    "amount": "<amount in wei>",
    "blockNumber": <integer blocknumber>
}'

💡You can change the values in the fields txHash, amount and blockNumber as desired.

We recommend leveraging the Go RPC client or alternatively using the REST API below to send bids. For those who prefer to use command-line tools, options like grpcurl, or BloomRPC are available. These tools require the protobuf definitions from the repository to interact with the RPC services.

REST API

🚀 Ready to send bids? Just execute this command:

curl -X POST http://localhost:13523/v1/bidder/bid \
-d '{
  "txHash": <the hash of the transaction>,
  "amount": <amount in wei>,
  "blockNumber": <blocknumber>
}'
curl -X POST http://localhost:13523/v1/bidder/bid \
-d '{
  "txHash": "91a89B633194c0D86C539A1A5B14DCCacfD47094",
  "amount": 10000000000000000,
  "blockNumber": 4123456
}'

🌐 Postman Power: Prefer a GUI? We've created a custom Postman request as an alterative way to send bids. Ensure you've got the Postman agent ready to go!

The REST API provides a straightforward way to submit bids using HTTP requests. For detailed usage instructions, refer to [the Bidder API documentation]/api-reference/bidder/sendbid).

Official Go RPC Client

For Go developers, leveraging the official Go RPC client is the recommended approach. Start by installing the mev-commit package:

go get github.com/primevprotocol/mev-commit

Then, incorporate the generated client into your Go application as follows:

import bidderapiv1 "github.com/primevprotocol/mev-commit/gen/go/rpc/bidderapi/v1"

conn, err := grpc.DialContext(
    context.Background(),
    "localhost:13524",
    grpc.WithBlock(),
    grpc.WithTransportCredentials(insecure.NewCredentials()),
)

if err != nil {
    // Error handling logic here
}

bid := &pb.Bid{
    TxHashes: []string{
        "fe4cb47db3630551beedfbd02a71ecc69fd59758e2ba699606e2d5c74284ffa7",
        "71c1348f2d7ff7e814f9c3617983703435ea7446de420aeac488bf1de35737e8",
    },
    Amount:      "1000000000", // Specify amount in wei
    BlockNumber: 123456,
}

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())
}

Custom Client Generation

Utilize the provided protobuf files to generate a client in your preferred programming language, enabling seamless integration with your existing codebase.