0

Using instructions from here I have a local private Ethereum blockchain running in a distributed envoirnment as per the diagram below:

|---------| Blockchain Node (192.168.122.111) |---------|

|---------| Processor Node (192.168.122.222) |---------|

Blockchain Node - geth terminal is running here.

Processor Node - does some calculations and write to the Blockchain Node where geth terminal is running. A web3.py script is running here which sends contract deployment request to the blockchain node.

These two nodes are in the same network, and can ping each other. Also I have tried file transfer with Python and its working perfectly.

My problem is: When I try to connected from the Processor Node to the Blockchain Node through this code unable to connect. Please help where I am making mistake?

w3 = Web3(http://192.168.122.111:30000)

account = Account()

acct = account.privateKeyToAccount(private_key_of_Processing_Node) // also tried with private key of Blockchain node EDIT

Error: Could not discover provider while making request: method:eth_chainId

Also I am using following command to connect to geth on the blockchain node

geth --port 3000 --networkid 58343 --datadir=./eth-blockchain --maxpeers=5 --rpc --rpcport 8543 --rpcaddr 192.168.122.111 --rpccorsdomain "*" --rpcapi "eth,net,web3,personal,miner" console 2>>eth.log

1
  • 1
    You have to connect to the RPC port, from the processor node w3 = Web3(Web3.HTTPProvider("http://192.168.122.111:8543")).
    – Ismael
    Commented Feb 16, 2021 at 15:36

1 Answer 1

1
w3 = Web3(new Web3.providers.HttpProvider('http://192.168.122.111:<rpc port>'))
w3.eth.accounts.privateKeyToAccount(privateKey)

"rpc port" you set in geth command lines params( --rpcport ) in blockchain node.

1
  • This command is giving me syntax error. Changed to w3 = Web3(HTTPProvider('http://192.168.122.111:3000')), but same error. I think am making some error in the geth call. Please check my edits
    – Tabz
    Commented Feb 16, 2021 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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