Skip to main content

Get Started on Neon EVM

note

This is a bare bones Get Started; alternatively browse the full support available in this site.

Get test NEON for Neon Devnet​

To populate the accounts with test NEON, visit the faucet, where you will be issued up to 100 NEON.

Configure Neon network credentials in your framework's config file​

The network credentials are configured under the β€œnetworks” property in the hardhat.config.js.

neondevnet: {
url: "https://devnet.neonevm.org",
accounts: [Array_of_accounts_private_keys],
chainId: 245022926,
allowUnlimitedContractSize: false,
gas: "auto",
gasPrice: "auto",
isFork: true,
},

See the Hardhat tutorial

Verify contracts on Neon Devnet with Hardhat and NeonScan:​

To verify contracts on Neon Devnet with NeonScan, add this configuration to hardhat.config.js:

etherscan: {
apiKey: {
neonevm: "test"
},
customChains: [
{
network: "neonevm",
chainId: 245022926,
urls: {
apiURL: "https://devnet-api.neonscan.org/hardhat/verify",
browserURL: "https://devnet.neonscan.org"
}
}
]
}

The command for verifying a deployed contract is:

npx hardhat verify <DEPLOYED_CONTRACT_ADDRESS> --network neondevnet

Follow this GitHub tutorial for Hardhat contract verification.

Gotchas​

Reaching account limits​

You may encounter an error The transaction requires too lot of accounts, i.e. that the transaction has exceeded the account limit. This error refers to the fact that the transaction on Solana does not allow the number of accounts to be more than 64. If you do need more than 64 accounts, the smart contract function throwing the error needs to be optimized.

Basic optimization of smart contracts​

Consider applying the following optimization techniques:

  1. Reduce the contract binary size.
  2. Use indexed parameters for the events.
  3. Use custom errors instead of require statements whenever possible.
  4. Minimize function calls from within a function (this reduces the function call overload).
  5. Avoid using strings as storage values and, instead, use fixed-sized bytes32 whenever possible.
  6. Avoid loops through long arrays and use mappings instead of loops.
  7. Make revert and assert messages as short as possible.
  8. Write a library for all the reusable codes.
  9. Use memory locations wisely - calldata, memory, storage (order is cheapest to expensive).
  10. Variables should be declared in order so that they use fewer storage slots.

Learn more about optimizations from the EVM Compatibility Overview.

Was this page helpful?