πDeploying Contracts
Deploying Contracts using Hardhat
You can deploy your contracts in 3Base using hardhat.
What is Hardhat?
Hardhat is a development environment for Ethereum. It helps developer manage and automate building smart contracts. It consists of different components for editing, compiling, debugging and deploying your smart contracts and dApps, all of which work together to create a complete development environment.
Creating a Hardhat Project
Create a directory for you project
Initialize the project with hardhat
Choose the Configuration of your hardhat project, a sample typescript project(recommended)
Creating Your Smart Contract
Add your contracts to the contracts folder or
Create a contracts directory, if there is none
Create your contract in the contracts directory
Creating Your Configuration File
Create a secrets.json file to store your private key
Add your private key to secrets.json
Add secrets.json to .gitignore, to avoid pushing your private key to github
Modify the hardhat.config.ts file as below
Deploying Your Smart Contract
Compile your contract
Create a scripts directory and create your deployment scripts
Create a deployment script, like the one below
Deploy your_contract.sol using the command below
Last updated