Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the web3 rpc #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions tool/blockchain.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from __future__ import print_function
from web3 import Web3, KeepAliveRPCProvider, IPCProvider
from web3 import Web3, HTTPProvider, IPCProvider
import subprocess, signal
import time
import sys
import os
from values import MyGlobals





Expand All @@ -32,22 +32,22 @@ def start_private_chain(chain,etherbase,debug=False):



if Web3(KeepAliveRPCProvider(host='127.0.0.1', port=MyGlobals.port_number)).isConnected() :
if Web3(HTTPProvider(f"http://127.0.0.1:{MyGlobals.port_number}")).isConnected() :
print('\033[91m[-] Some blockchain is active, killing it... \033[0m', end='')
kill_active_blockchain()
if not( Web3(KeepAliveRPCProvider(host='127.0.0.1', port=MyGlobals.port_number)).isConnected() ):
if not( Web3(HTTPProvider(f"http://127.0.0.1:{MyGlobals.port_number}")).isConnected() ):
print('\033[92m Killed \033[0m')
else:
print('Cannot kill')

print('\033[1m[ ] Connecting to PRIVATE blockchain %s \033[0m' % chain, end='')
if debug:
pro = subprocess.Popen(['geth','--rpc','--rpccorsdomain','"*"','--rpcapi="db,eth,net,web3,personal,web3"', '--rpcport',MyGlobals.port_number, '--datadir','blockchains/'+chain,'--networkid','123','--mine','--minerthreads=1','--etherbase='+MyGlobals.etherbase_account])
else:
pro = subprocess.Popen(['geth','--rpc','--rpccorsdomain','"*"','--rpcapi="db,eth,net,web3,personal,web3"', '--rpcport',MyGlobals.port_number, '--datadir','blockchains/'+chain,'--networkid','123','--mine','--minerthreads=1','--etherbase='+MyGlobals.etherbase_account],stdout=devnull, stderr=devnull)

global web3
MyGlobals.web3 = Web3(KeepAliveRPCProvider(host='127.0.0.1', port=MyGlobals.port_number))
MyGlobals.web3 = Web3(HTTPProvider(f"http://127.0.0.1:{MyGlobals.port_number}"))
while( not MyGlobals.web3.isConnected() ):
print('',end='.')
if MyGlobals.exec_as_script:
Expand Down
2 changes: 1 addition & 1 deletion tool/contracts.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from __future__ import print_function
from web3 import Web3, KeepAliveRPCProvider, IPCProvider
from web3 import Web3, IPCProvider
import os.path
import json
import sched, time
Expand Down
2 changes: 1 addition & 1 deletion tool/maian.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
'''

from __future__ import print_function
from web3 import Web3, KeepAliveRPCProvider, IPCProvider
from web3 import Web3, IPCProvider
import argparse,subprocess,sys


Expand Down
2 changes: 1 addition & 1 deletion tool/values.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from web3 import Web3, KeepAliveRPCProvider, IPCProvider
from web3 import Web3, IPCProvider
import copy
from z3 import *

Expand Down