You will want to connect to a decisioning system that will accept and reject bids based on custom criteria. You can read more about the API to open a gRPC stream here.
You require Go Version 1.21.1 to run the example emulator
Configuring custom logic to process bids and send Commitments
We can take a deeper look at how you can add custom logic to decision on the sending of commitments.Integrating Bid Processing in Your System
To integrate bid processing in your system using the Provider API, follow these steps to receive bid information and send back processed bids:1
Implement the gRPC Service
Implement the Provider service as outlined in the providerapi.proto. This requires setting up a server that can manage RPC methods, with a particular emphasis on the reception of bids and response of commitment authorizations.
2
Receive Bids
Utilize the ReceiveBids RPC method to listen for incoming bids from clients. This method streams bid messages to your server.
The structure of the bid is as follows:The raw transactions are optionally provided by the bidder. If provided the order of the transaction hashes in 
txHashes
will be the same as the order or the corresponding rawTransactions
.Below is an image of the flow through which bids would be received through the gRPC API
3
Process Bids
For each received bid, implement your custom logic to validate and process these bids. This could involve checking the bid’s validity and feasibility based on orderflow, computing the effective gas price, and deciding whether to accept or reject the bid.
4
Send Processed Bid Responses (Accept/Reject)
After processing each bid, construct a BidResponse message indicating the outcome. This message should include the bid’s digest and a status indicating acceptance or rejection.
At a high level, to commit to a bid, your code must send a
STATUS_ACCEPTED
with the bid digest specified, and correspondingly STATUS_REJECTED
to reject the bid.Details on BidResponse
Details on BidResponse
The BidResponse structure is as follows:It contains the following fields:
- bid_digest: A byte array (bytes type) that represents the digest of the bid message signed by the bidder. This serves as a unique identifier for the bid in question.
- status: An enumeration (enum Status) that indicates the status of the bid. The status can be one of three values: STATUS_UNSPECIFIED: The default value, indicating that the status has not been set or is unknown. STATUS_ACCEPTED: Indicates that the bid has been accepted by the provider. STATUS_REJECTED: Indicates that the bid has been rejected by the provider.
- dispatch_timestamp: Timestamp (int64 type) at which the commitment is accepted by provider and is used to compute the expected revenue from the preconfirmation.
5
Server Setup
Deploy your gRPC server on suitable infrastructure, ensuring it’s accessible to clients. Configure necessary network settings for security and connectivity.
Example Server Implementation in Go: