Prerequisites
Complete the environment variable setup in the quickstart before following the steps below.
Smart contract framework
Contracts are written in Solidity and run in a Hardhat environment. They live in the smart-contracts directory.
- Tests are in the
tests directory, written in JavaScript or TypeScript. An example test is included.
- Deploy scripts are in the
scripts directory, also in JavaScript or TypeScript. Required scripts are already in place to get started.
Deploy to a local test chain
Follow the start developing instructions to spin up a local chain.
The dev command runs the scripts/deploy_localhost script internally, which deploys all contracts in the correct sequence.
When working on your own smart contracts, update scripts/deploy_localhost to deploy them in the right order.
For all available options:
Enable a local block explorer with Ethernal
You can optionally start a local blockchain explorer that auto-indexes transactions and provides a dashboard with an overview of the chain.
Set up Ethernal
- Create an account and a workspace at https://app.tryethernal.com/.
- Add your login email, password, and workspace name to the
.env file in the smart-contracts directory.
These values can also be passed as flags to the dev command: --ethernal-login-email, --ethernal-login-password, and --ethernal-workspace. These flags override the environment variables if both are set.
Start the block explorer
Run the dev command with the -e flag:
Access the explorer at https://app.tryethernal.com/.
Deploy to production
The deploy command deploys to any EVM-compatible chain. It runs scripts/deploy_prod to deploy all contracts in the correct sequence.
When working on your own smart contracts, update scripts/deploy_prod to deploy them in the right order.
For all available options:
See the deploy section of the quickstart for usage examples.