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:
Network | ChainID | RPC | Explorer |
---|---|---|---|
Mainnet | 11811 | TBA | TBA |
Testnet | 11812 | https://testnet.mainsailhq.com/rpc | https://explorer-demo.mainsailhq.com/ |
Devnet | 10000 | http://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
There are multiple ways to find the contract address after deployment:
If you used Foundry, it is shown in the logs:
Deployed to: 0xABC123...
Alternatively, you can always look up the receipt by transaction hash via Mainsail API:
curl -X GET "http://testnet.mainsailhq.com/api/receipts?txHash=01234" | jq '.contractAddress'
0xABC123...
Further Resources
For more in-depth usage refer to the official documentation: