Add subscribe stub (with hardcoded url)
This commit is contained in:
parent
d85d96b325
commit
5fa3b91c05
21
cic_tools/eth/runnable/subscribe.py
Normal file
21
cic_tools/eth/runnable/subscribe.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
|
import websocket
|
||||||
|
|
||||||
|
ws = websocket.create_connection('ws://localhost:8545')
|
||||||
|
|
||||||
|
o = {
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"method": "eth_subscribe",
|
||||||
|
"params": [
|
||||||
|
"newHeads",
|
||||||
|
],
|
||||||
|
"id": 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
ws.send(json.dumps(o).encode('utf-8'))
|
||||||
|
|
||||||
|
while True:
|
||||||
|
print(ws.recv())
|
||||||
|
|
||||||
|
ws.close()
|
@ -12,3 +12,4 @@ pysha3==1.0.2
|
|||||||
hexathon==0.0.1a2
|
hexathon==0.0.1a2
|
||||||
eth-abi==2.1.1
|
eth-abi==2.1.1
|
||||||
eth-keys==0.3.3
|
eth-keys==0.3.3
|
||||||
|
websocket-client==0.57.0
|
||||||
|
Loading…
Reference in New Issue
Block a user