Skip to content

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. sun downloads and checksum-verifies the pinned solc-tron and aderyn binaries on first use.

Install

go install github.com/sailor-labs/sunsail/cmd/sun@latest

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.

git clone https://github.com/sailor-labs/sunsail
cd sunsail
make build            # ./out/sun for the host platform

Quickstart

1. Scaffold a project

sun init dapp && cd dapp

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

sun 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

sun test -v            # results
sun test -vvv          # full call tree with decoded events and source-mapped traces

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:

sun estimate <deployed-address> "sail(uint256)" 9 --network nile

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