0

I'm currently watching my first smart contracts tutorial by freecodecamp and it works fine but, I have one question: How can I check the balance of my mainnet-fork account(s)? When I work with Rinkeby or Görli I can simply check the success of my transactions via MetaMask but how can I check my mainnet-fork balance? Where & how? Thanks in advance!

2
  • If you're using Metamask, the balances are shown in the usual place...
    – 0xSanson
    Sep 30, 2022 at 22:58
  • @0xSanson NO! When I run the code on mainnet-fork? It works, but I don't know where to look at the accounts, and balance, is there a specific comand I have to use? Oct 1, 2022 at 0:03

1 Answer 1

0

print(f'account bal.: {account.balance()})

works for any network I've tried, which is to say mainnet-fork, avax-test, and ganache. If you are using the 'get_account()' function in patrick collins video then pay attention to the fact that the line

  if network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS:
       return accounts[0]

returns a brownie (ganache-cli?) generated account rather than your wallets account if 'mainnet-fork' is in 'LOCAL_BLOCKCHAIN_ENVIRONMENTS'. So you'd be seeing that account balance rather than your wallets.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.