Error Deploying Brownie Scripts Using Metamask
As a developer working with smart contracts on the Ethereum network, you’ve probably encountered issues when deploying scripts to the blockchain using the Brownie platform. In this article, we’ll look at the error message that Brownie generates when trying to deploy scripts using Metamask.
Error Message Explanation
The “Non-Hexadecimal Digit Found” error is a cryptic message that indicates a problem with the code or data used in the deployment process. However, upon closer inspection, it seems to be related to the syntax of the hexadecimal values used in the script.
When Brownie runs scripts using Metamask, it uses the Ethereum Virtual Machine (EVM) to execute the bytecode of smart contracts written in Solidity. The EVM interprets the hexadecimal values as code and executes them accordingly.
The “Brownie” Terminal Error
In this specific error message, we have the phrase “Non-hexadecimal digit found.” This is not a typical error message from Brownie itself, but rather a hint as to what might be causing the problem. When running scripts with Metamask and Brownie, you may encounter issues with the syntax or formatting of the hexadecimal values used.
Possible Causes and Solutions
Here are some possible causes and solutions for this error:
- Invalid Hexadecimal Values: Make sure all hexadecimal values in your script are valid. In Solidity, hexadecimal values must be between 0 and F, inclusive.
- Missing or incorrect “0x” prefix: When writing hexadecimal values, always prefix them with the “0x” prefix to indicate that they are hexadecimal (e.g. “0x1234567890abcdef”).
- Incorrect syntax: Check your script for syntax errors, such as missing colons or incorrect use of semicolons.
- Metamask configuration issues: Check that Metamask is properly configured on your machine and that the Brownie executable can connect to it.
Example solution
To resolve this issue, you can try running a simple test case in your script using Brownie. Here is an example of how you can modify your deploy.py file to include basic error checking:
import brown
def main():

Make sure Metamask is properly configuredif not brown.is_metro_client_configured():
raise Exception("Metamask configuration problem")
try:
Deploy the contract with error handlingbrown.run_scripts({"script": "your_script.py"})
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
main()
This example code checks that Metamask is properly configured before attempting to deploy the script. If an error occurs, the exception message is printed.
Conclusion
The “Non-hexadecimal digit found” error in Brownie’s terminal output can be a complex problem, but if you understand the syntax and formatting requirements for hexadecimal values, you should be able to identify and resolve any issues. Remember to check that your Metamask configuration is correct and test your scripts with basic error checking before deploying them to the blockchain.