Skip to content

Commit 7208c67

Browse files
authored
Merge pull request #17 from primevprotocol/fix-code-tags
fix code snippet tags
2 parents ae4ae84 + 5194fb1 commit 7208c67

15 files changed

Lines changed: 103 additions & 113 deletions

Primev Docs Testnet Ver 41c24e77a73e47e0966d54365efbbfc8.md

Lines changed: 43 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Users bidding for execution services include **mev searchers, AA bundlers, solv
153153

154154
The current bid structure being sent to the internal API is as follows:
155155

156-
```bash
156+
```text
157157
# Example Bid Structure:
158158
# txn_hash: arbitrary string value representing txn hash
159159
# bid_amt: amount to bid in wei
@@ -177,7 +177,7 @@ Note that the prepay amount a bidder has set needs to be 10 times higher than th
177177

178178
Commitments represent promises made by providers in a cryptographically verifiable manner.
179179

180-
```bash
180+
```text
181181
# commitmentDigest: Represents the hash of the bid structure, including the bid signature
182182
# commitmentSignature: Represents an ECDSA signature of the [commitmentDigest]
183183
{
@@ -369,7 +369,7 @@ mev-commit software operates as a command-line interface (CLI) tool, designed fo
369369

370370
Example:
371371

372-
```sql
372+
```text
373373
❯ mev-commit -h
374374
NAME:
375375
mev-commit - Entry point for mev-commit
@@ -394,20 +394,16 @@ GLOBAL OPTIONS:
394394

395395
- Open your command line and run:
396396

397-
```
398-
Copy code
397+
```shell
399398
buf generate
400-
401399
```
402400

403401
3. **Compile mev-commit**:
404402

405403
- In the command line, execute:
406404

407-
```go
408-
goCopy code
405+
```shell
409406
go build -o mev-commit ./cmd/main.go
410-
411407
```
412408

413409
### If you're using Docker:
@@ -417,10 +413,8 @@ GLOBAL OPTIONS:
417413
- Open your terminal and navigate to where your Dockerfile is located.
418414
- Run:
419415

420-
```sql
421-
sqlCopy code
416+
```shell
422417
docker build -t mev-commit:latest .
423-
424418
```
425419

426420
## Cryptographic Stack
@@ -489,7 +483,7 @@ Please refer to System Requirements section [here.](Primev%20Docs%20Testnet%20Ve
489483

490484
- An ECDSA private key is required to create an Ethereum address for the node as well as to use for the P2P network. Bidders can add an existing key or create a new key using the `create-key` command.
491485

492-
```sql
486+
```text
493487
NAME:
494488
mev-commit create-key - Create a new ECDSA private key and save it to a file
495489
@@ -505,7 +499,7 @@ Please refer to System Requirements section [here.](Primev%20Docs%20Testnet%20Ve
505499
- Use the examples in the **`config`** folder of the project as a reference.
506500
- Once the key is available, create a yaml config file. Example config files are available in the [config](https://github.com/primevprotocol/mev-commit/tree/main/config) folder. The important options are defined below:
507501

508-
```sql
502+
```yaml
509503
# Path to private key file.
510504
priv_key_file: ~/.mev-commit/keys/nodekey
511505
@@ -543,7 +537,7 @@ Please refer to System Requirements section [here.](Primev%20Docs%20Testnet%20Ve
543537
- Place your config file in a **`.mev-commit`** folder in your home directory.
544538
- Once this is done, users can start the node using the `start` command.
545539

546-
```sql
540+
```text
547541
NAME:
548542
mev-commit start - Start the mev-commit node
549543
@@ -559,7 +553,7 @@ Please refer to System Requirements section [here.](Primev%20Docs%20Testnet%20Ve
559553

560554
- Use **`/topology`** endpoint on the HTTP port to check peer connections.
561555

562-
```
556+
```json
563557
{
564558
"self": {
565559
"Addresses": [
@@ -583,17 +577,14 @@ Please refer to System Requirements section [here.](Primev%20Docs%20Testnet%20Ve
583577

584578
- To start the nodes, run:
585579

586-
```css
580+
```shell
587581
docker-compose up --build
588-
589582
```
590583

591584
- To stop the service:
592585

593-
```
594-
586+
```shell
595587
docker-compose down
596-
597588
```
598589

599590
## API Integration
@@ -613,13 +604,13 @@ Users can find the protobuf file in the [repository(opens in a new tab)](https:
613604
614605
There are two main APIs:
615606
616-
```
607+
```protobuf
617608
// 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) {}
618609
```
619610
620611
The message definitions are as follows:
621612
622-
```
613+
```protobuf
623614
message Bid { string txn_hash = 1; int64 bid_amt = 2; int64 block_number = 3; bytes bid_hash = 4;}; message BidResponse { bytes bid_hash = 1; enum Status { STATUS_UNSPECIFIED = 0; STATUS_ACCEPTED = 1; STATUS_REJECTED = 2; } Status status = 2;};
624615
```
625616
@@ -644,13 +635,13 @@ Users can find the protobuf file in the [repository(opens in a new tab)](https:
644635

645636
The API available is:
646637

647-
```
638+
```protobuf
648639
rpc SendBid(Bid) returns (stream PreConfirmation)
649640
```
650641

651642
The message definitions are as follows:
652643

653-
```
644+
```protobuf
654645
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;};
655646
```
656647

@@ -672,7 +663,7 @@ You can view the network's topology as recognized by the mev-commit node at the
672663

673664
Example of Topology Data:
674665

675-
```
666+
```json
676667
{ "self": { "Addresses": [ "/ip4/127.0.0.1/tcp/13522", "/ip4/172.29.18.2/tcp/13522" ], "Ethereum Address": "0xB8c29FfD307067471fd7997873DfC496Fd02956f", "Peer Type": "bootnode", "Underlay": "16Uiu2HAmLYUvthfDCewNMdfPhrVefBbsfaPL22fWWfC2zuoh5SpV" }, "connected_peers": { "bidders": [ "0xb9286cb4782e43a202bfd426abb72c8cb34f886c" ] }, "blocked_peers": [ { "Peer": "0x48ddc642514370bdafad81c91e23759b0302c915", "Reason": "insufficient stake", "Duration": "1m58.244219375s" } ]}
677668
```
678669
@@ -817,7 +808,7 @@ Hyperlane’s [Mailbox.sol](https://github.com/primevprotocol/hyperlane-monorepo
817808
818809
To join the mev-commit chain testnet with your own full-node, use [mev-commit geth (opens in a new tab)](https://github.com/primevprotocol/go-ethereum). We've modified go-ethereum to achieve shorter block periods than mainnet Ethereum, and to enable seamless native token bridging capabilities. Geth configuration will vary based on environment, but an example is provided below:
819810
820-
```
811+
```shell
821812
exec geth \ --verbosity="$VERBOSITY" \ --datadir="$GETH_DATA_DIR" \ --port 30311 \ --syncmode=full \ --gcmode=full \ --http \ --http.corsdomain="*" \ --http.vhosts="*" \ --http.addr=0.0.0.0 \ --http.port="$RPC_PORT" \ --http.api=web3,debug,eth,txpool,net,engine \ --bootnodes enode://34a2a388ad31ca37f127bb9ffe93758ee711c5c2277dff6aff2e359bcf2c9509ea55034196788dbd59ed70861f523c1c03d54f1eabb2b4a5c1c129d966fe1e65@103.219.170.127:29746 \ --networkid=$CHAIN_ID \ --unlock=$BLOCK_SIGNER_ADDRESS \ --password="$GETH_DATA_DIR"/password \ --mine \ --miner.etherbase=$BLOCK_SIGNER_ADDRESS \ --allow-insecure-unlock \ --nousb \ --netrestrict 172.13.0.0/24 \ --metrics \ --metrics.addr=0.0.0.0 \ --metrics.port=6060 \ --ws \ --ws.addr=0.0.0.0 \ --ws.port="$WS_PORT" \ --ws.origins="*" \ --ws.api=debug,eth,txpool,net,engine \ --rpc.allow-unprotected-txs \ --authrpc.addr="0.0.0.0" \ --authrpc.port="8551" \ --authrpc.vhosts="*" \ --nat extip:$NODE_IP
822813
```
823814
@@ -863,7 +854,7 @@ The current minimum requirement is 1 ether set [here](https://github.com/primevp
863854
864855
Simply run the following command in your terminal:
865856
866-
```bash
857+
```shell
867858
curl -o launchmevcommit https://raw.githubusercontent.com/primevprotocol/scripts/v0.1.0/launchmevcommit && chmod +x launchmevcommit && ./launchmevcommit --rpc-url https://chainrpc.testnet.mev-commit.xyz --node-type bidder
868859
```
869860
@@ -881,7 +872,7 @@ We provide advanced instructions for those of you who want to customize the star
881872
## Running the Bidder Node
882873
883874
- Step 1. Check your CPU architecture
884-
```bash
875+
```shell
885876
uname # This will give you the OS type
886877
uname -m # This will give you the chip architecture
887878
```
@@ -893,31 +884,31 @@ We provide advanced instructions for those of you who want to customize the star
893884
Note this will be considered the root folder of your mev-commit
894885
- Step 4. Run the initialization
895886
cd into the folder that contains the mev-commit binary and run the following command
896-
```bash
887+
```shell
897888
./mev-commit init --dir . --rpc-endpoint https://chainrpc.testnet.mev-commit.xyz --peer-type bidder
898889
```
899890
This will create both a private key file and a config.yaml file and store it in your current directory.
900891
While in the directory, run the following command to export relevant data about your address and private key:
901-
```bash
892+
```shell
902893
export KEY=$(cat key)
903894
export ADDRESS=$(cast wallet address --private-key 0x$(cat key))
904895
```
905896
- Step 5. Fund the account
906897
In the same shell run the following command to transfer a 100 ether into your wallet from a faucet account:
907-
```bash
898+
```shell
908899
cast send --rpc-url [https://chainrpc.testnet.mev-commit.xyz](https://chainrpc.testnet.mev-commit.xyz/) --private-key 0x7c9bf0f015874594d321c1c01ada3166c3509bbd91f76f9e4d7380c2df269c55 $ADDRESS --value 100ether
909900
```
910901
- Step 6. Run the node
911902
1. cd into the folder with your mev-commit binary
912903
2. Run the Node:
913-
```bash
904+
```shell
914905
./mev-commit start --config=~/config.yaml
915906
```
916907
- Step 7. Prepay for bids
917908
### Prepaying for Bids
918909
The bidder needs to prepay a certain amount onto the primev contracts to allow them to send bids and receive commitments. This is to ensure that providers can pull funds once the bids have been completed.
919910
To prepay, first **********\*\***********\*\***********\*\***********open a new terminal**********\*\***********\*\***********\*\*********** and run the following command:
920-
```bash
911+
```shell
921912
curl -X POST http://localhost:13523/v1/bidder/prepay/1000000000000000000
922913
```
923914
This will prepay `1000000000000000000 wei` into your account.
@@ -928,7 +919,7 @@ First you can set the local environment variables to set your KEY and ADDERSS. C
928919
929920
Setting these will make running the commands to interact with your account easier.
930921
931-
```bash
922+
```shell
932923
export KEY=$(cat key)
933924
export ADDRESS=$(cast wallet address --private-key 0x$(cat key))
934925
```
@@ -937,7 +928,7 @@ export ADDRESS=$(cast wallet address --private-key 0x$(cat key))
937928
938929
To send bids, we simply run the following command:
939930
940-
```bash
931+
```shell
941932
curl -X POST http://localhost:13523/v1/bidder/bid \
942933
-d '{
943934
"txHash": "91a89B633194c0D86C539A1A5B14DCCacfD47094",
@@ -958,7 +949,7 @@ The bidder needs to prepay a certain amount onto the primev contracts to allow t
958949
959950
To prepay, ensure you’ve got the bidder node up, and run the following command:
960951
961-
```bash
952+
```shell
962953
curl -X POST http://localhost:13523/v1/bidder/prepay/1000000000000000000
963954
```
964955
@@ -973,7 +964,7 @@ This will prepay `1000000000000000000 wei` into your account.
973964
974965
To get the current prepayed balance in the contract
975966
976-
```bash
967+
```shell
977968
curl -s http://localhost:13523/v1/bidder/get_allowance
978969
```
979970
@@ -984,29 +975,29 @@ curl -s http://localhost:13523/v1/bidder/get_allowance
984975
985976
### Withdraw Prepayed Funds
986977
987-
```bash
978+
```shell
988979
cast send 0xa86a41b57Fb73f9118F84847574517258d29eAD0 "withdrawPrepayedAmount(address)" $ADDRESS --rpc-url https://chainrpc.testnet.mev-commit.xyz --private-key $KEY
989980
```
990981
991982
### Checking Balance of your Wallet
992983
993984
This command will allow you to check your current wallet balance on mev-commit chain
994985
995-
```bash
986+
```shell
996987
cast b $ADDRESS --rpc-url https://chainrpc.testnet.mev-commit.xyz
997988
```
998989
999990
### Check Total Value Locked in Contracts
1000991
1001-
```bash
992+
```shell
1002993
python3 -c "print($(cast b 0xa86a41b57Fb73f9118F84847574517258d29eAD0 --rpc-url https://chainrpc.testnet.mev-commit.xyz) + $(cast b 0x5960774AD41D03DAB4916a30bD2190f8b3b3b4b2 --rpc-url https://chainrpc.testnet.mev-commit.xyz))"
1003994
```
1004995
1005996
### Topology
1006997
1007998
This allows you to view the topology of your machines p2p connections
1008999
1009-
```bash
1000+
```shell
10101001
curl [http://localhost:13523/topology](http://localhost:13523/topology)
10111002
```
10121003
@@ -1021,7 +1012,7 @@ To become a provider, you need to run the provider node along with a provider em
10211012
10221013
To spin up a Provider node, you can simply run the following:
10231014
1024-
```bash
1015+
```shell
10251016
curl -o launchmevcommit https://raw.githubusercontent.com/primevprotocol/scripts/v0.1.0/launchmevcommit && chmod +x launchmevcommit && ./launchmevcommit --rpc-url https://chainrpc.testnet.mev-commit.xyz --node-type provider
10261017
```
10271018
@@ -1041,7 +1032,7 @@ We provide advanced instructions for those of you who want to customize the star
10411032
- `cast` Install using `curl -L [https://foundry.paradigm.xyz](https://foundry.paradigm.xyz/) | bash`
10421033
- run foundryup
10431034
- Step 1. Check your CPU architecture
1044-
```bash
1035+
```shell
10451036
uname # This will give you the OS type
10461037
uname -m # This will give you the chip architecture
10471038
```
@@ -1053,12 +1044,12 @@ We provide advanced instructions for those of you who want to customize the star
10531044
Note this will be considered the root folder of your mev-commit
10541045
- Step 4. Run the initialization
10551046
cd into the folder that contains the mev-commit binary and run the following command
1056-
```bash
1047+
```shell
10571048
./mev-commit init --dir . --rpc-endpoint https://chainrpc.testnet.mev-commit.xyz --peer-type provider
10581049
```
10591050
This will create both a private key file and a config.yaml file and store it in your current directory.
10601051
While in the directory, run the following command to export relevant data about your address and private key:
1061-
```bash
1052+
```shell
10621053
export KEY=$(cat key)
10631054
export ADDRESS=$(cast wallet address --private-key 0x$(cat key))
10641055
```
@@ -1069,19 +1060,19 @@ We provide advanced instructions for those of you who want to customize the star
10691060
10701061
</aside>
10711062
1072-
```bash
1063+
```shell
10731064
cast send --rpc-url https://chainrpc.testnet.mev-commit.xyz --private-key 0x7c9bf0f015874594d321c1c01ada3166c3509bbd91f76f9e4d7380c2df269c55 $(cast wallet address --private-key 0x$(cat key)) --value 100ether
10741065
```
10751066
10761067
- Step 6. Run the node
10771068
1. cd into the folder with your mev-commit binary
10781069
2. Run the Node:
1079-
```bash
1070+
```shell
10801071
./mev-commit start --config=~/config.yaml
10811072
```
10821073
- Step 7. Stake Funds and Register
10831074
This command is used to ensure that your provider has been registered with a stake in our protocol. This is used to ensure it can connect with the mev-commit-p2p network. Ensure you run this command in the mev-commit directory.
1084-
```bash
1075+
```shell
10851076
cast send 0x5960774AD41D03DAB4916a30bD2190f8b3b3b4b2 "registerAndStake()" $(cast wallet address --private-key 0x$(cat key)) --rpc-url https://chainrpc.testnet.mev-commit.xyz --private-key $(cat key) --value 100ether
10861077
```
10871078
@@ -1113,7 +1104,7 @@ Once a provider node is up and running, you can use the `ReceiveBids` stream to
11131104
- /dnsaddr/bootnode.testnet.mev-commit.xyz
11141105
```
11151106
- gRPC API Specification
1116-
```bash
1107+
```protobuf
11171108
// ReceiveBids is called by the execution provider to receive bids from the mev-commit node.
11181109
// The mev-commit node will stream bids to the execution provider.
11191110
rpc ReceiveBids(EmptyMessage) returns (stream Bid) {}
@@ -1134,7 +1125,7 @@ We have a running mev-commit provider node on our testnet that will always retur
11341125
11351126
### Step 1. Get the Bidder Node up and running
11361127
1137-
```bash
1128+
```shell
11381129
curl -o launchmevcommit https://raw.githubusercontent.com/primevprotocol/scripts/v0.1.0/launchmevcommit && chmod +x launchmevcommit && ./launchmevcommit --node-type bidder
11391130
```
11401131
@@ -1146,7 +1137,7 @@ If you’ve already run the command, it will ask you if you want to overwrite, f
11461137
11471138
Change the `txHash` `amount` and `blockNumber` to your liking
11481139
1149-
```bash
1140+
```shell
11501141
curl -X POST http://localhost:13523/v1/bidder/bid \
11511142
-d '{
11521143
"txHash": "91a89B633194c0D86C539A1A5B14DCCacfD47094",

concepts/bids.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The bid payload sent to the internal mev-commit API is as follows:
44

5-
```bash
5+
```text
66
# Example Bid Structure:
77
# txn_hash: arbitrary string value representing txn hash
88
# bid_amt: amount to bid in wei

concepts/commitments.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Commitments represent promises made by providers in a cryptographically verifiable manner.
22

3-
```bash
3+
```text
44
# commitmentDigest: Represents the hash of the bid structure, including the bid signature
55
# commitmentSignature: Represents an ECDSA signature of the [commitmentDigest]
66
{

0 commit comments

Comments
 (0)