Write Smart Contract

Configure Hardhat to connect with SupraEVM, write a Solidity smart contract, and create a deployment script to automate deployment using Hardhat scripts.


Configure Hardhat for SupraEVM

Update hardhat.config.js to define the SupraEVM network, specifying the RPC URL, chain ID, and private key to enable seamless contract deployment and interaction.

  • Change your hardhat.config.js file and add the following configuration:

require("@nomicfoundation/hardhat-toolbox");

module.exports = {
  solidity: "0.8.4",
  networks: {
    supra: {
      url: "https://rpc-evmstaging.supra.com/rpc/v1/eth",
      chainId: 119,
      accounts: [`0xPRIVATE_KEY`]
    }
  }
};

Create a Smart Contract File

Define a Solidity smart contract in SimpleStorage.sol to store and retrieve a uint256 value, providing a basic example for deployment on SupraEVM.

  • Create a SimpleStorage.sol File

Create a Deployment Script

Write a deployment script in deploy.js to automate smart contract deployment on SupraEVM using Hardhat, enabling seamless contract execution and interaction.

  • Create a scripts directory and a file named deploy.js: