0

I launched my geth with those parameters :

sudo geth --syncmode "light" --cache=2048 --datadir /mnt/ssd/ethereum --pprof.addr 0.0.0.0 --pprof

It's running on a ubuntu server 20 on a raspberry pi 4.

When I try this :

from web3 import Web3, HTTPProvider

w3 = Web3(HTTPProvider('http://192.168.1.29:8545'))
latest_block_num = w3.eth.blockNumber
tx_count = w3.eth.getBlockTransactionCount(latest_block_num)
print("lastest block {} with a tx_count of {}".format(latest_block_num, tx_count))

I get :

'requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.29', port=8545): Max retries exceeded'

are my launch parameters corrects? Firewall is disabled on the ubuntu.

Thanks

0

Try:

web3 = new Web3(new Web3.providers.WebsocketProvider('http://192.168.1.29:8545'));

you will need to use WebsocketProvider in order to subscribe to an event if you are using version web3.js@1.x

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.