← Back to AERE Academy

Deploy Your First Smart Contract

Beginner ~2 hours 6 modules

Module 1, Solidity Basics

Solidity is the most widely used language for writing smart contracts on EVM chains. A Solidity file is compiled to EVM bytecode and deployed on-chain, where it runs exactly as written, no one can alter it after deployment, and it executes identically on every node.

Contract structure

Every Solidity file starts with a pragma directive specifying the compiler version, then defines one or more contract blocks. Inside a contract you declare state variables (stored permanently on-chain), functions, events, and modifiers.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract HelloAERE {
    // State variable, stored on the blockchain
    string public greeting = "Hello, AERE Network!";

    // Function to update the greeting
    function setGreeting(string calldata _msg) external {
        greeting = _msg;
    }
}

Key concepts

Module 2, Setting Up Remix IDE

Remix is a browser-based Solidity IDE, no installation required. It handles compilation, deployment, and interaction with your contracts directly from the browser.

Step 1. Open remix.ethereum.org in your browser.
Step 2. In the file explorer on the left, create a new file: click the "+" icon and name it SimpleStorage.sol.
Step 3. In the compiler panel (the "S" icon), select compiler version 0.8.20 and leave EVM version on the default.
Step 4. Compile is triggered automatically whenever you save (Ctrl+S). Green checkmark = no errors.
Remix keeps a virtual filesystem in your browser's local storage. You will not lose your files if you close and reopen the tab on the same browser, but do not rely on this for important projects. Use Hardhat or Foundry locally for production development.

Module 3, Connecting MetaMask to AERE

Remix can deploy contracts via MetaMask. You need MetaMask installed and connected to AERE Network (chain ID 2800) before you deploy.

Step 1. Install MetaMask from metamask.io if you have not already.
Step 2. Add AERE Network. Visit aere.network/addnetwork.html and click the one-click button, or add manually: RPC https://rpc.aere.network, Chain ID 2800, symbol AERE, explorer https://explorer.aere.network.
Step 3. Get testnet AERE from the faucet at aere.network/faucet.html, 0.05 AERE is enough to deploy several contracts. Gas fees are extremely low on AERE.
Step 4. In Remix, open the Deploy & Run Transactions panel (the plug icon on the left sidebar). Change "Environment" from "Remix VM" to Injected Provider, MetaMask. MetaMask will ask you to confirm the connection.
Step 5. Confirm you see "Custom (2800) network" in Remix. Your MetaMask account address will appear next to it.

Module 4, Simple Storage Contract

Let's deploy a real contract. Copy the following into SimpleStorage.sol in Remix:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
 * @title SimpleStorage
 * @notice Stores and retrieves a single uint256 value on AERE Network.
 */
contract SimpleStorage {
    uint256 private _value;

    // Emitted whenever the stored value changes
    event ValueChanged(address indexed caller, uint256 newValue);

    /// @notice Write a new value to storage
    function store(uint256 value) external {
        _value = value;
        emit ValueChanged(msg.sender, value);
    }

    /// @notice Read the stored value (free, no gas)
    function retrieve() external view returns (uint256) {
        return _value;
    }
}

Compile it (Ctrl+S), then in the Deploy panel click Deploy. MetaMask will pop up, confirm the transaction. Within ~1 second (AERE's block time), the contract is deployed. You will see its address in the "Deployed Contracts" list at the bottom of the Deploy panel.

Click the deployed contract to expand it. Try calling store with a number, then retrieve to read it back. Each store call sends an on-chain transaction; each retrieve is a free local call.

Module 5, Writing and Deploying an ERC-20 Token

ERC-20 is the standard interface for fungible tokens on EVM chains. It defines a set of functions (transfer, approve, transferFrom, balanceOf, etc.) that wallets and exchanges know how to interact with automatically.

Create a new file MyToken.sol:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
 * @title MyToken
 * @notice A minimal ERC-20 token deployed on AERE Network.
 *         1,000,000 tokens minted to the deployer on construction.
 */
contract MyToken {
    string  public name;
    string  public symbol;
    uint8   public constant decimals = 18;
    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;
    mapping(address => mapping(address => uint256)) public allowance;

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);

    constructor(string memory _name, string memory _symbol) {
        name = _name;
        symbol = _symbol;
        uint256 initialSupply = 1_000_000 * 10 ** decimals;
        totalSupply = initialSupply;
        balanceOf[msg.sender] = initialSupply;
        emit Transfer(address(0), msg.sender, initialSupply);
    }

    function transfer(address to, uint256 value) external returns (bool) {
        require(balanceOf[msg.sender] >= value, "Insufficient balance");
        balanceOf[msg.sender] -= value;
        balanceOf[to] += value;
        emit Transfer(msg.sender, to, value);
        return true;
    }

    function approve(address spender, uint256 value) external returns (bool) {
        allowance[msg.sender][spender] = value;
        emit Approval(msg.sender, spender, value);
        return true;
    }

    function transferFrom(address from, address to, uint256 value) external returns (bool) {
        require(balanceOf[from] >= value, "Insufficient balance");
        require(allowance[from][msg.sender] >= value, "Allowance exceeded");
        allowance[from][msg.sender] -= value;
        balanceOf[from] -= value;
        balanceOf[to] += value;
        emit Transfer(from, to, value);
        return true;
    }
}

In Remix, compile MyToken.sol. In the Deploy panel you will see a constructor with two inputs, enter your token name (e.g. My Token) and symbol (e.g. MTK), then click Deploy and confirm in MetaMask. After one block, your token contract is live on AERE mainnet.

Security note: This is a minimal implementation for learning. Production tokens should use a battle-tested library such as OpenZeppelin's ERC20.sol, which handles edge cases (overflow, approval race conditions) and has been extensively audited.

Module 6, Verifying on the Block Explorer

Verifying a contract means uploading the Solidity source code to the block explorer so that anyone can read exactly what the contract does. Verified contracts also become callable directly from the explorer's UI.

Find your deployed contract

After deploying, copy the contract address from Remix's "Deployed Contracts" section. Open explorer.aere.network and paste the address into the search bar. You will see the contract's transaction history and, under the "Contract" tab, the raw bytecode.

Submit source for verification

  1. On the contract page, click the Contract tab, then Verify & Publish.
  2. Select: Compiler type → Solidity (Single file), Compiler version → 0.8.20, Open source license → MIT.
  3. Paste your full Solidity source into the editor. Make sure the pragma version matches exactly.
  4. If you deployed with constructor arguments (like the token name and symbol), the explorer will ask you to provide the ABI-encoded constructor arguments. Remix displays these in its transaction details, copy the hex string beginning after 0x.
  5. Click Verify and Publish.

The explorer compiles the source server-side and checks that the resulting bytecode matches what was deployed. If it matches, a green checkmark appears on the contract page, and the ABI is published so anyone can call your functions directly from the browser.

Verification is optional but strongly recommended. Unverified contracts are opaque to users and auditors, a verified contract signals that you have nothing to hide and makes your project far more trustworthy.

Module recap

  • Solidity contracts are compiled to EVM bytecode and run identically on every node.
  • Remix is a browser IDE, no installation needed; connect via MetaMask to deploy to AERE.
  • Always confirm MetaMask shows "Custom (2800) network" before deploying.
  • State-changing functions cost gas; view and pure functions are free to call.
  • ERC-20 is the standard fungible token interface, wallets and exchanges recognize it automatically.
  • Verifying your contract on the explorer publishes the source and ABI for public inspection.
← Back to AERE Academy