Environment
Now that our installation is complete, let's configure the development environment for ETH Mobile.
1. Your device/simulator and computer must be connected to the same WIFI.
2. Initialize a Local Blockchain:
In the first terminal, run a local network from the project root folder:
yarn chain
This command starts a local Ethereum network hosted on your local IP address. The network runs on your local machine and can be used for testing and development. You can customize the network configuration in hardhat.config.ts
.
Alternatively, you can use Ganache to persist the blockchain state during development
3. Deploy Your Smart Contract:
In the second terminal, deploy the test contract:
yarn deploy
This command deploys a test smart contract to the local network. The contract is located in packages/hardhat/contracts
and can be modified to suit your needs. The yarn deploy
command uses the deploy script located in packages/hardhat/deploy
to deploy the contract to the network. You can also customize the deploy script.
4. Configure the local network provider:
yarn configure-network
This command sets your local IP address as your hardhat.provider
in ethmobile.config.ts
. It uses the script located in packages/expo/utils/eth-mobile/configureLocalNetwork.ts
5. Prebuild native modules:
yarn prebuild
6. Run your app:
yarn android
yarn ios
What's Next:
- Interact with your smart contract in the
debugContracts
screen. - Configure your supported networks in
ethmobile.config.ts
. - Run smart contract test with
yarn hardhat:test
- Edit your smart contract
YourContract.sol
inpackages/hardhat/contracts
- Edit your deployment scripts in
packages/hardhat/deploy
- Edit your frontend in
packages/expo/app