i have a smartcontract developed with brownie. I want to deploy it to ganache. If i run my deployment script brownie run scripts/deploy.py
, brownie deploys the smartcontract with ganache-cli
. But i want to deploy it to the desktop version of ganache so i can use it in a more convenient manner. I can have a look at my networks with brownie networks list
and i can see different networks like Ethereum mainnet, Ropsten etc. and the Development networks:
Development
├─Ganache-CLI: development
├─Geth Dev: geth-dev
├─Hardhat: hardhat
├─Hardhat (Mainnet Fork): hardhat-fork
├─Ganache-CLI (Mainnet Fork): mainnet-fork
├─Ganache-CLI (BSC-Mainnet Fork): bsc-main-fork
├─Ganache-CLI (FTM-Mainnet Fork): ftm-main-fork
├─Ganache-CLI (Polygon-Mainnet Fork): polygon-main-fork
└─Ganache-CLI (XDai-Mainnet Fork): xdai-main-fork
since using the brownie run scripts/deploy.py
without the --network
option deploys it to the development network, i guess something has to be configured so it is not using the Ganache-CLI
. I cannot find a way to deploy it to my ganache desktop. I have seen in a tutorial, that brownie usally automatically connects to ganache desktop via RPC-Client, if its running. But on my computer it is not working.
Best Answer
okay. I found the solution. I can add a local network in my network list with :
where
ganache-local
is a name i choose and wherehost + chainid
is from the running Ganache-desktop version. After running that command you can see a Success message:if you run now
brownie networks list
, under theEthereum
section you will see the newganache-local
now i can run
brownie run scripts/deploy.py --network ganache-local
and deploy to ganache-desktopyou can delete the network with
brownie networks delete ganache-local