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

Web3.py cannot connect to Westend Asset Hub #26

Closed
nhussein11 opened this issue Jan 22, 2025 · 3 comments · Fixed by paritytech/polkadot-sdk#7580
Closed

Web3.py cannot connect to Westend Asset Hub #26

nhussein11 opened this issue Jan 22, 2025 · 3 comments · Fixed by paritytech/polkadot-sdk#7580
Assignees
Labels
good first issue Good for newcomers

Comments

@nhussein11
Copy link

I am unable to connect to the Westend Asset Hub RPC endpoint using Web3.py. The connection check (web3.is_connected()) consistently returns False.

Steps to Reproduce:

  1. Set up a virtual environment and install Web3.py:
python -m venv venv
source venv/bin/activate
pip install web3
  1. Use the following Python script to connect to the RPC:
from web3 import Web3

web3 = Web3(Web3.HTTPProvider("https://westend-asset-hub-eth-rpc.polkadot.io"))

print("Connected to network", web3.is_connected())
  1. Execute the script with Python 3.9.
@pgherveou
Copy link

Thanks for the report,
We don't support web3_clientVersion rpc method should be an easy fix

@pgherveou
Copy link

For reference this just call

curl http://localhost:8545 -H 'Content-Type: application/json' -X POST  -d '{"jsonrpc": "2.0", "method": "web3_clientVersion", "params": [], "id": 0}'

On geth the response is

{
  "jsonrpc": "2.0",
  "id": 0,
  "result": "Geth/v1.15.0-stable-756cca7c/linux-amd64/go1.23.6"
}

@pgherveou pgherveou removed their assignment Feb 13, 2025
@pgherveou pgherveou added the good first issue Good for newcomers label Feb 13, 2025
@pgherveou
Copy link

pgherveou commented Feb 13, 2025

This can be easily added here
https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/revive/rpc/src/apis/health_api.rs?plain=1#L29-L31

Maybe use a technique similar to what we do in Revive here to pull the commit sha

https://github.com/paritytech/revive/blob/main/crates/solidity/build.rs?plain=1#L1-L7

@nprt nprt self-assigned this Feb 14, 2025
github-merge-queue bot pushed a commit to paritytech/polkadot-sdk that referenced this issue Feb 17, 2025
Implements the `web3_clientVersion` method. This is a common requirement
for external Ethereum libraries when querying a client.

Fixes paritytech/contract-issues#26.

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants