Skip to content
This repository was archived by the owner on Jun 20, 2024. It is now read-only.

Commit 1cf3bf8

Browse files
author
alok
committed
fix: docs
1 parent aebff1d commit 1cf3bf8

File tree

11 files changed

+4666
-0
lines changed

11 files changed

+4666
-0
lines changed

docs/.nojekyll

Whitespace-only changes.

docs/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# mev-commit
2+
3+
## Summary
4+
Introducing mev-commit, a peer-to-peer (P2P) networking software that serves as a conduit for real-time communication with execution providers. mev-commit enables MEV actors to join and utilize a P2P network for the exchange of execution bids and commitments, enriching the transaction execution experience by allowing for granular specification of execution needs and receiving real-time commitments.
5+
6+
## Actors
7+
**Providers**
8+
9+
Providers of execution services (**Block builders, Rollup Sequencers)**
10+
11+
**Users**
12+
13+
Users of execution services (**MEV searchers, AA bundlers, L2s, and other blockspace consumers)**
14+
15+
## Network Topology
16+
17+
The network topology we will be releasing is as follows:
18+
![](topology.png)
19+
20+
Users will connect to providers, each of these nodes will have access to a bootnode for network startup. Providers will also be able to run gateway nodes to allow users to send bids directly to an RPC endpoint under a provider URL.
21+
22+
## Bids and Privacy
23+
24+
mev-commit is inherently pseudonymous, allowing any Ethereum address to submit a bid for transaction execution, including bids for transactions that belong to others. Bids use the transaction hash identifier for universal provider pickup and are visible to network actors. Bids are processed by both network providers and Primev chain validators, ensuring verifiable commitments and seamless reward settlements.
25+
26+
## Commitments and Privacy
27+
28+
Commitments are commitment signatures from providers in response to bids. mev-commit provides a standard commitment method and a private commitment method for providers to choose from. Private commitments are encrypted and can only be read by the bidder until after the block slot ends and they’re revealed. Providers can also maintain their pseudonymity with commitments, using alternate addresses to obfuscate their identity as known block provider or sequencers.
29+
30+
For more on commitment privacy
31+
32+
## Settlement Layer
33+
34+
Bids and commitments will settle on a specialized Ethereum fork based on the OP stack. Initially centralized, the settlement layer operates as a high-throughput chain to expedite the settlement process. As governance processes are initiated, this chain will become a federated rollup to providers on the network to assume the Sequencer role in turns. A rollup sequencer maintains the state of bids and commitments, acting as a network peer and handles fund settlements, rewards, or slashes.
35+
36+
## Network Flows
37+
38+
Diagram depicting **the flow of bids, commitments, and funds**
39+
40+
![](flow.png)

docs/_sidebar.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<!-- docs/_sidebar.md -->
2+
3+
* [Home](/)
4+
* [Quickstart](quickstart.md "Quickstart")
5+
* [API clients](api-clients.md "API clients")
6+
* [Debugging](debugging.md "Debugging")

docs/api-clients.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# API clients
2+
3+
The mev-commit node provides two key APIs. The execution providers need to use the **Provider API** whereas the users need to use the **User API** based on their role in the network.
4+
5+
## Providers
6+
7+
Execution providers will use the `provider` role of the mev-commit software to run their nodes. This will allow users to send bids to them to include in the blocks that they build. They will use the **Provider RPC API** to receive signed bids that are being propogated in the network. Once they get a bid, they need to communicate with the mev-commit node whether the bid has been **Accepted** or **Rejected**. If accepted, the mev-commit node will send a signed pre-confirmation to the users.
8+
9+
The API is implemented using gRPC framework. This allows two types of operations:
10+
11+
### RPC API
12+
13+
Users can find the protobuf file in the [repository](https://github.com/primevprotocol/mev-commit/blob/main/rpc/providerapi/v1/providerapi.proto). This can be used to generate the client for the RPC in the language of your choice. The go client is already generated in the repository. For other languagues, please follow the instructions in the [grpc documentation](https://grpc.io/docs/languages/) to generate them.
14+
15+
There are two main APIs
16+
```proto
17+
// ReceiveBids is called by the execution provider to receive bids from the mev-commit node.
18+
// The mev-commit node will stream bids to the execution provider.
19+
rpc ReceiveBids(EmptyMessage) returns (stream Bid) {}
20+
// SendProcessedBids is called by the provider to send processed bids to the mev-commit node.
21+
// The execution provider will stream processed bids to the mev-commit node.
22+
rpc SendProcessedBids(stream BidResponse) returns (EmptyMessage) {}
23+
```
24+
25+
The message definitions are as follows:
26+
```proto
27+
message Bid {
28+
string txn_hash = 1;
29+
int64 bid_amt = 2;
30+
int64 block_number = 3;
31+
bytes bid_hash = 4;
32+
};
33+
34+
message BidResponse {
35+
bytes bid_hash = 1;
36+
enum Status {
37+
STATUS_UNSPECIFIED = 0;
38+
STATUS_ACCEPTED = 1;
39+
STATUS_REJECTED = 2;
40+
}
41+
Status status = 2;
42+
};
43+
44+
```
45+
46+
### HTTP API
47+
48+
The same API is also available on the HTTP port configured on the node. Please go through the [API docs](api/provider.html) to understand the usage.
49+
50+
An [example client](https://github.com/primevprotocol/mev-commit/tree/main/examples/provideremulator) is implemented in the repository. This is mainly to demostrate how to write the client integrated in the provider's environment. The client blindly accepts each bid that it receives, however the provider needs to implement custom logic here to make the decision.
51+
52+
## Users
53+
54+
Users will use the `user` role of the mev-commit software to run their nodes. With this role, the node provides the **User API** to submit bids to the network. The mev-commit node will sign the bid before it sends it to different providers that are accepting bids. On the response, users will get pre-confirmations from the providers if the bid is accepted. This is a streaming response and users are expected to keep the connection alive till all the preconfirmations are received by the node.
55+
56+
The API is implemented using gRPC framework. This allows two types of operations:
57+
58+
### RPC API
59+
60+
Users can find the protobuf file in the [repository](https://github.com/primevprotocol/mev-commit/blob/main/rpc/userapi/v1/userapi.proto). This can be used to generate the client for the RPC in the language of your choice. The go client is already generated in the repository. For other languagues, please follow the instructions in the [grpc documentation](https://grpc.io/docs/languages/) to generate them.
61+
62+
The API available is:
63+
```proto
64+
rpc SendBid(Bid) returns (stream PreConfirmation)
65+
```
66+
67+
The message definitions are as follows:
68+
```proto
69+
message Bid {
70+
string tx_hash = 1;
71+
int64 amount = 2;
72+
int64 block_number = 3;
73+
};
74+
75+
message PreConfirmation {
76+
string tx_hash = 1;
77+
int64 amount = 2;
78+
int64 block_number = 3;
79+
string bid_digest = 4;
80+
string bid_signature = 5;
81+
string pre_confirmation_digest = 6;
82+
string pre_confirmation_signature = 7;
83+
};
84+
```
85+
86+
### HTTP API
87+
88+
The same API is also available on the HTTP port configured on the node. Please go through the [API docs](api/user.html) to understand the usage.
89+
90+
An [example CLI application](https://github.com/primevprotocol/mev-commit/tree/main/examples/usercli) is implemented in the repository. This is mainly to demostrate how to integrate with the RPC API.
91+
92+

docs/api/provider.html

Lines changed: 2190 additions & 0 deletions
Large diffs are not rendered by default.

docs/api/user.html

Lines changed: 2184 additions & 0 deletions
Large diffs are not rendered by default.

docs/debugging.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Debugging
2+
3+
The mev-commit node is still in active development. As a result there is some debugging instrumentation available on the node. In the normal use-cases, the users might not need this, but they can always use this to get more information on the inner-workings of the node. These tools can be accessed on the HTTP API endpoint.
4+
5+
## Network topology
6+
7+
The topology of the network as seen by the mev-commit node can be obtained on the `/topology` endpoint of the node. This should show the no. of nodes connected and their roles. This would be mainly used to check if the node has sufficient connectivity with the network.
8+
9+
```json
10+
{
11+
"self": {
12+
"Addresses": [
13+
"/ip4/127.0.0.1/tcp/13522",
14+
"/ip4/172.28.0.4/tcp/13522"
15+
],
16+
"Ethereum Address": "0xB61545548948E9299Ce6eb4C01F2C31FcE6c9E83",
17+
"Peer Type": "user",
18+
"Underlay": "16Uiu2HAmNMdhYW6KdECZSNoCseM4cwKbV72BgCYZMz9SbMmxWScM"
19+
},
20+
"connected_peers": {
21+
"providers": [
22+
"0x6c27a32189016bde0d4a506805aa2b6c46295e8a"
23+
]
24+
}
25+
}
26+
```
27+
28+
## Prometheus metrics
29+
30+
The node also emits a bunch of prometheus metrics. These can be potentially used to write dashboards that will help show different stats of the node. The node uses `libp2p` networking library. The `libp2p` default metrics are also available on the `/metrics` endpoint.
31+
32+
## Pprof endpoints
33+
34+
The pprof endpoints are also accessible on the node on the `/debug/pprof` endpoint. These are mainly used to observe how the node is performing for eg. the memory, CPU usage on the nodes. These are useful only for users who already know how to use them. Explaining them is beyond the scope of this documentation.

docs/flow.png

77.4 KB
Loading

docs/index.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Document</title>
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
7+
<meta name="description" content="Description">
8+
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
9+
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css">
10+
</head>
11+
<body>
12+
<div id="app"></div>
13+
<script>
14+
window.$docsify = {
15+
name: 'mev-commit',
16+
repo: 'primevprotocol/mev-commit',
17+
logo: 'https://avatars.githubusercontent.com/u/121584070?v=4',
18+
loadSidebar: true,
19+
noCompileLinks: ['/api/.*'],
20+
subMaxLevel: 2
21+
}
22+
</script>
23+
<!-- Docsify v4 -->
24+
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
25+
</body>
26+
</html>

docs/quickstart.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Quickstart
2+
3+
## Using the CLI
4+
5+
mev-commit software is a CLI program that needs to be run by the users in their own environments. The CLI has two commands mainly. You can run the main command with `-h`/`--help` option to see the available commands.
6+
7+
```
8+
❯ mev-commit -h
9+
NAME:
10+
mev-commit - Entry point for mev-commit
11+
12+
USAGE:
13+
mev-commit [global options] command [command options] [arguments...]
14+
15+
VERSION:
16+
"v1.0.0-alpha-a834960"
17+
18+
COMMANDS:
19+
start Start the mev-commit node
20+
create-key Create a new ECDSA private key and save it to a file
21+
help, h Shows a list of commands or help for one command
22+
23+
GLOBAL OPTIONS:
24+
--help, -h show help
25+
--version, -v print the version
26+
```
27+
28+
Users can use any existing ECDSA private key or create one using the `create-key` command. This key is used to derive the ethereum address of the node taking part in the network.
29+
30+
```
31+
❯ mev-commit create-key -h
32+
NAME:
33+
mev-commit create-key - Create a new ECDSA private key and save it to a file
34+
35+
USAGE:
36+
mev-commit create-key [command options] <output_file>
37+
38+
OPTIONS:
39+
--help, -h show help
40+
```
41+
42+
In order to run a node, users need to create a configuration file in the YAML format. Example config files can be found in the [config](https://github.com/primevprotocol/mev-commit/tree/main/config) folder. The important options are defined below:
43+
44+
```yaml
45+
# Path to private key file.
46+
priv_key_file: ~/.mev-commit/keys/nodekey
47+
48+
# Type of peer. Options are provider and user.
49+
peer_type: provider
50+
51+
# Port used for P2P traffic. If not configured, 13522 is the default.
52+
p2p_port: 13522
53+
54+
# Port used for HTTP traffic. If not configured, 13523 is the default.
55+
http_port: 13523
56+
57+
# Port used for RPC API. If not configured, 13524 is the default.
58+
rpc_port: 13524
59+
60+
# Secret for the node. This is used to authorize the nodes. The value doesnt matter as long as it is sufficiently unique. It is signed using the private key.
61+
secret: hello
62+
63+
# Format used for the logs. Options are "text" or "json".
64+
log_fmt: text
65+
66+
# Log level. Options are "debug", "info", "warn" or "error".
67+
log_level: debug
68+
69+
# Bootnodes used for bootstrapping the network.
70+
bootnodes:
71+
- /ip4/35.91.118.20/tcp/13522/p2p/16Uiu2HAmAG5z3E8p7o19tEcLdGvYrJYdD1NabRDc6jmizDva5BL3
72+
73+
# The default is set to false for development reasons. Change it to true if you wish to accept bids on your provider instance
74+
expose_provider_api: false
75+
```
76+
77+
Place this config file in some folder. It is advised to create a new `.mev-commit` folder in the home directory and place it there. Once this is done, users can start the node using the `start` command.
78+
79+
```
80+
❯ mev-commit start -h
81+
NAME:
82+
mev-commit start - Start the mev-commit node
83+
84+
USAGE:
85+
mev-commit start [command options] [arguments...]
86+
87+
OPTIONS:
88+
--config value path to config file [$MEV_COMMIT_CONFIG]
89+
--help, -h show help
90+
```
91+
92+
## Docker
93+
94+
Optionally users can use the docker images to run the client in their docker environment. You need to make sure the node is able to communicate with provider/user nodes.

0 commit comments

Comments
 (0)