From 4d201fbb073c1ee5cbd47dca078d7ddff2453f6e Mon Sep 17 00:00:00 2001 From: irrun Date: Fri, 22 Nov 2024 17:07:24 +0800 Subject: [PATCH 1/8] feat: bundle data API --- BEPs/BEP322.md | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/BEPs/BEP322.md b/BEPs/BEP322.md index 0f60d0d4..1ef8282c 100644 --- a/BEPs/BEP322.md +++ b/BEPs/BEP322.md @@ -288,6 +288,57 @@ Response: } ``` +##### 4.4.1.3 Query Bundle Data + +This API is used by mev data analysts to query the bundle information from the builder. For example, In order to be able +to directly reflect the mev market size, the mev data provider launches a bundle panel needs to show the number of +bundles per day or per block. + +Request: + +```json +{ + "jsonrpc": "2.0", + "method": "mev_bundles", + "params": [ + { + "fromBlock": "0x1", + "toBlock": "0x2" + } + ], + "id": 1 +} +``` +* The diff between fromBlock and toBlock should be less than 100. + +Response: + +```json +{ + "jsonrpc": "2.0", + "result": [ + { + "blockNumber": "0x1", + "bundleCount": "0x2", + "bundles": [ + {"txHashes": ["0x88...44b", "0x89..45b", "0x90...46b"]}, + {"txHashes": ["0x23...24b", "0x39..45b"]} + ] + }, + { + "blockNumber": "0x2", + "bundleCount": "0x3", + "bundles": [ + {"txHashes": ["0x88...44b", "0x89..45b", "0x90...46b"]}, + {"txHashes": ["0x23...24b", "0x39..45b"]}, + {"txHashes": ["0x27...f4b", "0x94..4cb"]} + ] + } + ], + "id": 1 +} +``` + #### 4.4.2 Validator APIs The following APIs should be implemented on the validator side or BSC clients. From c94280f515aa7f30d84401d5e53a6b6d25082470 Mon Sep 17 00:00:00 2001 From: irrun Date: Tue, 26 Nov 2024 15:49:25 +0800 Subject: [PATCH 2/8] fit: comments --- BEPs/BEP322.md | 78 +++++++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 36 deletions(-) diff --git a/BEPs/BEP322.md b/BEPs/BEP322.md index 1ef8282c..e9c0b04e 100644 --- a/BEPs/BEP322.md +++ b/BEPs/BEP322.md @@ -11,26 +11,26 @@ - [BEP-322: Builder API Specification for BNB Smart Chain](#bep-322-builder-api-specification-for-bnb-smart-chain) - - [1. Summary](#1-summary) - - [2. Motivation](#2-motivation) - - [3. Background](#3-background) - - [3.1 BSC Trust Model](#31-bsc-trust-model) - - [3.2 BSC Consensus](#32-bsc-consensus) - - [4 Workflow](#4-workflow) - - [4.1 Definition](#41-definition) - - [4.2 One-Round Interaction (default)](#42-one-round-interaction-default) - - [4.3 Two-Round Interaction (optional)](#43-two-round-interaction-optional) - - [4.4 APIs](#44-apis) - - [4.4.1 Builder APIs](#441-builder-apis) - - [4.4.1.1 Retrieve Transactions](#4411-retrieve-transactions) - - [4.4.1.2 Issues Report](#4412-issues-report) - - [4.4.2 Validator APIs](#442-validator-apis) - - [4.4.2.1 Bid Block](#4421-bid-block) - - [5. Further Discussion](#5-further-discussion) - - [5.1 Implementation Consideration](#51-implementation-consideration) - - [5.2 Payment \& Economic Considerations](#52-payment--economic-considerations) - - [5.3 Builder Registration](#53-builder-registration) - - [6. License](#6-license) + - [1. Summary](#1-summary) + - [2. Motivation](#2-motivation) + - [3. Background](#3-background) + - [3.1 BSC Trust Model](#31-bsc-trust-model) + - [3.2 BSC Consensus](#32-bsc-consensus) + - [4 Workflow](#4-workflow) + - [4.1 Definition](#41-definition) + - [4.2 One-Round Interaction (default)](#42-one-round-interaction-default) + - [4.3 Two-Round Interaction (optional)](#43-two-round-interaction-optional) + - [4.4 APIs](#44-apis) + - [4.4.1 Builder APIs](#441-builder-apis) + - [4.4.1.1 Retrieve Transactions](#4411-retrieve-transactions) + - [4.4.1.2 Issues Report](#4412-issues-report) + - [4.4.2 Validator APIs](#442-validator-apis) + - [4.4.2.1 Bid Block](#4421-bid-block) + - [5. Further Discussion](#5-further-discussion) + - [5.1 Implementation Consideration](#51-implementation-consideration) + - [5.2 Payment \& Economic Considerations](#52-payment--economic-considerations) + - [5.3 Builder Registration](#53-builder-registration) + - [6. License](#6-license) @@ -290,8 +290,8 @@ Response: ##### 4.4.1.3 Query Bundle Data -This API is used by mev data analysts to query the bundle information from the builder. For example, In order to be able -to directly reflect the mev market size, the mev data provider launches a bundle panel needs to show the number of +This API is used by mev data analysts to query the bundle information from the builder. For example, In order to be able +to directly reflect the mev market size, the mev data provider launches a bundle panel needs to show the number of bundles per day or per block. Request: @@ -303,13 +303,18 @@ Request: "params": [ { "fromBlock": "0x1", - "toBlock": "0x2" + "toBlock": "0x3" } ], "id": 1 } ``` -* The diff between fromBlock and toBlock should be less than 100. + +Params: + +- `fromBlock`: Either the hex value of a block number OR block tags: "latest", "pending" or nil. Defaults to "latest". +- `toBlock`: Either the hex value of a block number OR block tags: "latest", "pending" or nil. Defaults to "latest". It + should be no less than `fromBlock` and less than `fromBlock+100`. Response: @@ -318,20 +323,20 @@ Response: "jsonrpc": "2.0", "result": [ { - "blockNumber": "0x1", - "bundleCount": "0x2", - "bundles": [ - {"txHashes": ["0x88...44b", "0x89..45b", "0x90...46b"]}, - {"txHashes": ["0x23...24b", "0x39..45b"]} + "fromBlock": "0x1", + "toBlock": "0x2", + "bundleTxHashes": [ + "0x88...44b", + "0x89..45b", + "0x90...46b" ] }, { - "blockNumber": "0x2", - "bundleCount": "0x3", - "bundles": [ - {"txHashes": ["0x88...44b", "0x89..45b", "0x90...46b"]}, - {"txHashes": ["0x23...24b", "0x39..45b"]}, - {"txHashes": ["0x27...f4b", "0x94..4cb"]} + "fromBlock": "0x2", + "toBlock": "0x3", + "bundleTxHashes": [ + "0x23...24b", + "0x39..45b" ] } ], @@ -385,6 +390,7 @@ Response: ``` or some error: + ```json { "jsonrpc": "2.0", @@ -452,7 +458,7 @@ In BSC, one smart contract can be implemented to provide the following functiona - a builder can register to validators by providing its information (e.g., builder address). With this kind of smart contract, builders and validators can discover each other easily. It also provides transparency -for all related stakeholders. +for all related stakeholders. ## 6. License From 2d9bdcda9b0b5d7d3693ca826603f2f0f6c432b3 Mon Sep 17 00:00:00 2001 From: irrun Date: Tue, 26 Nov 2024 15:51:09 +0800 Subject: [PATCH 3/8] fit: comments --- BEPs/BEP322.md | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/BEPs/BEP322.md b/BEPs/BEP322.md index e9c0b04e..401a00fd 100644 --- a/BEPs/BEP322.md +++ b/BEPs/BEP322.md @@ -11,26 +11,26 @@ - [BEP-322: Builder API Specification for BNB Smart Chain](#bep-322-builder-api-specification-for-bnb-smart-chain) - - [1. Summary](#1-summary) - - [2. Motivation](#2-motivation) - - [3. Background](#3-background) - - [3.1 BSC Trust Model](#31-bsc-trust-model) - - [3.2 BSC Consensus](#32-bsc-consensus) - - [4 Workflow](#4-workflow) - - [4.1 Definition](#41-definition) - - [4.2 One-Round Interaction (default)](#42-one-round-interaction-default) - - [4.3 Two-Round Interaction (optional)](#43-two-round-interaction-optional) - - [4.4 APIs](#44-apis) - - [4.4.1 Builder APIs](#441-builder-apis) - - [4.4.1.1 Retrieve Transactions](#4411-retrieve-transactions) - - [4.4.1.2 Issues Report](#4412-issues-report) - - [4.4.2 Validator APIs](#442-validator-apis) - - [4.4.2.1 Bid Block](#4421-bid-block) - - [5. Further Discussion](#5-further-discussion) - - [5.1 Implementation Consideration](#51-implementation-consideration) - - [5.2 Payment \& Economic Considerations](#52-payment--economic-considerations) - - [5.3 Builder Registration](#53-builder-registration) - - [6. License](#6-license) + - [1. Summary](#1-summary) + - [2. Motivation](#2-motivation) + - [3. Background](#3-background) + - [3.1 BSC Trust Model](#31-bsc-trust-model) + - [3.2 BSC Consensus](#32-bsc-consensus) + - [4 Workflow](#4-workflow) + - [4.1 Definition](#41-definition) + - [4.2 One-Round Interaction (default)](#42-one-round-interaction-default) + - [4.3 Two-Round Interaction (optional)](#43-two-round-interaction-optional) + - [4.4 APIs](#44-apis) + - [4.4.1 Builder APIs](#441-builder-apis) + - [4.4.1.1 Retrieve Transactions](#4411-retrieve-transactions) + - [4.4.1.2 Issues Report](#4412-issues-report) + - [4.4.2 Validator APIs](#442-validator-apis) + - [4.4.2.1 Bid Block](#4421-bid-block) + - [5. Further Discussion](#5-further-discussion) + - [5.1 Implementation Consideration](#51-implementation-consideration) + - [5.2 Payment \& Economic Considerations](#52-payment--economic-considerations) + - [5.3 Builder Registration](#53-builder-registration) + - [6. License](#6-license) @@ -390,7 +390,6 @@ Response: ``` or some error: - ```json { "jsonrpc": "2.0", @@ -458,7 +457,7 @@ In BSC, one smart contract can be implemented to provide the following functiona - a builder can register to validators by providing its information (e.g., builder address). With this kind of smart contract, builders and validators can discover each other easily. It also provides transparency -for all related stakeholders. +for all related stakeholders. ## 6. License From 2b8409a3a8185570a955cd3338a8c84c1262cb11 Mon Sep 17 00:00:00 2001 From: irrun Date: Fri, 6 Dec 2024 09:26:44 +0800 Subject: [PATCH 4/8] fix: comment --- BEPs/BEP322.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BEPs/BEP322.md b/BEPs/BEP322.md index 401a00fd..6cb3a8d0 100644 --- a/BEPs/BEP322.md +++ b/BEPs/BEP322.md @@ -318,6 +318,8 @@ Params: Response: +* Return only bundles whose first-received-height is within the block range, regardless of the bundle end time. + ```json { "jsonrpc": "2.0", From a0c1b821e049088b26dd741d1c23329b2c65e318 Mon Sep 17 00:00:00 2001 From: irrun Date: Fri, 6 Dec 2024 09:28:45 +0800 Subject: [PATCH 5/8] fix: comment --- BEPs/BEP322.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BEPs/BEP322.md b/BEPs/BEP322.md index 6cb3a8d0..4e93c59b 100644 --- a/BEPs/BEP322.md +++ b/BEPs/BEP322.md @@ -318,7 +318,7 @@ Params: Response: -* Return only bundles whose first-received-height is within the block range, regardless of the bundle end time. +* Return only bundles whose first-received-height(`fromBlock`) is within the block range, regardless of the bundle's `endBlock`. ```json { From 7f776aa7fce242caa8665e3ba42fdca47def5642 Mon Sep 17 00:00:00 2001 From: unclezoro <296179868@qq.com> Date: Mon, 9 Dec 2024 09:28:44 +0800 Subject: [PATCH 6/8] update the BEP --- BEPs/BEP322.md | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/BEPs/BEP322.md b/BEPs/BEP322.md index 4e93c59b..5bbb3c59 100644 --- a/BEPs/BEP322.md +++ b/BEPs/BEP322.md @@ -290,9 +290,10 @@ Response: ##### 4.4.1.3 Query Bundle Data -This API is used by mev data analysts to query the bundle information from the builder. For example, In order to be able -to directly reflect the mev market size, the mev data provider launches a bundle panel needs to show the number of -bundles per day or per block. +This API enables MEV data analysts to query bundle information from builders. +It is particularly useful for MEV data providers who need to analyze market trends and create analytics dashboards. +For instance, to accurately measure MEV market activity, providers can use this API to display metrics such as +daily bundle counts and bundles per block in their analytics panels. Request: @@ -312,33 +313,33 @@ Request: Params: -- `fromBlock`: Either the hex value of a block number OR block tags: "latest", "pending" or nil. Defaults to "latest". +- `fromBlock`: It is hex value of a block number. - `toBlock`: Either the hex value of a block number OR block tags: "latest", "pending" or nil. Defaults to "latest". It should be no less than `fromBlock` and less than `fromBlock+100`. Response: -* Return only bundles whose first-received-height(`fromBlock`) is within the block range, regardless of the bundle's `endBlock`. +* Return bundles whose first-received-height(`fromBlock`) is within the block range. ```json { "jsonrpc": "2.0", "result": [ { - "fromBlock": "0x1", - "toBlock": "0x2", - "bundleTxHashes": [ - "0x88...44b", - "0x89..45b", - "0x90...46b" + "receivedAt": "0x1", + "bundles": [ + ["0x88...44b", // tx hash + "0x89..45b"], + ["0x90...46b"] ] }, { - "fromBlock": "0x2", - "toBlock": "0x3", - "bundleTxHashes": [ - "0x23...24b", - "0x39..45b" + "receivedAt": "0x2", + "bundles": [ + ["0x23...24b", + "0x39..45b"], + ["0x43...55a", + "0x45..33a"] // it is possible that a same tx hash exist in different block ] } ], From d83a4786894391df50735f3194a5db9b5b70fa1e Mon Sep 17 00:00:00 2001 From: irrun Date: Mon, 9 Dec 2024 11:36:30 +0800 Subject: [PATCH 7/8] chore: tidy --- BEPs/BEP322.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/BEPs/BEP322.md b/BEPs/BEP322.md index 5bbb3c59..df7ec7ad 100644 --- a/BEPs/BEP322.md +++ b/BEPs/BEP322.md @@ -319,27 +319,24 @@ Params: Response: -* Return bundles whose first-received-height(`fromBlock`) is within the block range. +* Return bundles whose first-received-height(`receivedBlock`) is within the block range [`fromBlock`, `toBlock`]. ```json { "jsonrpc": "2.0", "result": [ { - "receivedAt": "0x1", + "receivedBlock": "0x1", "bundles": [ - ["0x88...44b", // tx hash - "0x89..45b"], + ["0x88...44b", "0x89..45b"], // tx hase list in the bundle ["0x90...46b"] ] }, { - "receivedAt": "0x2", + "receivedBlock": "0x2", "bundles": [ - ["0x23...24b", - "0x39..45b"], - ["0x43...55a", - "0x45..33a"] // it is possible that a same tx hash exist in different block + ["0x23...24b", "0x39..45b"], + ["0x43...55a", "0x45..33a", "0x39..45b"] // it is possible that a same tx hash exists in different block ] } ], From 2b435419d9da5b9785b70f43f1fa9a2654881fb0 Mon Sep 17 00:00:00 2001 From: irrun Date: Tue, 17 Dec 2024 18:53:36 +0800 Subject: [PATCH 8/8] chore: update method name --- BEPs/BEP322.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/BEPs/BEP322.md b/BEPs/BEP322.md index df7ec7ad..66ec1593 100644 --- a/BEPs/BEP322.md +++ b/BEPs/BEP322.md @@ -300,12 +300,10 @@ Request: ```json { "jsonrpc": "2.0", - "method": "mev_bundles", + "method": "eth_bundles", "params": [ - { - "fromBlock": "0x1", - "toBlock": "0x3" - } + "0x1", + "0x3" ], "id": 1 } @@ -313,13 +311,13 @@ Request: Params: -- `fromBlock`: It is hex value of a block number. -- `toBlock`: Either the hex value of a block number OR block tags: "latest", "pending" or nil. Defaults to "latest". It - should be no less than `fromBlock` and less than `fromBlock+100`. +1. String - `FromBlock`, It is the hex value of a block number. +2. String - `ToBlock`, It is either the hex value of a block number OR block tags: "latest", "pending". It should be +no less than `FromBlock` and less than `FromBlock+100`. Response: -* Return bundles whose first-received-height(`receivedBlock`) is within the block range [`fromBlock`, `toBlock`]. +* Return bundles whose first-received-height(`receivedBlock`) is within the block range [`FromBlock`, `ToBlock`]. ```json {