Installation¶
Install uv and Anvil. Brownie Safe supports Python 3.10 through 3.12. uv uses the lockfile to install Brownie and the Safe SDK together.
Use a checkout to follow the commands in this guide. Brownie Safe is also available on PyPI.
Configure a mainnet fork¶
Fork previews support Anvil and Hardhat. For the Anvil setup below, export ETH_RPC_URL with an Ethereum mainnet RPC URL. Register the upstream network and the development fork once so Brownie can use the upstream network’s explorer settings on the fork.
uv run --locked brownie networks add Ethereum brownie-safe-mainnet \
host='$ETH_RPC_URL' chainid=1 explorer=https://api.etherscan.io/v2/api
uv run --locked brownie networks add development brownie-safe-fork \
cmd=anvil host=http://127.0.0.1 port=8546 fork=brownie-safe-mainnet chain_id=1 base_fee=0 steps_tracing=true
If you already registered the fork with an RPC URL, add the upstream network above and run uv run --locked brownie networks modify brownie-safe-fork fork=brownie-safe-mainnet.
The local RPC listens on port 8546 and uses a zero base fee for simulation. Opcode tracing enables Brownie call traces. The fork uses chain ID 1 so the Safe transaction hashes and hosted queue requests refer to Ethereum mainnet. See Brownie network management to use an existing fork configuration.
Load verified contracts¶
The detailed WETH example uses Brownie’s automatic ABI lookup. Export ETHERSCAN_TOKEN with your Etherscan API key. From the checkout, run mkdir -p contracts so Brownie recognizes it as a project. Add the following setting to brownie-config.yaml.
Brownie can then fetch and cache the ABI when you call safe.contract(address) for a verified contract.
Start the console¶
Run from the checkout:
Set up hosted Safe access¶
Set SAFE_AUTH_TOKEN to your Safe API key in the shell that launches Brownie when you want to read the hosted queue or submit proposals and confirmations. The quickstart uses the on-chain nonce for a local preview, which can run without a Safe API key.