Skip to content

Deploy a contract

16ane runs the Ethereum Virtual Machine unchanged, so contracts and tools need no changes. This uses Foundry; Hardhat, viem and ethers work the same way with the RPC URL and chain ID from Network details.

foundry.toml
[profile.default]
src = "src"
src/Counter.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.28;
contract Counter {
uint256 public number;
function increment() external {
number += 1;
}
}

Use a key funded from the faucet. Keep keys out of your shell history and repositories; for anything long-lived use cast wallet import and --account instead.

Terminal window
export ETH_RPC_URL=https://rpc.testnet.16ane.net
forge create src/Counter.sol:Counter --private-key "$PRIVATE_KEY" --broadcast
# Deployed to: 0x…
Terminal window
cast send <address> "increment()" --private-key "$PRIVATE_KEY"
cast call <address> "number()(uint256)"
# 1

Then open the address on explorer.16ane.net: the deployment reads “created a contract”, and each increment() shows as a call with its network fee.

Fees are paid in ANE, priced like Ethereum’s (EIP-1559): a base fee that is burned, plus an optional tip to the validator. On a quiet testnet the base fee is a few wei per gas, so a deployment costs a tiny fraction of one ANE. See ANE and network fees.