Closed ebrahimkarimi closed 3 years ago
hey @ebrahimkarimi, thanks for reaching out. This has been addressed in PR #2065. This has been merged and will be out in a release early next week. In the meantime you can install web3py from the latest master
branch with pip install https://github.com/ethereum/web3.py/archive/master.zip
if that helps you get past this hump for now.
Keep in mind if you do install from the current master
branch, you will need to pass in a type
with value '0x2'
explicitly in the transaction params to sign_transaction
, indicating that you would like to sign using EIP-1559 transaction type.
I'm going to close this since this has already been addressed but thanks for the heads up!
@ebrahimkarimi I updated my comment above with an easier way of installing from master
. Hope this helps.
@ebrahimkarimi just letting you know that web3.py version 5.22.0
was released this morning with support for signing transactions with EIP-1559 transaction params
Hi @fselmo, I'm testing EIP-1559 transaction using version 5.22.0. But after signing the transaction, when I send it using send_transaction, I get the following error:
ValueError: {'code': -32000, 'message': 'invalid sender'}
However, if I try to sign and send as legacy transaction (by adding gasPrice
and removing maxFeePerGas
& maxPriorityFeePerGas
), I don't get this error and the transaction is sent successfully. I'm using Ropsten infura node.
Any idea what could be the reason ?
@maannajjar if you are manually signing a transaction using your private key you will need to send it via send_raw_transaction()
, not send_transaction()
.
Please try to use send_raw_transaction()
as in the example in the link above and update here if the problem still persists.
@fselmo my bad, I meant to say I'm using send_raw_transaction
with my private key. I'm not using send_transaction
. It works with signed legacy transaction. But when I do just that one change: replace gasPrice
with maxFeePerGas
& maxPriorityFeePerGas
in sign_transaction
(I'm adding type: 2 also). I get that error when calling send_raw_transaction
.
@maannajjar hmm out of curiosity are you providing the chainId
when signing as well?
edit: I just gave it a shot without the chainId
and got the same message. I'm going to make sure this gets updated in the docs to make it more clear. Please test it out with the appropriate chainId
and let us know if that solves your issue.
@maannajjar hmm out of curiosity are you providing the
chainId
when signing as well?edit: I just gave it a shot without the
chainId
and got the same message. I'm going to make sure this gets updated in the docs to make it more clear. Please test it out with the appropriatechainId
and let us know if that solves your issue.
Actually missing chainId
was my problem as well, it wasn't documented
@fselmo you were right, I had the chainId missing. I just added it and it worked. Thanks for the help!
pip freeze
output aiohttp==3.7.4.post0 amqp==5.0.5 appdirs==1.4.3 apt-xapian-index==0.49 apturl==0.5.2 asgiref==3.3.0 asn1crypto==0.24.0 astroid==2.5.1 async-timeout==3.0.1 attrs==19.3.0 base58==2.1.0 bcrypt==3.1.7 billiard==3.6.3.0 bitarray==1.2.2 blinker==1.4 Brlapi==0.7.0 cached-property==1.5.1 catfish==1.4.13 celery==5.0.5 certifi==2019.11.28 chardet==3.0.4 chrome-gnome-shell==0.0.0 Click==7.0 click-didyoumean==0.0.3 click-plugins==1.1.1 click-repl==0.1.6 colorama==0.4.3 command-not-found==0.3 cryptography==2.8 cupshelpers==1.0 cytoolz==0.11.0 dbus-python==1.2.16 decorator==4.4.2 defer==1.0.6 distlib==0.3.0 distro==1.4.0 distro-info===0.23ubuntu1 dj-database-url==0.5.0 Django==3.1.3 django-appconf==1.0.4 django-heroku==0.3.1 django-jalali==4.3.0 django-statici18n==2.0.1 django-timezone-field==4.1.2 djangorestframework==3.12.2 dnspython==1.16.0 docker==4.1.0 docker-compose==1.25.0 dockerpty==0.4.1 docopt==0.6.2 duplicity==0.8.12.0 ecdsa==0.17.0 entrypoints==0.3 eth-abi==2.1.1 eth-account==0.5.4 eth-hash==0.3.1 eth-keyfile==0.5.1 eth-keys==0.3.3 eth-rlp==0.2.1 eth-typing==2.2.2 eth-utils==1.10.0 fasteners==0.14.1 filelock==3.0.12 future==0.18.2 germinate==2.32 gpg===1.13.1-unknown gunicorn==20.0.4 hdwallet==1.3.1 hexbytes==0.2.1 httplib2==0.14.0 idna==2.8 importlib-metadata==1.5.0 ipfshttpclient==0.7.0 isort==5.8.0 itsdangerous==1.1.0 jdatetime==3.6.2 Jinja2==2.11.2 jsonschema==3.2.0 keyring==18.0.1 keyrings.alt==3.4.0 kombu==5.0.2 language-selector==0.1 launchpadlib==1.10.13 lazr.restfulclient==0.14.2 lazr.uri==1.0.3 lazy-object-proxy==1.6.0 lockfile==0.12.2 louis==3.12.0 lru-dict==1.1.7 macaroonbakery==1.3.1 Mako==1.1.0 Markdown==3.1.1 MarkupSafe==1.1.0 mccabe==0.6.1 menulibre==2.2.1 mnemonic==0.19 monotonic==1.5 more-itertools==4.2.0 multiaddr==0.0.9 multidict==5.1.0 netaddr==0.8.0 netifaces==0.10.4 nftables==0.1 notify2==0.3 oauth==1.0.1 oauthlib==3.1.0 olefile==0.46 onboard==1.4.1 packaging==20.3 paramiko==2.6.0 parsimonious==0.8.1 pexpect==4.6.0 pika-stubs==0.1.3 Pillow==8.1.1 prompt-toolkit==3.0.16 protobuf==3.6.1 psutil==5.5.1 psycopg2==2.8.6 psycopg2-binary==2.8.6 pycairo==1.16.2 pycrypto==2.6.1 pycryptodome==3.10.1 pycups==1.9.73 Pygments==2.3.1 PyGObject==3.36.0 PyJWT==1.7.1 pylint==2.7.2 pymacaroons==0.13.0 PyNaCl==1.3.0 pyOpenSSL==19.0.0 pyparsing==2.4.6 pyparted==3.11.2 PyQt5==5.14.1 pyRFC3339==1.1 pyrsistent==0.15.5 pysha3==1.0.2 python-apt==2.0.0+ubuntu0.20.4.5 python-dateutil==2.7.3 python-debian===0.1.36ubuntu1 Python-dev==2.0.0.dev0 python-distutils-extra==2.39 python-kucoin==2.1.2 python-xapp==1.8.1 python3-utils==0.4.0 pytz==2019.3 pyudev==0.21.0 pyxattr==0.6.1 pyxdg==0.26 PyYAML==5.3.1 reportlab==3.5.34 requests==2.22.0 requests-unixsocket==0.2.0 rlp==2.0.1 screen-resolution-extra==0.0.0 SecretStorage==2.3.1 selinux==3.0 setproctitle==1.1.10 simplejson==3.16.0 sip==4.19.21 six==1.14.0 slip==0.6.5 slip.dbus==0.6.5 sqlparse==0.4.1 ssh-import-id==5.10 system-service==0.3 systemd-python==234 texttable==1.6.2 toml==0.10.2 toolz==0.11.1 typing-extensions==3.10.0.0 ubuntu-advantage-tools==27.0 ubuntu-drivers-common==0.0.0 ubuntu-image==1.11+20.04ubuntu1 ufw==0.36 unattended-upgrades==0.1 urllib3==1.25.8 usb-creator==0.3.7 varint==1.0.2 vboxapi==1.0 vine==5.0.0 virtualenv==20.0.17 VMDKstream==0.2 voluptuous==0.11.1 wadllib==1.3.3 wcwidth==0.2.5 web3==5.20.0 websocket-client==0.53.0 websockets==8.1 Werkzeug==1.0.1 whitenoise==5.2.0 wifite==2.5.2 wrapt==1.12.1 xkit==0.0.0 yarl==1.6.3 youtube-dl==2020.3.24 zipp==1.0.0 zope.interface==4.7.1i'm trying to send a transaction to Rinkeby Test Network with infura's nodes api i have used legacy transaction type with gasPrice but transaction didn't completed then i decided to use EIP-1559 and i saw the documentation and tried it but i got this error.
in the last line i get following error