Developer Quickstart
Deploy your first smart contract on Monolythium in 30 minutes. This guide uses Foundry and the Monolythium testnet.
Prerequisites
- A terminal with
curlandgit - Basic Solidity knowledge
- An EVM wallet (MetaMask or the Monolythium Browser Wallet)
Step 1: Install Foundry
curl -L https://foundry.paradigm.xyz | bash
foundryup
Verify the installation:
forge --version
cast --version
Step 2: Create a Project
forge init my-monolythium-project
cd my-monolythium-project
Step 3: Configure for Monolythium Testnet
Replace the contents of foundry.toml:
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
solc_version = "0.8.20"
optimizer = true
optimizer_runs = 200
evm_version = "paris"
[rpc_endpoints]
monolythium_testnet = "https://evm.testnet.mononodes.xyz"
[etherscan]
monolythium_testnet = { key = "", url = "https://testnet.monoscan.xyz/api", chain = 6940 }
Monolythium is an Ethermint-based chain and does not support the PUSH0 opcode. Always set evm_version = "paris". Using shanghai or later will cause deployment failures.
Step 4: Get Testnet LYTH
You need testnet LYTH to pay for gas. Visit the faucet:
- Go to monohub.xyz/faucet
- Connect your wallet or paste your address
- Click Request LYTH
The faucet will send testnet LYTH to your address within seconds. See Get LYTH for more details.
Step 5: Write a Contract
Replace the contents of src/Counter.sol with a simple greeting contract:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract Greeter {
string public greeting;
address public owner;
event GreetingChanged(string oldGreeting, string newGreeting);
constructor(string memory _greeting) {
greeting = _greeting;
owner = msg.sender;
}
function setGreeting(string calldata _newGreeting) external {
require(msg.sender == owner, "only owner");
string memory old = greeting;
greeting = _newGreeting;
emit GreetingChanged(old, _newGreeting);
}
}
Build the contract:
forge build
Step 6: Deploy to Testnet
Export your private key (never commit this to source control):
export PRIVATE_KEY=your_private_key_here
Deploy with the --legacy flag (required for Monolythium):
forge create --rpc-url monolythium_testnet \
--private-key $PRIVATE_KEY \
--legacy \
src/Counter.sol:Greeter \
--constructor-args "Hello, Monolythium!"
Monolythium does not support EIP-1559 dynamic fee transactions. You must use the --legacy flag for all Foundry on-chain commands (forge create, forge script, cast send).
On success, you will see output like:
Deployer: 0xYourAddress...
Deployed to: 0xYourContractAddress...
Transaction hash: 0xYourTxHash...
Save the deployed contract address for the next steps.
Step 7: Interact with Your Contract
Read the greeting:
cast call --rpc-url https://evm.testnet.mononodes.xyz \
0xYourContractAddress \
"greeting()(string)"
Update the greeting:
cast send --rpc-url https://evm.testnet.mononodes.xyz \
--private-key $PRIVATE_KEY \
--legacy \
0xYourContractAddress \
"setGreeting(string)" "Hello from Monolythium!"
Step 8: Verify on Monoscan
Verify the contract source code on the testnet block explorer:
forge verify-contract 0xYourContractAddress \
src/Counter.sol:Greeter \
--chain-id 6940 \
--verifier-url https://testnet.monoscan.xyz/api \
--constructor-args $(cast abi-encode "constructor(string)" "Hello, Monolythium!")
Once verified, view your contract at:
https://testnet.monoscan.xyz/address/0xYourContractAddress
Quick Reference
| Item | Value |
|---|---|
| Testnet RPC | https://evm.testnet.mononodes.xyz |
| Chain ID | 6940 |
| EVM Version | paris |
| Explorer | https://testnet.monoscan.xyz |
| Faucet | https://monohub.xyz/faucet |
| Native Token | LYTH (18 decimals) |
| Transaction Type | Legacy only (--legacy flag) |
What's Next
- Chain Configuration -- Full network parameters and wallet setup
- Hardhat & Foundry -- Advanced tooling, testing, CI/CD
- Contract Verification -- Detailed verification guide
- Smart Contract Reference -- All deployed protocol contracts