ethereum / web3.py

A python interface for interacting with the Ethereum blockchain and ecosystem.
http://web3py.readthedocs.io
MIT License
4.95k stars 1.69k forks source link

Forced to use Infura when using ethpm module #1649

Closed arjunaskykok closed 1 year ago

arjunaskykok commented 4 years ago
asn1crypto==0.24.0
asttokens==2.0.3
atomicwrites==1.3.0
attrdict==2.0.1
attrs==19.1.0
base58==2.0.0
bitarray==1.2.1
blake2b-py==0.1.3
cached-property==1.5.1
certifi==2019.6.16
cffi==1.12.3
chardet==3.0.4
cryptography==2.7
cytoolz==0.10.1
eth-abi==2.1.1
eth-account==0.5.2
eth-bloom==1.0.3
eth-hash==0.2.0
eth-keyfile==0.5.1
eth-keys==0.2.4
eth-rlp==0.1.2
eth-tester==0.4.0b1
eth-typing==2.1.0
eth-utils==1.8.4
hexbytes==0.2.0
idna==2.8
importlib-metadata==0.18
ipfshttpclient==0.4.12
jsonschema==3.2.0
lru-dict==1.1.6
more-itertools==7.1.0
multiaddr==0.0.9
mypy==0.770
mypy-extensions==0.4.3
netaddr==0.7.19
packaging==19.0
parsimonious==0.8.1
pluggy==0.12.0
protobuf==3.11.3
py==1.8.0
py-ecc==1.7.1
py-evm==0.3.0a14
pycparser==2.19
pycryptodome==3.8.2
pyethash==0.1.27
pyparsing==2.4.0
pyrsistent==0.16.0
PySide2==5.13.1
pytest==5.4.1
pytest-mock==3.1.0
requests==2.22.0
rlp==1.1.0
semantic-version==2.6.0
shiboken2==5.13.1
six==1.12.0
toolz==0.10.0
trie==1.4.0
typed-ast==1.4.1
typing-extensions==3.7.4.2
urllib3==1.25.3
varint==1.0.2
vyper==0.1.0b17
wcwidth==0.1.7
web3==5.9.0
websockets==8.1
zipp==0.5.1

What was wrong?

Using ethpm module, we are forced to use infura.

from web3 import Web3
from ethpm import Package

w3 = Web3(Web3.EthereumTesterProvider())
Package.from_uri("https://api.github.com/repos/ethereum/web3.py/git/blobs/a7232a93f1e9e75d606f6c1da18aa16037e03480", w3)

You got this error:

web3.exceptions.InfuraKeyNotFound: No Infura Project ID found. Please ensure that the environment variable WEB3_INFURA_PROJECT_ID is set.

How can it be fixed?

The culprit is in ethpm/backends/registry.py line 49-51:

    def __init__(self) -> None:
        from web3.auto.infura import w3
        self.w3 = w3
njgheorghita commented 4 years ago

Hey @arjunaskykok , thanks for raising this! We use infura a lot in ethpm to help resolve any ens names and make other calls to the blockchain - though I'd agree it's not ideal to be strictly tied to infura, that's the case right now.

I'm currently working on upgrading the ethpm library to support v3 (and I'd recommend that you also target the v3 spec in mamba - since it looks like the v3 spec will soon be finalized).

I'll look into relaxing this infura reliance as I upgrade ethpm, but in the meanwhile I'd recommend getting an infura key - they're free!

pacrob commented 1 year ago

@arjunaskykok - ethPM is being considered for removal with the next major web3.py version. Are you still using it, or have you found another solution?

arjunaskykok commented 1 year ago

@pacrob It's fine. I don't use it anymore.