I am getting the error "ValueError: max fee per gas less than block base fee" when I try to run the following script using Brownie. I think I figured out that when I send a transaction, I need to set a gas price equal or higher than the next block's base fee (although strangely I didn't run into this issue when I was working on another project recently). How do I fix this?

from brownie import FundMe, network, config, MockV3Aggregator
from scripts.helpfulscripts import get_account, deploy_mocks
from scripts.deploy import deploy_fund_me
from web3 import Web3

def fund():
    fund_me = FundMe[-1]
    account = get_account()
    entrance_fee = fund_me.getEntranceFee()
    print(f"The current entrance fee is {entrance_fee}")
    fund_me.fund({"from": account, "value": entrance_fee})

def withdraw():
    fund_me = FundMe[-1]
    account = get_account()
    fund_me.withdraw({"from": account})

def main():

1 Answer 1


I'll leave this up in case anyone else runs into this (particularly while doing PatrickC's python blockchain course). I figured out that the problem was that I was running anvil in another terminal and then I was trying to deploy on Brownie's development chain which uses the same RPC as anvil. As soon as I closed the terminal running anvil, it worked.

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.