Bidders

Bidders will use the bidder role to run their nodes. The node provides the Bidder API to submit bids to the network and will sign the bid before sending it out. In response, bidders will receive commitments from providers if their bid is accepted. This is a streaming response, and bidders are expected to keep their connection alive until their node receives all relevant commitments.

The Bidder API is also implemented using the gRPC framework, supporting two primary operations:

  • Send Bid: User submit their bid.
  • Receive Preconfirmation: The user receives streaming preconfirmations if accepted.

RPC API for Bidders

Users can find the protobuf file in the repository. This can be used to generate the client for the RPC in the language of your choice. The Go client has already been generated in the repository. For other languages, please follow the instructions in the gRPC documentation to generate them separately.

API Operation:

  rpc SendBid(Bid) returns (stream PreConfirmation)

Message Definitions

message Bid {  string tx_hash = 1;  int64 amount = 2;  int64 block_number = 3;}; message PreConfirmation {  string tx_hash = 1;  int64 amount = 2;  int64 block_number = 3;  string bid_digest = 4;  string bid_signature = 5;  string pre_confirmation_digest = 6;  string pre_confirmation_signature = 7;};

HTTP API

The same API is also available on the HTTP port configured on the node. Please review the API docs to understand the usage.

An example CLI application is implemented in the repository. The primary purpose of this example is to demonstrate the process of integrating with the RPC API.

Connecting to the gRPC Node

For providers, the ReceiveBids and SendProcessedBids streams are vital for bid management. By default, this service is disabled and must be enabled via the ProviderAPIEnabled flag in the config file.

Config Example with Provider API Enabled:

**expose_provider_api: true**
priv_key_file: /path/to/key
peer_type: provider
p2p_port: 13522
http_port: 13523
rpc_port: 13524
secret: hello
log_fmt: text
log_level: debug
bidder_registry_contract: 0xa86a41b57Fb73f9118F84847574517258d29eAD0
provider_registry_contract: 0x5960774AD41D03DAB4916a30bD2190f8b3b3b4b2
preconf_contract: 0x7D1a4707e573D260581f3AB3f90f697Ab03fC6Dd
rpc_endpoint: https://chainrpc.testnet.mev-commit.xyz
bootnodes:
  - /dnsaddr/bootnode.testnet.mev-commit.xyz

gRPC API Specification:

// ReceiveBids is called by the execution provider to receive bids from the mev-commit node.
// The mev-commit node will stream bids to the execution provider.
rpc ReceiveBids(EmptyMessage) returns (stream Bid) {}
// SendProcessedBids is called by the provider to send processed bids to the mev-commit node.
// The execution provider will stream processed bids to the mev-commit node.
rpc SendProcessedBids(stream BidResponse) returns (EmptyMessage) {}

The following file shows an implementation of a wrapped client that interfaces with the GRPC API client that was autogenerated here.