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 LinkTestnet toolchain

To use the testnet toolchain, run the commands below:

fuelup self update
fuelup toolchain install testnet
fuelup default testnet

Icon LinkFuel Wallet

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

The current Fuel Wallet release can only be used with the beta-5 network. To use the new testnet, you must use the Fuel Development Wallet Icon Link.

You can get test funds for the testnet by visiting the Testnet Faucet Icon Link.

Additionally for this guide, ensure you're using Node.js/npm version 18.18.2 || ^20.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.