Getting Started¶
This page takes you from installing sun to a compiled, tested project in a few
minutes. For the full command reference see CLI Commands; for the
narrated end-to-end tour, see the home page.
Requirements¶
- Go 1.26+ (only to install/build the binary — your contracts need no Go).
- Nothing else.
sundownloads and checksum-verifies the pinned solc-tron and aderyn binaries on first use.
Install¶
Make sure $(go env GOPATH)/bin is on your PATH. Check the install with
sun --version.
Download a static binary for your platform from the
Releases page (available
since v0.1.0) and verify it against the published SHA256SUMS.
Quickstart¶
1. Scaffold a project¶
This writes a Foundry-like layout: src/, test/, script/, lib/, and a
sail.toml with the pinned compiler and the mainnet / nile networks
preconfigured. See Configuration for the full sail.toml schema.
2. Compile¶
The first run downloads and verifies the pinned solc-tron (you'll see a
downloading solc … / verified … line); subsequent runs serve unchanged units
from the depfile cache. See Compilation.
3. Test¶
Tests are plain Solidity under test/*.t.sol and run on the local TVM with
cheatcodes from sail.sol (sail.prank, sail.deal, sail.expectRevert, …).
Add --fork-url nile to run them over live network state. See
Testing and Forking.
Going to the network¶
Everything above is fully offline. When you're ready to touch Nile:
# Provide a funded Nile key via the environment or a git-ignored .env file.
# The key is only ever read from PRIVATE_KEY and never appears in any output.
export PRIVATE_KEY=...
sun script script/Deploy.s.sol --network nile # print the plan (no broadcast)
sun script script/Deploy.s.sol --network nile --broadcast # deploy for real
sun script builds the actual signed transaction sequence — tx N's txid feeds tx
N+1's addresses — so the planned costs equal the on-chain receipts exactly. See
Scripting & Deployment.
Once a contract is deployed, estimate the cost of calling it:
Estimate needs a deployed address
sun estimate reports the cost of calling a contract that is already on the
network — it takes an on-chain address, not a local artifact. Deploy first
(e.g. with sun script --broadcast), then estimate.
Next steps¶
- CLI Commands — every command and its flags.
- Scripting & Deployment — the plan/broadcast model.
- TVM & Energy Model — how metering is validated ±0 against java-tron.
- Architecture — the design, invariants, and errata.