Skip to content

Commit 9546d1b

Browse files
committed
module miner
1 parent d6e2bc0 commit 9546d1b

File tree

1 file changed

+182
-0
lines changed

1 file changed

+182
-0
lines changed

docs/xdc/miner/miner.md

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
# module miner
2+
3+
## module miner
4+
5+
The `miner` API is now deprecated because mining was switched off at the transition to proof-of-stake. It existed to provide remote control the node's mining operation and set various mining specific settings. It is provided here for historical interest!
6+
7+
### miner_setEtherbase
8+
9+
The `getHashrate` method get hashrate in H/s (Hash operations per second).
10+
11+
Parameters:
12+
13+
- etherbase: address, required
14+
15+
Returns:
16+
17+
result: bool
18+
19+
Example:
20+
21+
```shell
22+
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
23+
"jsonrpc": "2.0",
24+
"id": 1001,
25+
"method": "miner_setEtherbase",
26+
"params": [
27+
"0xD4CE02705041F04135f1949Bc835c1Fe0885513c"
28+
]
29+
}' | jq
30+
```
31+
32+
Response:
33+
34+
```json
35+
{
36+
"jsonrpc": "2.0",
37+
"id": 1001,
38+
"result": true
39+
}
40+
```
41+
42+
43+
### miner_setExtra
44+
45+
The `setExtra` method sets the extra data a miner can include when miner blocks. This is capped at 32 bytes.
46+
47+
Parameters:
48+
49+
- extra: string, required
50+
51+
Returns:
52+
53+
result: bool
54+
55+
Example:
56+
57+
```shell
58+
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
59+
"jsonrpc": "2.0",
60+
"id": 1001,
61+
"method": "miner_setExtra",
62+
"params": [
63+
"string"
64+
]
65+
}' | jq
66+
```
67+
68+
Response:
69+
70+
```json
71+
{
72+
"jsonrpc": "2.0",
73+
"id": 1001,
74+
"result": true
75+
}
76+
```
77+
78+
79+
### miner_setGasPrice
80+
81+
The `setGasPrice` method sets the minimal accepted gas price when mining transactions. Any transactions that are below this limit are excluded from the mining process.
82+
83+
Parameters:
84+
85+
- gasPrice: big.Int, required
86+
87+
Returns:
88+
89+
result: bool
90+
91+
Example:
92+
93+
```shell
94+
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
95+
"jsonrpc": "2.0",
96+
"id": 1001,
97+
"method": "miner_setGasPrice",
98+
"params": [
99+
"0x1"
100+
]
101+
}' | jq
102+
```
103+
104+
Response:
105+
106+
```json
107+
{
108+
"jsonrpc": "2.0",
109+
"id": 1001,
110+
"result": true
111+
}
112+
```
113+
114+
115+
### miner_start
116+
117+
The `start` method start the miner with the given number of threads. If threads is nil the number of workers started is equal to the number of logical CPUs that are usable by this process. If mining is already running, this method adjust the number of threads allowed to use.
118+
119+
Parameters:
120+
121+
- threads: int, optional
122+
123+
Returns:
124+
125+
result: bool
126+
127+
Example:
128+
129+
```shell
130+
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
131+
"jsonrpc": "2.0",
132+
"id": 1001,
133+
"method": "miner_start",
134+
"params": [
135+
1
136+
]
137+
}' | jq
138+
```
139+
140+
Response:
141+
142+
```json
143+
{
144+
"jsonrpc": "2.0",
145+
"id": 1001,
146+
"result": true
147+
}
148+
```
149+
150+
151+
### miner_stop
152+
153+
The `stop` method stop the CPU mining operation.
154+
155+
Parameters:
156+
157+
None
158+
159+
Returns:
160+
161+
result: bool
162+
163+
Example:
164+
165+
```shell
166+
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
167+
"jsonrpc": "2.0",
168+
"id": 1001,
169+
"method": "miner_stop"
170+
}' | jq
171+
```
172+
173+
Response:
174+
175+
```json
176+
{
177+
"jsonrpc": "2.0",
178+
"id": 1001,
179+
"result": true
180+
}
181+
```
182+

0 commit comments

Comments
 (0)