Setting Up Your Development Environment
This guide will help you set up a complete development environment for building on the Ettios blockchain. We'll cover all the essential tools and configurations needed to start developing smart contracts and dApps.
Prerequisites
Before proceeding, make sure you have:
- Basic knowledge of JavaScript/TypeScript
- Familiarity with terminal/command line interfaces
- MetaMask installed and configured for the Ettios network
- ETTIA tokens for deployment transaction fees
Installing Node.js and npm
Most Ethereum development tools require Node.js, a JavaScript runtime environment, and npm, its package manager.
Installation Steps
Visit the official Node.js website
Download and install the LTS (Long Term Support) version
Verify your installation by running these commands in your terminal:
node -vnpm -v
Version Requirements
For optimal Ettios development, we recommend:
- Node.js:v16.0.0 or higher
- npm:v8.0.0 or higher
Note: Using a Node.js version manager like nvm is recommended for easily switching between Node.js versions.
Setting Up Development Frameworks
For smart contract development on Ettios, we recommend using one of these frameworks:
Hardhat (Recommended)
Hardhat is a development environment that helps developers compile, deploy, test, and debug Ethereum software.
npm init -ynpm install --save-dev hardhat @nomicfoundation/hardhat-toolboxAfter installation, initialize a Hardhat project:
npx hardhat initFoundry
Foundry is a fast, portable, and modular toolkit for Ethereum application development.
# For Linux or macOScurl -L https://foundry.paradigm.xyz | bashfoundryup# For Windows (using Git Bash)curl -L https://foundry.paradigm.xyz | bashfoundryupInitialize a new Foundry project:
forge init my_projectConfiguring for Ettios Network
Once you've chosen a development framework, you'll need to configure it to work with the Ettios network.
Hardhat Configuration
Update your hardhat.config.js or hardhat.config.ts file with the Ettios network settings:
module.exports = {
solidity: "0.8.19",
networks: {
ettiosTestnet: {
url: "https://testnet-rpc.ettiosblockchain.io",
accounts: [process.env.PRIVATE_KEY],
chainId: 2238,
},
ettiosMainnet: {
url: "https://rpc.ettiosblockchain.io",
accounts: [process.env.PRIVATE_KEY],
chainId: 2237,
}
}
};Create a .env file in your project root to store your private key. Never commit this file to version control.
PRIVATE_KEY=your_private_key_here
Also install dotenv to load environment variables:
npm install --save-dev dotenvFoundry Configuration
Create or update your foundry.toml file:
[profile.default]
src = 'src'
out = 'out'
libs = ['lib']
solc = "0.8.19"
[rpc_endpoints]
ettios_testnet = "https://testnet-rpc.ettiosblockchain.io"
ettios_mainnet = "https://rpc.ettiosblockchain.io"
[etherscan]
ettios_testnet = { url = "https://testnet-scan.ettiosblockchain.io/api" }
ettios_mainnet = { url = "https://scan.ettiosblockchain.io/api" }For private key management, you can create a .env file and load it using Cast:
# Deploy script example PRIVATE_KEY=$(cast wallet import-private-key /path/to/privatekey) forge script script/Deploy.s.sol:DeployScript --rpc-url ettios_mainnet --broadcast --verify
Installing Additional Tools
Solidity Compiler
While Hardhat and Foundry include the Solidity compiler, you can also install it separately:
npm install -g solcIDE Extensions
For better development experience, install these extensions for your code editor:
Visual Studio Code:
- Solidity by Juan Blanco
- Solidity Visual Developer
- Hardhat for Visual Studio Code
JetBrains IDEs:
- IntelliJ Solidity
Frontend Libraries
For frontend development, consider installing these libraries:
npm install ethers wagmi viemThese libraries help you interact with the Ettios blockchain from your web applications.
Verifying Your Setup
Let's make sure everything is working correctly by creating and compiling a simple contract.
Create a Test Contract
Create a file called Greeter.sol in your project's contracts folder:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
contract Greeter {
string private greeting;
constructor(string memory _greeting) {
greeting = _greeting;
}
function greet() public view returns (string memory) {
return greeting;
}
function setGreeting(string memory _greeting) public {
greeting = _greeting;
}
}Compile the Contract
For Hardhat:
npx hardhat compileFor Foundry:
forge buildTest Deployment Script
For Hardhat, create a file called deploy.js in your project's scripts folder:
const hre = require("hardhat");
async function main() {
// Get the Greeter contract factory
const Greeter = await hre.ethers.getContractFactory("Greeter");
// Deploy with initial greeting
const greeter = await Greeter.deploy("Hello, Ettios!");
// Wait for deployment to complete
await greeter.deployed();
console.log("Greeter deployed to:", greeter.address);
}
// Run the deployment
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});Security Best Practice
Never hardcode private keys in your code or commit them to version control. Always use environment variables or secure key management solutions.
Next Steps
Now that your development environment is set up, you're ready to start building on Ettios: