Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
Prerequisites

Icon LinkPrerequisites

Icon LinkInstallation

To install the Fuel toolchain, you can use the fuelup-init script. This will install forc, forc-client, forc-fmt, forc-lsp, forc-wallet as well as fuel-core in ~/.fuelup/bin.

curl https://install.fuel.network | sh
Icon InfoCircle

Having problems? Visit the installation guide or post your question in our forum Icon Link.

If you're using VSCode, we recommend installing the Sway extension Icon Link.

Icon LinkAlready have fuelup installed?

If you already have fuelup installed, run the commands below to make sure you are on the most up-to-date toolchain.

fuelup self update
fuelup update
fuelup default latest

Icon LinkFuel Wallet

Our frontend application will allow users to connect with a wallet, so you'll need to have a browser wallet installed.

Before going to the next steps, install the Fuel Wallet Icon Link extension.

Once you've setup your wallet, click the "Faucet" button in the wallet to get some testnet tokens.

Additionally for this guide, ensure you're using Node.js/npm version 18.20.3 || ^20.0.0 || ^22.0.0. You can check your Node.js version with:

node -v

Icon LinkProject Setup

Start with a new empty folder and name it fuel-project.

mkdir fuel-project

Go into the fuel-project folder:

cd fuel-project

Within your terminal start by creating a new Sway project called contract:

forc new contract

Your project structure generated from the forc command should like this:

tree contract
contract
├── Forc.toml
└── src
    └── main.sw

1 directory, 2 files

Move into your contract folder:

cd contract

Open up the contract folder in VSCode, and inside the src folder you should see a file called main.sw. This is where you will write your Sway contract.

Since we're creating a brand new contract you can delete everything in this file except for the contract keyword.

contract;

The first line of the file is specifically reserved to inform the compiler whether we are writing a contract, script, predicate, or library. To designate the file as a contract, use the contract keyword.