Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.teqoin.io/llms.txt

Use this file to discover all available pages before exploring further.

Deploy your first contract

Use this tutorial to deploy a simple Solidity contract to TeQoin with Hardhat. It is the fastest path from an empty folder to a working onchain contract.

Before you start

You need:
  • Node.js 20 or later
  • A wallet with test ETH
  • Access to the TeQoin RPC endpoint: https://rpc.teqoin.io
  • Chain ID 420377
If you still need funds, use the guidance in /resources/faucet.

Step 1: Create a Hardhat project

mkdir teqoin-first-contract
cd teqoin-first-contract
npm init -y
npm install --save-dev hardhat @nomicfoundation/hardhat-toolbox dotenv
npx hardhat init
Choose a basic JavaScript project when Hardhat prompts you.

Step 2: Add your wallet key

Create a .env file:
PRIVATE_KEY=your_private_key_without_quotes
Add .env to .gitignore before you continue.

Step 3: Configure the TeQoin network

Update hardhat.config.js:
require('@nomicfoundation/hardhat-toolbox');
require('dotenv').config();

module.exports = {
  solidity: '0.8.20',
  networks: {
    teqoin: {
      url: 'https://rpc.teqoin.io',
      chainId: 420377,
      accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : [],
    },
  },
};

Step 4: Write a simple contract

Create contracts/Counter.sol:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract Counter {
    uint256 public number;

    function increment() external {
        number += 1;
    }
}

Step 5: Compile

npx hardhat compile
Hardhat should generate artifacts without errors.

Step 6: Create the deploy script

Create scripts/deploy.js:
const { ethers } = require('hardhat');

async function main() {
  const Counter = await ethers.getContractFactory('Counter');
  const counter = await Counter.deploy();

  await counter.waitForDeployment();

  console.log('Counter deployed to:', await counter.getAddress());
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});

Step 7: Deploy to TeQoin

npx hardhat run scripts/deploy.js --network teqoin
Save the contract address from the terminal output. You will use it in your app and verification workflow.

Step 8: Confirm the deployment

Use cast or a quick script to call the contract:
cast call YOUR_CONTRACT_ADDRESS "number()(uint256)" --rpc-url https://rpc.teqoin.io
You should get 0 back from the first read.

Next steps