2
2
3
3
.. include :: include_announcement.rst
4
4
5
- ==============
6
- web3.eth.admin
7
- ==============
5
+ =================
6
+ Web3 Admin Module
7
+ =================
8
8
9
9
10
10
The ``web3-eth-admin `` package allows you to interact with the Ethereum node's admin management.
@@ -19,12 +19,6 @@ The ``web3-eth-admin`` package allows you to interact with the Ethereum node's a
19
19
const admin = new Admin (Web3 .givenProvider || ' ws://some.local-or-remote.node:8546' , null , options);
20
20
21
21
22
- // or using the web3 umbrella package
23
- const web3 = new Web3 (Web3 .givenProvider || ' ws://some.local-or-remote.node:8546' , null , options);
24
-
25
- // -> web3.eth.admin
26
-
27
-
28
22
------------------------------------------------------------------------------
29
23
30
24
@@ -41,7 +35,7 @@ addPeer
41
35
42
36
.. code-block :: javascript
43
37
44
- web3 . eth . admin .addPeer (url, [callback])
38
+ admin .addPeer (url, [callback])
45
39
46
40
Add an admin peer on the node that Web3 is connected to with its provider.
47
41
The RPC method used is ``admin_addPeer ``.
@@ -65,7 +59,7 @@ Example
65
59
66
60
.. code-block :: javascript
67
61
68
- web3 . eth . admin .addPeer (" enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303" )
62
+ admin .addPeer (" enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303" )
69
63
.then (console .log );
70
64
> true
71
65
@@ -77,7 +71,7 @@ getDataDirectory
77
71
78
72
.. code-block :: javascript
79
73
80
- web3 . eth . admin .getDataDirectory ([, callback])
74
+ admin .getDataDirectory ([, callback])
81
75
82
76
Provides absolute path of the running node, which is used by the node to store all its databases.
83
77
@@ -104,7 +98,7 @@ Example
104
98
105
99
.. code-block :: javascript
106
100
107
- web3 . eth . admin .getDataDirectory ()
101
+ admin .getDataDirectory ()
108
102
.then (console .log );
109
103
> " /home/ubuntu/.ethereum"
110
104
@@ -117,7 +111,7 @@ getNodeInfo
117
111
118
112
.. code-block :: javascript
119
113
120
- web3 . eth . personal .getNodeInfo ([, callback])
114
+ admin .getNodeInfo ([, callback])
121
115
122
116
This property can be queried for all the information known about the running node at the networking granularity..
123
117
@@ -155,7 +149,7 @@ Example
155
149
156
150
.. code-block :: javascript
157
151
158
- web3 . eth . admin .getNodeInfo ().then (console .log );
152
+ admin .getNodeInfo ().then (console .log );
159
153
> {
160
154
enode: " enode://44826a5d6a55f88a18298bca4773fca5749cdc3a5c9f308aa7d810e9b31123f3e7c5fba0b1d70aac5308426f47df2a128a6747040a3815cc7dd7167d03be320d@[::]:30303" ,
161
155
id: " 44826a5d6a55f88a18298bca4773fca5749cdc3a5c9f308aa7d810e9b31123f3e7c5fba0b1d70aac5308426f47df2a128a6747040a3815cc7dd7167d03be320d" ,
@@ -184,7 +178,7 @@ getPeers
184
178
185
179
.. code-block :: javascript
186
180
187
- web3 . eth . admin .getPeers ([, callback])
181
+ admin .getPeers ([, callback])
188
182
189
183
This will provide all the information known about the connected remote nodes at the networking granularity.
190
184
@@ -220,7 +214,7 @@ Example
220
214
221
215
.. code-block :: javascript
222
216
223
- web3 . eth . admin .getPeers ().then (console .log );
217
+ admin .getPeers ().then (console .log );
224
218
> [{
225
219
caps: [" eth/61" , " eth/62" , " eth/63" ],
226
220
id: " 08a6b39263470c78d3e4f58e3c997cd2e7af623afce64656cfc56480babcea7a9138f3d09d7b9879344c2d2e457679e3655d4b56eaff5fd4fd7f147bdb045124" ,
@@ -261,7 +255,7 @@ setSolc
261
255
262
256
.. code-block :: javascript
263
257
264
- web3 . eth . admin .setSolc (string, [, callback])
258
+ admin .setSolc (string, [, callback])
265
259
266
260
Sets the Solidity compiler path to be used by the node when invoking the eth_compileSolidity RPC method
267
261
@@ -289,7 +283,7 @@ Example
289
283
290
284
.. code-block :: javascript
291
285
292
- web3 . eth . admin .setSolc (" /usr/bin/solc" ).then (console .log );
286
+ admin .setSolc (" /usr/bin/solc" ).then (console .log );
293
287
> " solc, the solidity compiler commandline interface\n Version: 0.3.2-0/Release-Linux/g++/Interpreter\n\n path: /usr/bin/solc"
294
288
295
289
------------------------------------------------------------------------------
@@ -300,7 +294,7 @@ startRPC
300
294
301
295
.. code-block :: javascript
302
296
303
- web3 . eth . admin .startRPC (host, port, cors, apis [, callback])
297
+ admin .startRPC (host, port, cors, apis [, callback])
304
298
305
299
It starts an HTTP based JSON RPC API webserver to handle client requests. All the parameters are optional.
306
300
@@ -328,7 +322,7 @@ Example
328
322
329
323
.. code-block :: javascript
330
324
331
- web3 . eth . admin .startRPC (" 127.0.0.1" , 8545 )
325
+ admin .startRPC (" 127.0.0.1" , 8545 )
332
326
.then (console .log (' RPC Started!' ));
333
327
> " RPC Started!"
334
328
@@ -340,7 +334,7 @@ startWS
340
334
341
335
.. code-block :: javascript
342
336
343
- web3 . eth . admin .startWS (host, port, cors, apis [, callback])
337
+ admin .startWS (host, port, cors, apis [, callback])
344
338
345
339
It starts an WebSocket based JSON RPC API webserver to handle client requests. All the parameters are optional.
346
340
@@ -368,7 +362,7 @@ Example
368
362
369
363
.. code-block :: javascript
370
364
371
- web3 . eth . admin .startRPC (" 127.0.0.1" , 8546 )
365
+ admin .startRPC (" 127.0.0.1" , 8546 )
372
366
.then (console .log (' WS Started!' ));
373
367
> " WS Started!"
374
368
@@ -379,7 +373,7 @@ stopRPC
379
373
380
374
.. code-block :: javascript
381
375
382
- web3 . eth . admin .stopRPC ([, callback])
376
+ admin .stopRPC ([, callback])
383
377
384
378
This method closes the currently open HTTP RPC endpoint. As the node can only have a single HTTP endpoint running, this method takes no parameters, returning a boolean whether the endpoint was closed or not.
385
379
@@ -403,7 +397,7 @@ Example
403
397
404
398
.. code-block :: javascript
405
399
406
- web3 . eth . admin .stopRPC ().then (console .log );
400
+ admin .stopRPC ().then (console .log );
407
401
> true
408
402
409
403
------------------------------------------------------------------------------
@@ -413,7 +407,7 @@ stopWS
413
407
414
408
.. code-block :: javascript
415
409
416
- web3 . eth . admin .stopWS ([, callback])
410
+ admin .stopWS ([, callback])
417
411
418
412
This method closes the currently open WebSocket RPC endpoint. As the node can only have a single WebSocket endpoint running, this method takes no parameters, returning a boolean whether the endpoint was closed or not.
419
413
@@ -437,7 +431,7 @@ Example
437
431
438
432
.. code-block :: javascript
439
433
440
- web3 . eth . admin .stopWS ().then (console .log );
434
+ admin .stopWS ().then (console .log );
441
435
> true
442
436
443
437
------------------------------------------------------------------------------
0 commit comments