To launch Etherscan for Solidity in VSCode, you'll likely want tools for smart contract verification, deployment, and interaction. Here's a complete setup:
1. Essential VSCode Extensions
Solidity Development

Solidity by Juan Blanco - Syntax highlighting, linting, compilation
Solidity Visual Developer by tintinweb - Advanced analysis, security checks
Hardhat for Visual Studio Code - Hardhat integration
Etherscan Integration
Truffle for VSCode - Contract verification on Etherscan
Blockchain Development Kit - Microsoft's official extension
2. Setup for Etherscan Verification
Install Required Packages
npm install --save-dev hardhat @nomiclabs/hardhat-etherscan dotenv
Hardhat Configuration
Create hardhat.config.js:
require("@nomicfoundation/hardhat-toolbox");
require("@nomiclabs/hardhat-etherscan");
require("dotenv").config();
module.exports = {
solidity: "0.8.24",
networks: {
mainnet: {
url: `https://mainnet.infura.io/v3/${process.env.INFURA_KEY}`,
accounts: [process.env.PRIVATE_KEY]
},
sepolia: {
url: `https://sepolia.infura.io/v3/${process.env.INFURA_KEY}`,
accounts: [process.env.PRIVATE_KEY]
}
},
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY
}
};Environment Variables (.env file)
INFURA_KEY=your_infura_project_id PRIVATE_KEY=your_wallet_private_key ETHERSCAN_API_KEY=your_etherscan_api_key
3. Verification Workflow
Deploy and Verify Script
Create scripts/deploy.js:
async function main() {
const Contract = await ethers.getContractFactory("YourContract");
const contract = await Contract.deploy();
await contract.deployed();
console.log("Contract deployed to:", contract.address);
// Verify on Etherscan
console.log("Verifying contract...");
await hre.run("verify:verify", {
address: contract.address,
constructorArguments: [],
});
}Run Verification
# Compile npx hardhat compile # Deploy to testnet npx hardhat run scripts/deploy.js --network sepolia # Or verify existing contract npx hardhat verify --network sepolia CONTRACT_ADDRESS "Constructor Arg 1"
4. Alternative: Using Foundry
# Install Foundry curl -L https://foundry.paradigm.xyz | bash foundryup # Verify with Foundry forge verify-contract \ --etherscan-api-key YOUR_KEY \ --chain-id 1 \ CONTRACT_ADDRESS \ src/Contract.sol:Contract
5. Useful VSCode Settings
Add to .vscode/settings.json:
{
"solidity.enabledAsYouTypeCompilationErrorCheck": true,
"solidity.validationDelay": 1500,
"solidity.packageDefaultDependenciesDirectory": "node_modules",
"solidity.packageDefaultDependenciesContractsDirectory": ""
}6. Getting Etherscan API Key
Go to Etherscan.io
Sign up and go to API Keys
Create new API key
Add to your
.envfile
7. Quick Actions via VSCode Terminal
# One-click verification after deployment npx hardhat verify --network network_name DEPLOYED_CONTRACT_ADDRESS # Flatten contract for manual verification npx hardhat flatten contracts/YourContract.sol > flattened.sol
This setup gives you:
✅ Direct Etherscan verification from VSCode
✅ Smart contract compilation and linting
✅ Deployment scripts with auto-verification
✅ Environment variable management for security
✅ Multi-network support (Mainnet, Testnets)
