Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Sep 25 20:25
    Haavi97 commented #2660
  • Sep 25 20:25
    Haavi97 closed #2660
  • Sep 25 20:25
    Haavi97 edited #2660
  • Sep 25 20:22
    Haavi97 opened #2660
  • Sep 23 15:50
    Polsaker commented #2629
  • Sep 22 22:47
    ofek commented #2398
  • Sep 22 22:45
    ofek synchronize #2398
  • Sep 22 18:56
    pacrob commented #2409
  • Sep 22 18:47

    fselmo on v5

    Pin protobuf to ``3.19.4`` for … (compare)

  • Sep 22 18:47
    fselmo closed #2659
  • Sep 22 18:08
    fselmo synchronize #2659
  • Sep 22 18:06
    fselmo edited #2659
  • Sep 22 18:06
    fselmo edited #2659
  • Sep 22 18:04
    fselmo synchronize #2659
  • Sep 22 17:59
    fselmo review_requested #2659
  • Sep 22 17:59
    fselmo ready_for_review #2659
  • Sep 22 17:57
    fselmo synchronize #2659
  • Sep 22 17:54
    fselmo synchronize #2659
  • Sep 22 17:43
    fselmo synchronize #2659
  • Sep 22 17:40
    fselmo edited #2659
Hey, I have an issue : I am trying to call a contract by signing a call because I need to use a specific addres to use some functions : 'message': 'invalid remainder', 'code': -32000,
1 reply
I have very similar code to this that works, with the only difference that I'm still using gasPrice instead of the EIP-1559 equivalents
1 reply
Muhammad Yasir
anyone working with Zokrates ?
1 reply
Hello. I am trying to install web3.py using command 'web3_py_simple_storage % pip install web3.py' but get error message 'zsh: command not found: pip'
1 reply
Hi guys, is there a way to have non blocking interaction with contracts via WebSocketProvider? (Like async stuff) I see that there is AsyncHttpProvider, but no webocket ones. Thx for response in advance!
1 reply
And could I perform batch interaction with the contract to avoid sending multiple requests (eg via Webscokets)?
Shchegolev Vladimir

Hi. I work with my private PoA network and setup it with {"baseFeePerGas": null}.
I added construct_sign_and_send_raw_middleware to my python bot. And I got an error

.../web3/_utils/transactions.py", line 64, in <lambda>
web3.eth.max_priority_fee + (2 * web3.eth.get_block('latest')['baseFeePerGas'])
KeyError: 'baseFeePerGas'

What I can do with it? It tries to get baseFeePerGas but my node returns null

1 reply

<Felipe Selmo (fselmo)> This error is happening because no fee value is set for transactions and thus web3.py is trying to use some information to set a default value for you. Since the library is built around Ethereum, it will look for baseFeePerGas to attempt to estimate a good fee for the transaction. If you set your own fee values, you can likely get around this error. This is usually done as a gasPrice on other chains but can also be done via a combination of maxFeePerGas and maxPriorityFeePerGas values on Ethereum.

Hope that helps.

1 reply
Ahmad Fahadh Ilyas
Hello, is there any way to close active connection to node? Because I get warning from my node that I've exceeded active connection and can not connect to node anymore. I can't find about closing connection anywhere in the documentation. I'm using the latest web3.py
1 reply
Quan Truong
@fahadh4ilyas Hey are you talking about when you run brownie test ?
hello everyone. How to decode data from transaction of front-running bot ?

hello, I'm trying to port some code from js to python and having some issues. the js code generates uniswap swap commands using populateTransaction, then sends the tx data to a smart contract that actually executes. when I get transaction bytes generated by populateTransaction in JS, things work fine. in python, I dug down and used prepare_transaction to generate transaction data, but this causes the contract to error. any ideas what I might look at to debug this? or if there's a better way to replicate populateTransaction in web3py?

I should add, I'm not using build_transaction because that causes a revert (contract calls are valid from the executing smart contract, so they revert if I try to set them up locally)

Sohail Awan

File "/home/sohail/Blockchain/local_ganache_network_web3_app.py", line 48, in send_coin_on_reps
tx_hash = contract.functions.setReward(reps).transact()

File "/home/sohail/anaconda3/lib/python3.9/site-packages/web3/contract.py", line 997, in transact
return transact_with_contract_function(

File "/home/sohail/anaconda3/lib/python3.9/site-packages/web3/contract.py", line 1590, in transact_with_contract_function
txn_hash = web3.eth.send_transaction(transact_transaction)

File "/home/sohail/anaconda3/lib/python3.9/site-packages/web3/eth.py", line 815, in send_transaction
return self._send_transaction(transaction)

File "/home/sohail/anaconda3/lib/python3.9/site-packages/web3/module.py", line 57, in caller
result = w3.manager.request_blocking(method_str,

File "/home/sohail/anaconda3/lib/python3.9/site-packages/web3/manager.py", line 198, in request_blocking
return self.formatted_response(response,

File "/home/sohail/anaconda3/lib/python3.9/site-packages/web3/manager.py", line 171, in formatted_response
raise ValueError(response["error"])

ValueError: {'code': -32601, 'message': 'The method eth_sendTransaction does not exist/is not available'}

can anyone help me to resolve that ?

Sohail Awan
<carver, Jason Carver> Answered
BlockChain & Web developer
Is there any project for me to do ? I am free now
Muhammad Suliman
i have a problem in the web3 installation.
please help me.
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.32.31326\\bin\\HostX86\\x86\\link.exe' failed with exit code 1120
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> netifaces

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

please give me any solution of this problem.
Arslaan Khan
export WEB3_INFURA_PROJECT_ID cannot find name 'WEB3_INFURA_PROJECT_ID'.
i am getting this error in .env file
i am using python3.9 and brownie version 1.18
Bimal xr

Error at installing web3 :Building wheels for collected packages: lru-dict, cytoolz
Building wheel for lru-dict (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\users\admin\pycharmprojects\bimal\python-blockchain\venv\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\admin\AppData\Local\Temp\pip-install-bowxp6gw\lru-dict_eb8
13ac5f5b24a44b48eea81e085fd6e\setup.py'"'"'; file='"'"'C:\Users\admin\AppData\Local\Temp\pip-install-bowxp6gw\lru-dict_eb813ac5f5b24a44b48eea81e085fd6e\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if
os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\admin\A
cwd: C:\Users\admin\AppData\Local\Temp\pip-install-bowxp6gw\lru-dict_eb813ac5f5b24a44b48eea81e085fd6e\
Complete output (11 lines):
running bdist_wheel
running build
running build_ext
building 'lru' extension
creating build
creating build\temp.win-amd64-cpython-310
creating build\temp.win-amd64-cpython-310\Release
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\users\admin\pycharmprojects\bimal\python-blockchain\venv\include -IC:\Users\admin\App
Data\Local\Programs\Python\Python310\include -IC:\Users\admin\AppData\Local\Programs\Python\Python310\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\ATLMFC\include" "-IC:\Program Files\Micr
osoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include" /Tclru.c /Fobuild\temp.win-amd64-cpython-310\Release\lru.obj
C:\Users\admin\AppData\Local\Programs\Python\Python310\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory

error: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\HostX86\x64\cl.exe' failed with exit code 2

ERROR: Failed building wheel for lru-dict
Running setup.py clean for lru-dict
Building wheel for cytoolz (setup.py) ... error

Bimal xr
error: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\HostX86\x64\cl.exe' failed why library is depended on visual studio ??
Bimal xr
anyone please..
Hi, guys. Does anyone know how to get all pending transactions to one contract address?
hey, guys , how to use web3.py to simulate to buy or sell tokens ? which function from web3.py should I use ? thanks
Have you gotten help with what you asked?
John Doe
hi, I'm getting 'AsyncEth' object has no attribute 'account' from signed_tx = w3.eth.account.sign_transaction(tx_data, private_key=pk), where w3 is an instance of AsyncHTTPProvider... non-async version used to work... let me guess... it's not been implemented yet?
John Doe
ok, solved by calling the class method Account.sign_transaction()
Kushal Babel
Hi, is python web3 library thread safe? I'm seeing some issues with concurrency where some temporary json files are being overwritten by different concurrenct web3 calls
hi Please i get this error when i try run my brownie delpoy_lottery.py scripts --- network rinkeby any idea on how to solve this Running 'scripts/deploy_lottery.py::main'...
File "brownie/_cli/run.py", line 51, in main
return_value, frame = run(
File "brownie/project/scripts.py", line 110, in run
return_value = f_localsmethod_name
File "./scripts/deploy_lottery.py", line 58, in main
File "./scripts/deploy_lottery.py", line 14, in deploy_lottery
lottery = Lottery.deploy(
File "brownie/network/contract.py", line 544, in call
raise AttributeError(
AttributeError: Final argument must be a dict of transaction parameters that includes a from field specifying the address to deploy from

Here's my deploy_lottery script: from scripts.helpful_script import (
from brownie import Lottery, accounts, network, config
import time
import os

def deploy_lottery():
account = get_account()
lottery = Lottery.deploy(
{"from": account},
publish_source=config["networks"][network.show_active()].get("verify", False),
print("Deployed lottery!")
return lottery

def start_lottery():
account = get_account()
lottery = Lottery[-1]
starting_tx = lottery.startLottery({"from": account})
print("The lottery is started!")

def enter_lottery():
account = get_account()
lottery = Lottery[-1]
value = lottery.getEntranceFee() + 100000000
tx = lottery.enter({"from": account, "value": value})
print("You entered the lottery!")

def end_lottery():
account = get_account()
lottery = Lottery[-1]

# fund the contract
# then end the lottery
tx = fund_with_link(lottery.address)
ending_transaction = lottery.endLottery({"from": account})
print(f"{lottery.recentWinner()} is the new winner!")

def main():

@kushal Babel. It is safe but make sure you debug
hello gays
I want sign a json message,what code can i use
Like this {"nonce":10,"deadline":1657729871,"profileId":"0x8635","pubId":"0x01","data":"0x"}
I use encode_defunct,but it dont work
Muhammad Yasir
anyone working with anonymous / private transactions techniques on web3.py ?
Hi, how are you all?
vinci zhou
Mikko Ohtamaa
Hi all. As this chat is no longer very active I suggest people come to Discord https://ethereum.org/en/developers/docs/programming-languages/python/#python-community-contributors
is anyone know how to send bytes32 in the transaction?