The Programming
Language |

Sway is a domain-specific language for the FuelVM. Write fast, safe, and efficient smart contracts with Rust-like syntax.

contract;

abi Counter {
    #[storage(read, write)]
    fn increment(amount: u64) -> u64;

    #[storage(read)]
    fn get() -> u64;
}

storage {
    counter: u64 = 0,
}

impl Counter for Contract {
    #[storage(read, write)]
    fn increment(amount: u64) -> u64 {
        let incremented = storage.counter.read() + amount;
        storage.counter.write(incremented);
        incremented
    }

    #[storage(read)]
    fn get() -> u64 {
        storage.counter.read()
    }
}

Why Choose Sway?

Purpose-built for the next generation of blockchain applications

Built for Safety

Memory safety without garbage collection, preventing common smart contract vulnerabilities.

Optimized Performance

Compiled directly to Fuel VM bytecode for maximum efficiency and minimal gas costs.

Developer Experience

Familiar Rust-like syntax with powerful tooling, testing, and debugging capabilities.

What Sets Sway Apart
Built from the ground up for modern blockchain development
Zero-cost abstractions
Compile-time safety checks
Native UTXO model support
Parallel transaction execution
Advanced type system
Comprehensive testing framework

Powerful Features

Everything you need to build secure, efficient, and scalable smart contracts

Provides TypeSafety

It is a statically typed, compiled language with type inference and traits.

High Performance

Built for the Fuel Virtual Machine with optimal gas efficiency and fast execution times.

Memory Safe

Rust-inspired syntax with compile-time memory safety checks and zero-cost abstractions.

Developer Friendly

Familiar syntax for Rust developers with powerful tooling and comprehensive documentation.

Fuel VM Native

Purpose-built for Fuel's high-performance virtual machine with native UTXO support.

Rich Toolchain

Complete development ecosystem with compiler, debugger, and testing framework.

Built for the FuelVM

Get Started in Minutes

From zero to deployed smart contract in just a few simple steps

01
Install Sway
Get up and running with the Sway toolchain
02
Learn the Basics
Follow our comprehensive tutorial and examples
03
Build & Deploy
Create your first smart contract on Fuel

Quick Install

curl -fsSL https://install.fuel.network | sh

Installs fuelup, Forc CLI, and all development tools

Dive right in

Start building with Sway instantly in your browser, or migrate from Solidity with zero friction.

Sway Playground
A full-featured browser IDE where you can write, deploy, and interact with Sway contracts instantly.
Write and edit Sway code with syntax highlighting
Built-in Charcoal integration to input Solidity code and get Sway code.
Deploy contracts to testnet with one click
Interact with deployed contracts directly
Share your projects with the community
Launch playground
🔄
Charcoal Transpiler
Seamlessly migrate your Solidity contracts to Sway with our intelligent transpiler.
Automatic Solidity to Sway conversion
Preserves contract logic and structure
Integrated into Sway Playground
Reduces migration friction significantly
// Paste your Solidity code → Get Sway output ✨
GitHub
View on GitHub

Forc toolchain

The complete toolkit for Sway development. Build, test, and deploy with ease.

Build system
Cargo-inspired build system with dependency management and workspace support.
$ forc new my-contract
$ forc build
$ forc test
Development tools
Integrated testing, formatting, and deployment tools for a smooth developer experience.

Essential Sway Libraries

Battle-tested libraries and utilities that power the Sway ecosystem. From security primitives to core data structures, these packages accelerate your smart contract development.

Asset

Core
Comprehensive asset management with minting, burning, and transfer controls
5.1k

Pausable

Security
Emergency stop mechanism to halt contract operations when needed
5.1k

Signed Integers

Math
Full support for signed integer arithmetic in Sway contracts
5.1k

Reentrancy Guard

Security
Protection against reentrancy attacks with simple API
4.8k

Merkle

Cryptography
Efficient Merkle tree verification for whitelists and proofs
3.2k

Upgradability

Infrastructure
Proxy patterns for upgradeable smart contracts
2.9k

Sway Standards

Community-driven standards for interoperability and best practices.

SRC standards
Sway Request for Comments - defining token standards, interfaces, and protocols.
Style guide
Coding conventions and best practices for writing clean, maintainable Sway code.
• Naming conventions
• Code organization
• Documentation standards
• Security best practices

Sway Registry

Add libraries and standards to your project seamlessly from the registry.

forc.pub - The central registry for Sway packages and libraries.

forc.pub
Discover, share, and manage Sway packages with the community.
📥

Install packages

forc add <package-name>

Add any library or standard to your Sway project instantly.

📤

Publish packages

forc publish

Share your own libraries with the Sway community.