Skip to content

Fix Brownie Local Account Errors

DodaTech Updated 2026-06-26 1 min read

You will learn how to create, fund, and use local test accounts in Brownie.

The Problem

The brownie account local pattern is frequently misapplied in smart contract and dapp development, leading to vulnerabilities, gas inefficiencies, or logic errors. This guide shows the correct implementation and common pitfalls to avoid.

Quick Fix

Wrong

acct = accounts.add()  # Generates a random account
acct.balance()  # Balance is 0 — can't deploy

Random account has no ETH. Any Transaction fails with insufficient funds.

acct = accounts[0]  # Pre-funded development account
acct.balance()  # 10000 ETH available
Development accounts are pre-funded. No need to manage balances manually during testing.

Prevention

  • Use accounts[0..9] for development and testing
  • Use accounts.add() for imported accounts
  • Fund accounts with chain.transfer() or set_balance()
  • Use DodaTech's Brownie account tool
  • Reset accounts between test runs for isolation

DodaTech Tools

Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro. Doda Browser's developer tools include a Solidity debugger and Transaction inspector. DodaZIP archives secure contract templates for team collaboration. Durga Antivirus Pro scans deployed contracts for known vulnerability signatures.

FAQ

### How many development accounts does Brownie provide?

10 accounts (accounts[0] through accounts[9]), each funded with 10000 ETH on local chains.

Can I increase the balance of a local account?

Yes. Use accounts[target].transfer(accounts[0], amount) or chain.set_balance(target, amount).

What is the difference between accounts and accounts_dict?

accounts is a list indexed by position. accounts_dict maps account names to account objects.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro