Skip to content

Commit d0cc72e

Browse files
committed
module txpool
1 parent 42d0ad9 commit d0cc72e

File tree

2 files changed

+212
-0
lines changed

2 files changed

+212
-0
lines changed

docs/xdc/txpool/txpool.md

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# module txpool
2+
3+
## module txpool
4+
5+
### txpool_content
6+
7+
The `content` method lists the exact details of all the transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only.
8+
9+
The result is an object with two fields pending and queued. Each of these fields are associative arrays, in which each entry maps an origin-address to a batch of scheduled transactions. These batches themselves are maps associating nonces with actual transactions.
10+
11+
Please note, there may be multiple transactions associated with the same account and nonce. This can happen if the user broadcast multiple ones with varying gas allowances (or even completely different transactions).
12+
13+
Parameters:
14+
15+
None
16+
17+
Returns:
18+
19+
result: ojbect
20+
21+
Example:
22+
23+
Request:
24+
25+
```shell
26+
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
27+
"jsonrpc": "2.0",
28+
"id": 1001,
29+
"method": "txpool_content"
30+
}' | jq
31+
```
32+
33+
Response:
34+
35+
```json
36+
{
37+
"jsonrpc": "2.0",
38+
"id": 1001,
39+
"result": {
40+
"pending": {
41+
"xdc6a7B501F6Becea116623eF1C85304d0983a42FA0": {
42+
"257783": {
43+
"blockHash": null,
44+
"blockNumber": null,
45+
"from": "0x6a7b501f6becea116623ef1c85304d0983a42fa0",
46+
"gas": "0x7362",
47+
"gasPrice": "0x2e90edd00",
48+
"hash": "0x63cb7582191467f9ea0f91e56033185be96374625e28565b3e34cab4ba4f4739",
49+
"input": "0xafb91b2e000000000000000000000000d4b0e654a0b07d522b28fb1f20a8ba3c07617db30000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000277b22726f6c65223a2275736572222c2267616d654964223a322c226576656e744964223a34347d00000000000000000000000000000000000000000000000000",
50+
"nonce": "0x3eef7",
51+
"to": "0x30632a3c801031a5d6a1b3589966b60ee2fbc301",
52+
"transactionIndex": null,
53+
"value": "0x0",
54+
"type": "0x0",
55+
"v": "0x88",
56+
"r": "0x87b1fa4d4e23f61fb503f1cdf7791a0ccd76ae8fd8c9b5c8e74f3f9a62913f9a",
57+
"s": "0x45dfee63317820545d85e9001fdb8f1561bc63c44f7bf4d19726c4fb4d4259e5"
58+
}
59+
}
60+
},
61+
"queued": {}
62+
}
63+
}
64+
```
65+
66+
### txpool_contentFrom
67+
68+
The `contentFrom` method retrieves the transactions contained within the txpool, returning pending as well as queued transactions of this address, grouped by nonce.
69+
70+
Parameters:
71+
72+
- addr: addrress, required
73+
74+
Returns:
75+
76+
result: ojbect
77+
78+
Example:
79+
80+
Request:
81+
82+
```shell
83+
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
84+
"jsonrpc": "2.0",
85+
"id": 1001,
86+
"method": "txpool_contentFrom",
87+
"params": [
88+
"0xD4CE02705041F04135f1949Bc835c1Fe0885513c"
89+
]
90+
}' | jq
91+
```
92+
93+
Response:
94+
95+
```json
96+
{
97+
"jsonrpc": "2.0",
98+
"id": 1001,
99+
"result": {
100+
"pending": {},
101+
"queued": {}
102+
}
103+
}
104+
```
105+
106+
### txpool_inspect
107+
108+
The `inspect` lists a textual summary of all the transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only. This is a method specifically tailored to developers to quickly see the transactions in the pool and find any potential issues.
109+
110+
The result is an object with two fields pending and queued. Each of these fields are associative arrays, in which each entry maps an origin-address to a batch of scheduled transactions. These batches themselves are maps associating nonces with transactions summary strings.
111+
112+
Please note, there may be multiple transactions associated with the same account and nonce. This can happen if the user broadcast multiple ones with varying gas allowances (or even completely different transactions).
113+
114+
Parameters:
115+
116+
None
117+
118+
Returns:
119+
120+
result: ojbect
121+
122+
Example:
123+
124+
Request:
125+
126+
```shell
127+
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
128+
"jsonrpc": "2.0",
129+
"id": 1001,
130+
"method": "txpool_inspect"
131+
}' | jq
132+
```
133+
134+
Response:
135+
136+
```json
137+
{
138+
"jsonrpc": "2.0",
139+
"id": 1001,
140+
"result": {
141+
"pending": {},
142+
"queued": {}
143+
}
144+
}
145+
```
146+
147+
### txpool_status
148+
149+
The `status` method returns the number of pending and queued transaction in the pool.
150+
151+
The result is an object with two fields pending and queued, each of which is a counter representing the number of transactions in that particular state.
152+
153+
Parameters:
154+
155+
None
156+
157+
Returns:
158+
159+
result: ojbect
160+
161+
Example:
162+
163+
Request:
164+
165+
```shell
166+
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
167+
"jsonrpc": "2.0",
168+
"id": 1001,
169+
"method": "txpool_status"
170+
}' | jq
171+
```
172+
173+
Response:
174+
175+
```json
176+
{
177+
"jsonrpc": "2.0",
178+
"id": 1001,
179+
"result": {
180+
"pending": "0x3",
181+
"queued": "0x0"
182+
}
183+
}
184+
```
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"jsonrpc": "2.0",
3+
"id": 1001,
4+
"result": {
5+
"pending": {
6+
"xdc6a7B501F6Becea116623eF1C85304d0983a42FA0": {
7+
"257783": {
8+
"blockHash": null,
9+
"blockNumber": null,
10+
"from": "0x6a7b501f6becea116623ef1c85304d0983a42fa0",
11+
"gas": "0x7362",
12+
"gasPrice": "0x2e90edd00",
13+
"hash": "0x63cb7582191467f9ea0f91e56033185be96374625e28565b3e34cab4ba4f4739",
14+
"input": "0xafb91b2e000000000000000000000000d4b0e654a0b07d522b28fb1f20a8ba3c07617db30000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000277b22726f6c65223a2275736572222c2267616d654964223a322c226576656e744964223a34347d00000000000000000000000000000000000000000000000000",
15+
"nonce": "0x3eef7",
16+
"to": "0x30632a3c801031a5d6a1b3589966b60ee2fbc301",
17+
"transactionIndex": null,
18+
"value": "0x0",
19+
"type": "0x0",
20+
"v": "0x88",
21+
"r": "0x87b1fa4d4e23f61fb503f1cdf7791a0ccd76ae8fd8c9b5c8e74f3f9a62913f9a",
22+
"s": "0x45dfee63317820545d85e9001fdb8f1561bc63c44f7bf4d19726c4fb4d4259e5"
23+
}
24+
}
25+
},
26+
"queued": {}
27+
}
28+
}

0 commit comments

Comments
 (0)