Skip to content

Commit 4a2706c

Browse files
natanasowsimzzzkonstantinabl
authored
feat: add txpool_* related RPC methods (#4544)
Signed-off-by: nikolay <[email protected]> Signed-off-by: Simeon Nakov <[email protected]> Signed-off-by: Konstantina Blazhukova <[email protected]> Co-authored-by: Simeon Nakov <[email protected]> Co-authored-by: konstantinabl <[email protected]>
1 parent db87e7f commit 4a2706c

File tree

18 files changed

+956
-24
lines changed

18 files changed

+956
-24
lines changed

.env.http.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ OPERATOR_KEY_MAIN= # Operator private key used to sign transaction
2020

2121
# ========== ETHEREUM API CONFIGURATION ==========
2222
# DEBUG_API_ENABLED=false # Enables debug methods like debug_traceTransaction
23+
# TXPOOL_API_ENABLED=true # Enables txpool related methods
2324
# FILTER_API_ENABLED=true # Enables filter related methods
2425
# ESTIMATE_GAS_THROWS=true # If true, throws actual error reason during contract reverts
2526

charts/hedera-json-rpc-relay/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ config:
2929

3030
# ========== ETHEREUM API CONFIGURATION ==========
3131
# DEBUG_API_ENABLED:
32+
# TXPOOL_API_ENABLED:
3233
# FILTER_API_ENABLED:
3334
# ESTIMATE_GAS_THROWS:
3435
# SUBSCRIPTIONS_ENABLED:

docs/configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ Unless you need to set a non-default value, it is recommended to only populate o
103103
| `TIER_3_RATE_LIMIT` | "1600" | Maximum relaxed request count limit used for static return endpoints. |
104104
| `PENDING_TRANSACTION_STORAGE_TTL` | "30" | Time-to-live (TTL) in seconds for transaction payloads stored in Redis. After this period, transaction data expires and is automatically cleaned up by Redis and the Lua-based orphan cleanup mechanism. |
105105
| `TX_DEFAULT_GAS` | "400000" | Default gas for transactions that do not specify gas. |
106+
| `TXPOOL_API_ENABLED` | "false" | Enables all txpool related methods. |
106107
| `USE_ASYNC_TX_PROCESSING` | "true" | Set to `true` to enable `eth_sendRawTransaction` to return the transaction hash immediately after passing all prechecks, while processing the transaction asynchronously in the background. |
107108
| `USE_MIRROR_NODE_MODULARIZED_SERVICES` | null | Controls routing of Mirror Node traffic through modularized services. When set to `true`, enables routing a percentage of traffic to modularized services. When set to `false`, ensures traffic follows the traditional non-modularized flow. When not set (i.e. `null` by default), no specific routing preference is applied. As Mirror Node gradually transitions to a fully modularized architecture across all networks, this setting will eventually default to `true`. |
108109

docs/openrpc.json

Lines changed: 285 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,112 @@
741741
}
742742
}
743743
},
744+
{
745+
"name": "txpool_content",
746+
"summary": "Returns all pending and queued transactions (queued are always an empty object {} due to Hedera specifics).",
747+
"description": "![](https://raw.githubusercontent.com/hiero-ledger/hiero-json-rpc-relay/main/docs/images/http_label.png)",
748+
"params": [],
749+
"result": {
750+
"name": "Txpool content",
751+
"schema": {
752+
"type": "object",
753+
"required": [
754+
"pending",
755+
"queued"
756+
],
757+
"properties": {
758+
"pending": {
759+
"type": "object",
760+
"patternProperties": {
761+
"^0x[a-fA-F0-9]{40}$": {
762+
"type": "object",
763+
"patternProperties": {
764+
"^[0-9]+$": {
765+
"$ref": "#/components/schemas/TxPoolTransaction"
766+
}
767+
},
768+
"additionalProperties": false
769+
}
770+
},
771+
"additionalProperties": false
772+
},
773+
"queued": {
774+
"type": "object",
775+
"patternProperties": {
776+
"^0x[a-fA-F0-9]{40}$": {
777+
"type": "object",
778+
"patternProperties": {
779+
"^[0-9]+$": {
780+
"$ref": "#/components/schemas/TxPoolTransaction"
781+
}
782+
},
783+
"additionalProperties": false
784+
}
785+
},
786+
"additionalProperties": false
787+
}
788+
},
789+
"additionalProperties": false
790+
}
791+
}
792+
},
793+
{
794+
"name": "txpool_contentFrom",
795+
"summary": "Returns pending and queued transactions (queued are always an empty object {} due to Hedera specifics) of this address, grouped by nonce.",
796+
"description": "![](https://raw.githubusercontent.com/hiero-ledger/hiero-json-rpc-relay/main/docs/images/http_label.png)",
797+
"params": [],
798+
"result": {
799+
"name": "Txpool contentFrom",
800+
"schema": {
801+
"type": "object",
802+
"required": [
803+
"pending",
804+
"queued"
805+
],
806+
"properties": {
807+
"pending": {
808+
"type": "object",
809+
"patternProperties": {
810+
"^[0-9]+$": {
811+
"$ref": "#/components/schemas/TxPoolTransaction"
812+
}
813+
},
814+
"additionalProperties": false
815+
},
816+
"queued": {
817+
"type": "object",
818+
"patternProperties": {
819+
"^[0-9]+$": {
820+
"$ref": "#/components/schemas/TxPoolTransaction"
821+
}
822+
},
823+
"additionalProperties": false
824+
}
825+
},
826+
"additionalProperties": false
827+
}
828+
}
829+
},
830+
{
831+
"name": "txpool_status",
832+
"summary": "Returns the number of transactions in pending and queued states (queued are always 0x0 due to Hedera specifics).",
833+
"description": "![](https://raw.githubusercontent.com/hiero-ledger/hiero-json-rpc-relay/main/docs/images/http_label.png)",
834+
"params": [],
835+
"result": {
836+
"name": "Txpool status",
837+
"schema": {
838+
"type": "object",
839+
"properties": {
840+
"pending": {
841+
"$ref": "#/components/schemas/uint"
842+
},
843+
"queued": {
844+
"$ref": "#/components/schemas/uint"
845+
}
846+
}
847+
}
848+
}
849+
},
744850
{
745851
"name": "eth_maxPriorityFeePerGas",
746852
"summary": "Returns a fee per gas that is an estimate of how much you can pay as a priority fee, or 'tip', to get a transaction included in the current block.",
@@ -1627,6 +1733,140 @@
16271733
}
16281734
]
16291735
},
1736+
"TxPoolTransaction": {
1737+
"type": "object",
1738+
"description": "A transaction currently in the pool.",
1739+
"required": [
1740+
"blockHash",
1741+
"blockNumber",
1742+
"transactionIndex",
1743+
"from",
1744+
"gas",
1745+
"hash",
1746+
"input",
1747+
"nonce",
1748+
"to",
1749+
"value",
1750+
"type",
1751+
"v",
1752+
"r",
1753+
"s"
1754+
],
1755+
"properties": {
1756+
"blockHash": {
1757+
"type": [
1758+
"string"
1759+
],
1760+
"pattern": "^0x([A-Fa-f0-9]{64})$",
1761+
"description": "Zero hex 32 bytes."
1762+
},
1763+
"blockNumber": {
1764+
"type": [
1765+
"null"
1766+
],
1767+
"description": "Null."
1768+
},
1769+
"transactionIndex": {
1770+
"type": [
1771+
"null"
1772+
],
1773+
"description": "Null."
1774+
},
1775+
"from": {
1776+
"type": "string",
1777+
"pattern": "^0x[a-fA-F0-9]{40}$",
1778+
"description": "Address of the sender."
1779+
},
1780+
"gas": {
1781+
"type": "string",
1782+
"pattern": "^0x[0-9a-fA-F]+$",
1783+
"description": "Gas provided by the sender."
1784+
},
1785+
"hash": {
1786+
"type": "string",
1787+
"pattern": "^0x[a-fA-F0-9]{64}$",
1788+
"description": "Transaction hash."
1789+
},
1790+
"input": {
1791+
"type": "string",
1792+
"pattern": "^0x([A-Fa-f0-9]*)$",
1793+
"description": "Input data."
1794+
},
1795+
"nonce": {
1796+
"type": "string",
1797+
"pattern": "^0x[0-9a-fA-F]+$",
1798+
"description": "Nonce of the transaction."
1799+
},
1800+
"to": {
1801+
"type": [
1802+
"string",
1803+
"null"
1804+
],
1805+
"pattern": "^0x[a-fA-F0-9]{40}$",
1806+
"description": "Recipient address (null for contract creation)."
1807+
},
1808+
"value": {
1809+
"type": "string",
1810+
"pattern": "^0x[0-9a-fA-F]+$",
1811+
"description": "Value transferred."
1812+
},
1813+
"type": {
1814+
"type": [
1815+
"string"
1816+
],
1817+
"pattern": "^0x[0-9a-fA-F]+$",
1818+
"description": "Transaction type (EIP-2718 typed transactions)."
1819+
},
1820+
"v": {
1821+
"type": "string",
1822+
"pattern": "^0x[0-9a-fA-F]+$",
1823+
"description": "Signature v component."
1824+
},
1825+
"r": {
1826+
"type": "string",
1827+
"pattern": "^0x[0-9a-fA-F]+$",
1828+
"description": "Signature r component."
1829+
},
1830+
"s": {
1831+
"type": "string",
1832+
"pattern": "^0x[0-9a-fA-F]+$",
1833+
"description": "Signature s component."
1834+
},
1835+
"chainId": {
1836+
"type": [
1837+
"string",
1838+
"null"
1839+
],
1840+
"pattern": "^0x[0-9a-fA-F]+$",
1841+
"description": "Chain ID for EIP-155 transactions."
1842+
},
1843+
"gasPrice": {
1844+
"type": [
1845+
"string",
1846+
"null"
1847+
],
1848+
"pattern": "^0x[0-9a-fA-F]+$",
1849+
"description": "Gas price."
1850+
},
1851+
"maxFeePerGas": {
1852+
"type": [
1853+
"string",
1854+
"null"
1855+
],
1856+
"pattern": "^0x[0-9a-fA-F]+$",
1857+
"description": "For EIP-1559 transactions: maximum fee per gas."
1858+
},
1859+
"maxPriorityFeePerGas": {
1860+
"type": [
1861+
"string",
1862+
"null"
1863+
],
1864+
"pattern": "^0x[0-9a-fA-F]+$",
1865+
"description": "For EIP-1559 transactions: max priority fee per gas."
1866+
}
1867+
},
1868+
"additionalProperties": false
1869+
},
16301870
"BlockNumberOrTagOrHash": {
16311871
"title": "Block number, tag, or block hash",
16321872
"oneOf": [
@@ -1720,14 +1960,19 @@
17201960
"BlockTracerType": {
17211961
"title": "Block tracer type",
17221962
"type": "string",
1723-
"enum": ["callTracer", "prestateTracer"]
1963+
"enum": [
1964+
"callTracer",
1965+
"prestateTracer"
1966+
]
17241967
},
17251968
"TransactionWithSender": {
17261969
"title": "Transaction object with sender",
17271970
"type": "object",
17281971
"allOf": [
17291972
{
1730-
"required": ["from"],
1973+
"required": [
1974+
"from"
1975+
],
17311976
"properties": {
17321977
"from": {
17331978
"title": "from",
@@ -1812,7 +2057,14 @@
18122057
"TransactionLegacyUnsigned": {
18132058
"type": "object",
18142059
"title": "Legacy transaction.",
1815-
"required": ["type", "nonce", "gas", "value", "input", "gasPrice"],
2060+
"required": [
2061+
"type",
2062+
"nonce",
2063+
"gas",
2064+
"value",
2065+
"input",
2066+
"gasPrice"
2067+
],
18162068
"properties": {
18172069
"type": {
18182070
"title": "type",
@@ -1868,7 +2120,12 @@
18682120
},
18692121
{
18702122
"title": "EIP-1559 transaction signature properties.",
1871-
"required": ["yParity", "r", "s", "v"],
2123+
"required": [
2124+
"yParity",
2125+
"r",
2126+
"s",
2127+
"v"
2128+
],
18722129
"properties": {
18732130
"yParity": {
18742131
"title": "yParity",
@@ -1925,7 +2182,11 @@
19252182
},
19262183
{
19272184
"title": "Legacy transaction signature properties.",
1928-
"required": ["v", "r", "s"],
2185+
"required": [
2186+
"v",
2187+
"r",
2188+
"s"
2189+
],
19292190
"properties": {
19302191
"v": {
19312192
"title": "v",
@@ -1966,7 +2227,13 @@
19662227
"allOf": [
19672228
{
19682229
"title": "Contextual information",
1969-
"required": ["blockHash", "blockNumber", "from", "hash", "transactionIndex"],
2230+
"required": [
2231+
"blockHash",
2232+
"blockNumber",
2233+
"from",
2234+
"hash",
2235+
"transactionIndex"
2236+
],
19702237
"properties": {
19712238
"blockHash": {
19722239
"title": "block hash",
@@ -1998,7 +2265,9 @@
19982265
"Log": {
19992266
"title": "log",
20002267
"type": "object",
2001-
"required": ["transactionHash"],
2268+
"required": [
2269+
"transactionHash"
2270+
],
20022271
"properties": {
20032272
"removed": {
20042273
"title": "removed",
@@ -2262,7 +2531,10 @@
22622531
"properties": {
22632532
"type": {
22642533
"type": "string",
2265-
"enum": ["CALL", "CREATE"],
2534+
"enum": [
2535+
"CALL",
2536+
"CREATE"
2537+
],
22662538
"description": "The type of action (CALL for function calls or CREATE for contract creation)."
22672539
},
22682540
"from": {
@@ -2309,7 +2581,11 @@
23092581
"description": "Sub-calls made during this call frame."
23102582
}
23112583
},
2312-
"required": ["from", "gas", "input"]
2584+
"required": [
2585+
"from",
2586+
"gas",
2587+
"input"
2588+
]
23132589
}
23142590
}
23152591
}

0 commit comments

Comments
 (0)