Developing Smart Contracts
Celestium is fully Ethereum Virtual Machine (EVM)-compatible, allowing developers to write and deploy smart contracts using Solidity, the most popular language for smart contract development. Any contract written for Ethereum can be deployed on Celestium without modification.
This section provides an overview of the smart contract development process and an example of a basic Solidity contract.
Tools for Development
Developers can use familiar Ethereum development tools:
Hardhat – Development framework for building and testing smart contracts.
Foundry – Fast, modular toolkit for smart contract development.
Remix – Online IDE for writing, testing, and deploying Solidity contracts.
Setting Up Hardhat for Celestium
Install Hardhat:
Create a Hardhat Project:
Configure Hardhat for Celestium Testnet:
Modify hardhat.config.js
:
Replace PRIVATE_KEY
with your wallet's private key.
Example: Simple Solidity Contract
This is a basic contract to store and retrieve a number:
Deploying the Contract
Create a deployment script scripts/deploy.js
:
Run the deployment script:
Interacting with the Contract
Once deployed, you can interact with the contract using ethers.js:
Replace DEPLOYED_CONTRACT_ADDRESS
with the address of the deployed contract.
Viewing on Explorer
Once deployed, you can verify the contract and track transactions on the Celestium Testnet Explorer.
Best Practices
Always test contracts on the Celestium Testnet before deploying on the main network.
Use OpenZeppelin Contracts for secure and standardized smart contract implementations.
Review gas efficiency and security best practices when writing contracts.
This guide provides the foundation to start developing and deploying smart contracts on Celestium
Last updated