Developer Reference
Smart Contract Deployment
Pre-launch
Section
Developer Reference
Documentation category
Type
Guide
Technical reference
Summary
Complete Hardhat and Foundry deployment walkthrough for SwssChain: prerequisites, configuration, deployment scripts, and Explorer verification.
SWSS Foundation Notice

This documentation is restricted to authorised members of the SWSS Developer Community. Access is granted exclusively through SWSS DevHub, after KYB and SWSS Foundation approval.

All SwssChain GitHub repositories are private. Significant updates are currently deploying across the full SWSS Ecosystem. SDK and API specifications are subject to change at any time in accordance with security requirements and SwssChain Foundation governance decisions.

Join SWSS DevHub →Have a question? Use the Need Help? button below.
SDK Update Notice

SWSS SDK v2.1 is deploying across the ecosystem. API signatures may change during this period. Ensure your integration uses the latest schema from SWSS DevHub.

Article Content
Testnet Access: SWSS DevHub Required

Access to SwssChain testnet 122606 is limited to developers the SWSS Foundation has approved. Credentials, endpoints and testnet allocation are issued together on approval: see how access is granted. Testnet access is not publicly open.

Smart Contract Deployment

Deploying smart contracts on SwssChain is identical to deploying on Ethereum mainnet. Any deployment workflow that works on Ethereum works on SwssChain. The only required change is the network configuration targeting Chain ID 122605. Gas fees are denominated in SWSS Coin rather than ETH: ensure your deployer wallet holds SWSS Coin before deployment.

Prerequisites

  • SWSS DevHub account with mainnet or testnet RPC endpoint credentials
  • Deployer wallet funded with SWSS Coin for gas fees (testnet SWSS available free via DevHub faucet)
  • Solidity contract targeting Cancun EVM (Solidity 0.8.20 or above recommended)
  • Hardhat or Foundry installed in your project

Hardhat Deployment: Full Walkthrough

Step 1: Install dependencies

npm install --save-dev hardhat @nomicfoundation/hardhat-toolbox dotenv

Step 2: Configure hardhat.config.ts

import { HardhatUserConfig } from 'hardhat/config';
import '@nomicfoundation/hardhat-toolbox';
import * as dotenv from 'dotenv';
dotenv.config();

const config: HardhatUserConfig = {
  solidity: '0.8.24',
  networks: {
    swsschain: {
      url: process.env.SWSSCHAIN_RPC_URL!,
      chainId: 122605,
      accounts: [process.env.PRIVATE_KEY!]
    },
    swsschain_testnet: {
      url: process.env.SWSSCHAIN_TESTNET_RPC_URL!,
      chainId: 122606,
      accounts: [process.env.PRIVATE_KEY!]
    }
  }
};

export default config;

Step 3: Write a deployment script

// scripts/deploy.ts
import { ethers } from 'hardhat';

async function main() {
  const [deployer] = await ethers.getSigners();
  console.log('Deploying with account:', deployer.address);

  const balance = await ethers.provider.getBalance(deployer.address);
  console.log('Account balance (SWSS):', ethers.formatEther(balance));

  const MyContract = await ethers.getContractFactory('MyContract');
  const contract = await MyContract.deploy();
  await contract.waitForDeployment();

  const address = await contract.getAddress();
  console.log('Contract deployed to:', address);
}

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

Step 4: Deploy to SwssChain

# Deploy to testnet first
npx hardhat run scripts/deploy.ts --network swsschain_testnet

# Deploy to mainnet
npx hardhat run scripts/deploy.ts --network swsschain

Step 5: Verify on Explorer

Navigate to swssscan.swss.io, search your deployment transaction hash, and confirm the contract creation is recorded. SwssChain Explorer supports contract source code verification at swssscan.swss.io/verify: upload your source and ABI to make the contract code publicly readable.

Foundry Deployment

forge create   --rpc-url $SWSSCHAIN_RPC_URL   --private-key $PRIVATE_KEY   src/MyContract.sol:MyContract

Important Notes for SwssChain Deployment

  • Block time is 1 second: waitForDeployment() typically resolves within 2 to 3 seconds
  • Gas is denominated in SWSS Coin: gas price mechanics are otherwise identical to EIP-1559
  • All OpenZeppelin contracts deploy unchanged: ERC-20, ERC-721, ERC-1155, Governor, and proxy patterns require no modifications
  • Deed transaction types require DevHub registration: standard smart contracts deploy freely without any additional approval

Next Steps

Block Time and Time-Derived Constants

Contracts that use block numbers as a proxy for elapsed wall-clock time must be written against SwssChain's block time. A period of 86,400 blocks corresponds to approximately twenty-four hours on SwssChain, and a constant carried over from a network with a different block time will be wrong by the ratio between them. This is the most common source of incorrect timing behaviour in contracts ported to SwssChain.