# Deploy your First Smart Contract on Beta-4!

By [alexprimak](https://paragraph.com/@alexprimak) · 2024-01-08

---

Hey there guys,more than 3 month ago I made a tutorial about deploying Smart Contract on Fuel,and I saw that some of you are facing issues with deploying it,so I decided to update the guide!In the coming weeks you’ll see more interesting content about Fuel!

So no more words!Let’s do this!

Open your Terminal in Ubuntu or Mac (Windows is no officially supported for now)

### 1.1 We need to update and then install git

    sudo apt update && sudo apt upgrade -y
    

    sudo apt-get install git-all
    

Press `Y`

Now lets install `curl`

    sudo apt-get install curl
    

### 1.2 Installing Rust Toolchain

As Sway language was inspired by Rust,we also need to install Rust toolchain

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    

Press `1` to process default installationThen

    source "$HOME/.cargo/env"
    

After that, we need to remove old files

    cd $home && rm -rf .fuel && rm -rf .forc && rm -rf .fuelup && rm -rf fuel-project
    

And then,install Fuel Toolchain

    curl --proto '=https' --tlsv1.2 -sSf https://install.fuel.network/fuelup-init.sh | sh
    

Press `Y`

**(btw if you are insterested I have a** [**guide**](https://mirror.xyz/0x65B48f58f49Ab335169844F9F75f3Cb3fE848483/JcJvx8loxVqvjIlaZk_h9R-KRe28GoglkQLp2s4MoAw) **how to install _Fuel Toolchain_)**

`Close and open your terminal again,so the toolchain will be available in your shell`

### **1.3 Let’s update and set beta-4 as a default.**

Just paste this commands 1 by 1.

    fuelup self update
    

![Expected output](https://storage.googleapis.com/papyrus_images/167096753cd674f091b81dc9dc830224839b784b00eef22dbef7d07547252181.png)

Expected output

    fuelup default beta-4
    

![Expected output](https://storage.googleapis.com/papyrus_images/f7909fad808b2100a72203db0dee3d021957a9e76bfaaac868bbabcf3c90c7d4.png)

Expected output

**You can check your fuelup version by just typing**

    fuelup --version
    

### **1.4 Creating your Smart-Contract**

Create folder

    mkdir fuel-project
    

Then move into it

    cd fuel-project
    

Then we create a contract project using forc:

    forc new counter-contract
    

![Don't worry,this is normal output](https://storage.googleapis.com/papyrus_images/1fc54cdb2546c1fb7c980212ba7a47c686c91795d845a169ba5b20fe19336d4c.png)

Don't worry,this is normal output

`Then we need to edit out main.sw file (we will make it simple with just nano,you can use VS code if you like)`

    nano counter-contract/src/main.sw
    

**So now delete everything that is inside the file**

And replace with this:

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

Every Sway file must start with a declaration of what type of program the file contains; here, we've declared that this file is a contract.In our case as you can see this is **contract;**

_Once you’ve done it:_

Press `Ctrl + X`

Then `Y`

Then `Enter`

### **1.5 Build your contract**

Move to the folder of your created project

    cd counter-contract
    

Now it’s time to build your contract

_I’ll just leave you a_ [_link_](https://docs.fuel.network/guides/quickstart/building-a-smart-contract/) _to the official guide - where you can check out how to test your contract and how to check out thee view of your project_

### **1.6 Setup or Import your wallet**

*   If you already have a fuel-wallet(like in my case - btw you can set up it [here](https://wallet.fuel.network/docs/install/)):
    

Just write that command

    forc-wallet import
    

You’ll be asked to write 12 words - your _seed and create a password to protect your wallet._

Then write

    forc wallet account new
    

And one more time you’ll be asked to write a password that you’ve created.

*   If you don’t have an account:
    

You can create a new wallet with the command below:

    forc wallet new
    

Create a password to protect your wallet and make sure to save your seed.

Next, create a new wallet account with:

    forc wallet account new
    

By that command you can check list of your wallets:

    forc wallet accounts
    

As you can see I only have 1 account with that address

### **1.7 Faucet some funds**

To deploy your contract on the network - you need some Test Eth.You can faucet it [here](https://faucet-beta-4.fuel.network/).

### **1.8 Deploy Contract**

And now it’s finally time to deploy your contract on the Fuel Network

    forc deploy --testnet
    

![](https://storage.googleapis.com/papyrus_images/8dc380086d1e1a7e535481a4b6f31a49b421e1ed948d3cc2f68af1abc6512dea.png)

You’ll be asked to enter your password again

![type your password](https://storage.googleapis.com/papyrus_images/e5b3c3226ac8adba1a4e30abec3f904770f7f57d7d2d6040ef207fa793b79bfb.png)

type your password

Once you’ve entered a password,you’ll see your accounts(in my case there is only 1 account - its number is `0` )

Select number of your account and then type `y`

### **And congratulations!!!**

You can see your Contract ID - which you need to save here as we will need it in the next steps!But I want to congratulate you - you’ve deployed your first contract on **Beta-4.**

### **1.9 Check our contract in the block explorer**

You can see your contract in the block explorer [here](https://fuellabs.github.io/block-explorer-v2/) (if it doesn’t appear - don’t worry,explorer doesn’t show most of the transactions right now but the team I’m sure is working on it!

Anyway don’t forget to tweet that you’ve built a smart-contract on Fuel,tagging `@fuel_network`

![](https://storage.googleapis.com/papyrus_images/a50c6ad7995a92ebe6e85a2672af792a3cbd21454c6147e0ef47f1d968f7e11d.png)

---

*Originally published on [alexprimak](https://paragraph.com/@alexprimak/deploy-your-first-smart-contract-on-beta-4)*
