Admin API¶
-
class
web3.admin.Admin¶
The web3.admin object exposes methods to interact with the RPC APIs under the
admin_ namespace.
Properties¶
The following properties are available on the web3.admin namespace.
-
web3.admin.datadir¶ - Delegates to
admin_datadirRPC Method
Returns the system path of the node’s data directory.
>>> web3.admin.datadir '/Users/piper/Library/Ethereum'
- Delegates to
-
web3.admin.nodeInfo¶ - Delegates to
admin_nodeInfoRPC Method
Returns information about the currently running node.
>>> web3.admin.nodeInfo { 'enode': 'enode://e54eebad24dce1f6d246bea455ffa756d97801582420b9ed681a2ea84bf376d0bd87ae8dd6dc06cdb862a2ca89ecabe1be1050be35b4e70d62bc1a092cb7e2d3@[::]:30303', 'id': 'e54eebad24dce1f6d246bea455ffa756d97801582420b9ed681a2ea84bf376d0bd87ae8dd6dc06cdb862a2ca89ecabe1be1050be35b4e70d62bc1a092cb7e2d3', 'ip': '::', 'listenAddr': '[::]:30303', 'name': 'Geth/v1.4.11-stable-fed692f6/darwin/go1.7', 'ports': {'discovery': 30303, 'listener': 30303}, 'protocols': { 'eth': { 'difficulty': 57631175724744612603, 'genesis': '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3', 'head': '0xaaef6b9dd0d34088915f4c62b6c166379da2ad250a88f76955508f7cc81fb796', 'network': 1, }, }, }
- Delegates to
-
web3.admin.peers¶ - Delegates to
admin_peersRPC Method
Returns the current peers the node is connected to.
>>> web3.admin.peers [ { 'caps': ['eth/63'], 'id': '146e8e3e2460f1e18939a5da37c4a79f149c8b9837240d49c7d94c122f30064e07e4a42ae2c2992d0f8e7e6f68a30e7e9ad31d524349ec9d17effd2426a37b40', 'name': 'Geth/v1.4.10-stable/windows/go1.6.2', 'network': { 'localAddress': '10.0.3.115:64478', 'remoteAddress': '72.208.167.127:30303', }, 'protocols': { 'eth': { 'difficulty': 17179869184, 'head': '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3', 'version': 63, }, } }, { 'caps': ['eth/62', 'eth/63'], 'id': '76cb6cd3354be081923a90dfd4cda40aa78b307cc3cf4d5733dc32cc171d00f7c08356e9eb2ea47eab5aad7a15a3419b859139e3f762e1e1ebf5a04f530dcef7', 'name': 'Geth/v1.4.10-stable-5f55d95a/linux/go1.5.1', 'network': { 'localAddress': '10.0.3.115:64784', 'remoteAddress': '60.205.92.119:30303', }, 'protocols': { 'eth': { 'difficulty': 57631175724744612603, 'head': '0xaaef6b9dd0d34088915f4c62b6c166379da2ad250a88f76955508f7cc81fb796', 'version': 63, }, }, }, ... ]
- Delegates to
Methods¶
The following methods are available on the web3.admin namespace.
-
web3.admin.addPeer(node_url)¶ - Delegates to
admin_addPeerRPC Method
Requests adding a new remote node to the list of tracked static nodes.
>>> web3.admin.addPeer('enode://e54eebad24dce1f6d246bea455ffa756d97801582420b9ed681a2ea84bf376d0bd87ae8dd6dc06cdb862a2ca89ecabe1be1050be35b4e70d62bc1a092cb7e2d3@52.71.255.237:30303') True
- Delegates to
-
web3.admin.setSolc(solc_path)¶ - Delegates to
admin_setSolcRPC Method
Sets the system path to the
solcbinary for use with theeth_compileSolidityRPC method. Returns the output reported bysolc --version.>>> web3.admin.setSolc('/usr/local/bin/solc') "solc, the solidity compiler commandline interface\nVersion: 0.3.5-9da08ac3/Release-Darwin/appleclang/JIT"
- Delegates to
-
web3.admin.startRPC(host='localhost', port='8545', cors="", apis="eth, net, web3")¶ - Delegates to
admin_startRPCRPC Method
Starts the HTTP based JSON RPC API webserver on the specified
hostandport, with therpccorsdomainset to the providedcorsvalue and with the APIs specified byapisenabled. Returns boolean as to whether the server was successfully started.>>> web3.admin.startRPC() True
- Delegates to
-
web3.admin.startWS(host='localhost', port='8546', cors="", apis="eth, net, web3")¶ - Delegates to
admin_startWSRPC Method
Starts the Websocket based JSON RPC API webserver on the specified
hostandport, with therpccorsdomainset to the providedcorsvalue and with the APIs specified byapisenabled. Returns boolean as to whether the server was successfully started.>>> web3.admin.startWS() True
- Delegates to
-
web3.admin.stopRPC()¶ - Delegates to
admin_stopRPCRPC Method
Stops the HTTP based JSON RPC server.
>>> web3.admin.stopRPC() True
- Delegates to
-
web3.admin.stopWS()¶ - Delegates to
admin_stopWSRPC Method
Stops the Websocket based JSON RPC server.
>>> web3.admin.stopWS() True
- Delegates to