Skip to content
Beginner

IntroductionΒΆ

ERC-20 tokens are fungible tokens commonly used for creating cryptocurrencies, governance tokens, and staking mechanisms. Polkadot Hub enables easy token deployment with Ethereum-compatible smart contracts and tools via the EVM backend.

This tutorial covers deploying an ERC-20 contract on Polkadot Hub TestNet using Remix IDE, a web-based development tool. The ERC-20 contract can be retrieved from OpenZeppelin's GitHub repository or generated with the OpenZeppelin Contracts Wizard for Polkadot.

PrerequisitesΒΆ

Before you begin, ensure you have:

Create Your ContractΒΆ

Follow the steps below to create the ERC-20 contract:

  1. Navigate to Remix IDE in your web browser.
  2. Select the Create new file button under the contracts folder, and name your contract MyToken.sol.

  3. Now, paste the following ERC-20 contract code into MyToken.sol:

    MyToken.sol
    // SPDX-License-Identifier: MIT
    // Compatible with OpenZeppelin Contracts ^5.4.0
    pragma solidity ^0.8.27;
    
    import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
    import {ERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";
    import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
    
    contract MyToken is ERC20, Ownable, ERC20Permit {
        constructor(address initialOwner)
            ERC20("MyToken", "MTK")
            Ownable(initialOwner)
            ERC20Permit("MyToken")
        {}
    
        function mint(address to, uint256 amount) public onlyOwner {
            _mint(to, amount);
        }
    }
    

    Tip

    The OpenZeppelin Contracts Wizard for Polkadot was used to generate this example ERC-20 contract. Use it to customize and generate your own ERC-20, ERC-721, or other OpenZeppelin-standard contracts for Polkadot Hub.

Compile the ContractΒΆ

Solidity source code compiles into bytecode that can be deployed on the blockchain. During this process, the compiler checks the contract for syntax errors, ensures type safety, and generates the machine-readable instructions needed for blockchain execution.

Ensure your MyToken.sol contract is open in the Remix IDE Editor, and use the following steps to compile:

  1. Select the Solidity Compiler plugin from the left panel.
  2. Select the Compile MyToken.sol button.

The Solidity Compiler icon will display a green checkmark once the contract compiles successfully. If any issues arise during contract compilation, errors and warnings will appear in the terminal panel at the bottom of the screen.

Deploy the ContractΒΆ

Follow these steps to deploy the contract using Remix:

  1. Select Deploy & Run Transactions from the left panel.
  2. Ensure your MetaMask wallet is connected to Polkadot Hub TestNet, then select the Environment dropdown and select Injected Provider - MetaMask.
  3. Configure the contract parameters by entering the address that will own the deployed token contract.
  4. Select the Deploy button to initiate the deployment.
  5. Approve the transaction in your MetaMask wallet when prompted.
  6. You will see the transaction details in the terminal when the deployment succeeds, including the contract address and deployment transaction hash.

Once successfully deployed, your contract will appear in the Deployed Contracts section, ready for interaction.

Interact with the ContractΒΆ

Once deployed, you can interact with your contract through Remix. Find your contract under Deployed/Unpinned Contracts, and select it to expand the available methods. In this example, you'll mint some tokens to a given address using the following steps:

  1. Expand the mint function, then enter the recipient address and the amount (remember to add 18 zeros for one whole token).
  2. Select transact.
  3. Approve the transaction in your MetaMask wallet when prompted.
  4. You will see a green check mark in the terminal when the transaction is successful.
  5. You can also call the balanceOf function by passing the address of the mint call to confirm the new balance.

Feel free to explore and interact with the contract's other functions by selecting the method, providing any required parameters, and confirming the transaction in MetaMask when prompted.

Congratulations! You've successfully deployed an ERC-20 token contract to Polkadot Hub TestNet using Remix IDE. Consider the following resources to build upon your progress.

Where to Go NextΒΆ

  • Guide Deploy an NFT with Remix


    Walk through deploying an ERC-721 Non-Fungible Token (NFT) using OpenZeppelin's battle-tested NFT implementation and Remix.

    Get Started

Last update: February 13, 2026
| Created: January 14, 2026