How To Deploy a Solidity Smart Contract on Solana using Neon

·

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


Prerequisites

| Dependency | Version |
|------------|---------|
| Node.js | ≥8.9.4 |


Understanding Solana and Neon EVM

Solana Fundamentals

Neon EVM Explained

Neon EVM is a full EVM implementation within Solana, allowing:


Development Steps

1. Environment Setup

  1. Add Neon DevNet to MetaMask:

  2. Acquire Test Tokens:

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:

👉 View Full Contract Code

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 neonlabs

6. Verification

Verify the contract on NeonScan:

npx hardhat verify DEPLOYED_ADDRESS --network neonlabs

FAQ

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:

👉 Explore Advanced Neon Features

For further learning, check out our Solang guide.

Feedback? Let us know via Discord or Twitter. Happy coding!