Deployment Guide
Deploy EVM contracts to Selendra
Deploy EVM contracts to Selendra using Hardhat, Foundry, or Remix.
Network Configuration
Testnet (Development)
- Network: Selendra Testnet
- RPC:
https://rpc-testnet.selendra.org - Chain ID:
1953 - Currency: tSEL
- Explorer:
https://explorer-testnet.selendra.org - Faucet: https://faucet.selendra.org
Mainnet (Production)
- Network: Selendra Mainnet
- RPC:
https://rpc.selendra.org - Chain ID:
1961 - Currency: SEL
- Explorer:
https://explorer.selendra.org
Hardhat Configuration
require("@nomicfoundation/hardhat-toolbox");
module.exports = {
solidity: "0.8.19",
networks: {
testnet: {
url: "https://rpc-testnet.selendra.org",
chainId: 1953,
accounts: [process.env.PRIVATE_KEY],
gasPrice: 1000000000, // 1 Gwei
},
mainnet: {
url: "https://rpc.selendra.org",
chainId: 1961,
accounts: [process.env.PRIVATE_KEY],
gasPrice: 100000000, // 0.1 Gwei
},
},
};
Set private key: export PRIVATE_KEY=your_private_key_here
Deploy Contract
Hardhat
Create scripts/deploy.js:
async function main() {
const ContractFactory = await ethers.getContractFactory("MyContract");
const contract = await ContractFactory.deploy();
await contract.deployed();
console.log("Contract deployed:", contract.address);
console.log("Transaction:", contract.deployTransaction.hash);
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
Deploy:
npx hardhat run scripts/deploy.js --network testnet
npx hardhat run scripts/deploy.js --network mainnet
Foundry
Create script/Deploy.s.sol:
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;
import "forge-std/Script.sol";
import "../src/MyContract.sol";
contract Deploy is Script {
function run() external {
vm.startBroadcast();
MyContract myContract = new MyContract();
vm.stopBroadcast();
console.log("Contract deployed:", address(myContract));
}
}
Deploy: forge script script/Deploy.s.sol --rpc-url https://rpc.selendra.org --broadcast
Remix IDE
- Open Remix
- Paste contract code
- Go to "Deploy & Run Transactions"
- Select "Injected Provider - MetaMask"
- Connect to Selendra in MetaMask
- Click "Deploy"
Verification
Hardhat
Install plugin: npm install --save-dev @nomicfoundation/hardhat-verify
Add to hardhat.config.js:
require("@nomicfoundation/hardhat-verify");
module.exports = {
etherscan: {
apiKey: process.env.EXPLORER_API_KEY,
customChains: [
{
network: "selendra",
chainId: 1961,
urls: {
apiURL: "https://explorer.selendra.org/api",
browserURL: "https://explorer.selendra.org",
},
},
],
},
};
Verify: npx hardhat verify --network selendra CONTRACT_ADDRESS
Manual
- Visit https://explorer.selendra.org
- Search contract address → "Contract" tab
- Click "Verify & Publish"
- Upload source, set compiler version
- Click "Verify"
Gas Optimization
// Use immutable for constants
uint256 public immutable TOTAL_SUPPLY;
constructor() {
TOTAL_SUPPLY = 1000000 * 10**18;
}
// Use calldata for external parameters
function processData(bytes calldata data) external {
// Processing
}
Common Issues
"Insufficient funds" - Check balance with:
curl -X POST -H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["YOUR_ADDRESS","latest"],"id":1}' \
https://rpc.selendra.org
"Invalid chain ID" - Verify MetaMask shows Chain ID 1961
Transaction stuck - Use higher gas:
const tx = await contract.myFunction({
gasPrice: ethers.parseUnits("1", "gwei"),
gasLimit: 500000,
});
Production Checklist
- Code audited
- Tested on testnet
- Gas optimized
- Emergency mechanisms in place
- Admin controls verified
- Event emissions tested
- Error handling verified
Monitoring
const provider = new ethers.JsonRpcProvider("https://rpc.selendra.org");
contract.on("*", (event) => {
console.log("Event:", event.eventName, "Block:", event.blockNumber);
});
Next Steps
Security Practices | Build dApps
Support: Telegram: t.me/selendranetwork | GitHub: github.com/selendra/selendra
Found an issue or want to contribute?
Help us improve this documentation by editing this page on GitHub.
