Smart Contracts

Smart contracts can be deployed on the Mainsail blockchain using Solidity, along with standard Ethereum development frameworks such as Hardhat or Foundry. This guide provides the key information required to deploy contracts on Mainsail networks.

Network Configuration

Use the following details to configure your development environment for each supported Mainsail network:

NetworkChainIDRPCExplorer
Mainnet11811TBATBA
Testnet11812https://testnet.mainsailhq.com/rpchttps://explorer-demo.mainsailhq.com/
Devnet10000http://localhost:4007-

Deployment Guide

Follow the steps below to deploy smart contracts to the Mainsail network using either Hardhat or Foundry.


1. Install a Development Framework

Select a Solidity development framework to get started. We recommend:


2. Acquire Funds

To deploy contracts, your wallet must be connected to the Mainsail network and funded with ARK.

  • For Public Testnet, you can use the official faucet to obtain test ARK.
  • For Local Devnet, you may use any of the provided genesis wallets.

3. Configure Your Environment

Before deployment, ensure your environment is correctly configured for the Mainsail network.

For Foundry:

Add the Mainsail network settings to your foundry.toml (see table above for RPC/ChainId):

[profile.mainsail]
rpc_url = "https://testnet.mainsailhq.com/rpc"
chain_id = 11812

For Hardhat:

Add the Mainsail network configuration to your hardhat.config.js (see table above for RPC/ChainId):

module.exports = {
  networks: {
    mainsail: {
      url: 'https://testnet.mainsailhq.com/rpc',
      chainId: 11812,
    },
  },
}

4. Deploy Your Contract

Using Foundry:

From your project directory, run:

forge create src/{MyContract}.sol:{MyContract} \
  --profile mainsail \
  --private-key {PrivateKey}

Using Hardhat:

Create a deploy script in the scripts/ folder (e.g., scripts/deploy.js), then run:

npx hardhat run scripts/deploy.js --network mainsail

Further Resources

For more in-depth usage refer to the official documentation: