Overview
In this guide, you'll learn how to deploy a Solidity smart contract on the Solana blockchain using Neon EVM. Neon EVM is a Solana runtime for Ethereum Virtual Machine (EVM) smart contracts, enabling developers to execute Solidity code with Solana's scalability and low fees.
Key Objectives
- Set up a Neon-compatible development environment
- Create and deploy a Scoreboard smart contract using Solidity
- Test and verify the deployed contract
- Understand core Solana and Neon EVM concepts
Prerequisites
- Basic knowledge of Solidity and Solana fundamentals
- Node.js (v8.9.4 or later)
- Hardhat installed
- EVM-compatible wallet (e.g., MetaMask)
| Dependency | Version |
|------------|---------|
| Node.js | ≥8.9.4 |
Understanding Solana and Neon EVM
Solana Fundamentals
- Accounts as Files: Everything in Solana (wallets, programs, data) is stored in accounts resembling OS files.
- Programs ≠ Smart Contracts: Solana calls smart contracts "programs," which are stateless and rely on external accounts for data storage.
- High Storage Capacity: Accounts support up to 10MB of data.
Neon EVM Explained
Neon EVM is a full EVM implementation within Solana, allowing:
- Deployment of Solidity/Vyper contracts on Solana.
- Compatibility with Ethereum tools (MetaMask, Hardhat, Remix).
- Leveraging Solana’s low fees and parallel transaction processing.
Development Steps
1. Environment Setup
Add Neon DevNet to MetaMask:
- Visit Neon’s Chainlist.
- Connect wallet and click "Add to MetaMask."
Acquire Test Tokens:
- Use the Neon Faucet to get NEON tokens for DevNet.
2. Hardhat Configuration
Initialize a Hardhat project and update hardhat.config.js:
require("@nomicfoundation/hardhat-toolbox");
const proxy_url = "https://devnet.neonevm.org";
const network_id = 245022926;
module.exports = {
solidity: "0.8.4",
networks: {
neonlabs: {
url: proxy_url,
accounts: [privateKey], // Replace with your private key
chainId: network_id,
},
},
};3. Smart Contract Creation
Scoreboard.sol tracks game scores with functionalities like:
- Creating user profiles (
createUser). - Adding/resetting scores (
addPoints,resetScore). - Retrieving scores (
getCurrentScore,getHighScore).
4. Testing
Run Mocha/Chai tests to validate contract logic:
describe("Scoreboard Contract", () => {
it("Should create a user", async () => {
await scoreboard.createUser();
expect(await scoreboard.userIndex(owner.address)).to.equal(1);
});
});5. Deployment
Deploy to Neon DevNet:
npx hardhat run scripts/deploy.js --network neonlabs6. Verification
Verify the contract on NeonScan:
npx hardhat verify DEPLOYED_ADDRESS --network neonlabsFAQ
Q: Why use Neon EVM over traditional Solana programs?
A: Neon EVM allows Ethereum developers to port existing Solidity dApps to Solana without learning Rust.
Q: How do I fund my DevNet wallet?
A: Use the Neon Faucet to request NEON test tokens.
Q: Can I use Truffle instead of Hardhat?
A: Yes! Neon EVM supports Truffle, Remix, and other Ethereum dev tools.
Q: What’s the gas fee structure on Neon?
A: Fees mirror Solana’s low costs (e.g., ~0.00001 SOL per transaction).
Conclusion
You’ve successfully deployed a Solidity contract on Solana via Neon EVM! Key takeaways:
- Neon bridges Ethereum’s tooling with Solana’s performance.
- Hardhat simplifies testing and deployment.
- Always verify contracts for transparency.
👉 Explore Advanced Neon Features
For further learning, check out our Solang guide.