What you crave will soon be yours. What I crave is already mine.


What you crave will soon be yours. What I crave is already mine.

Subscribe to alexprimak

Subscribe to alexprimak
Share Dialog
Share Dialog
<100 subscribers
<100 subscribers
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)
sudo apt update && sudo apt upgrade -y
sudo apt-get install git-all
Press Y
Now lets install curl
sudo apt-get install curl
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 how to install Fuel Toolchain)
Close and open your terminal again,so the toolchain will be available in your shell
Just paste this commands 1 by 1.
fuelup self update

fuelup default beta-4

You can check your fuelup version by just typing
fuelup --version
Create folder
mkdir fuel-project
Then move into it
cd fuel-project
Then we create a contract project using forc:
forc new counter-contract

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
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 to the official guide - where you can check out how to test your contract and how to check out thee view of your project
If you already have a fuel-wallet(like in my case - btw you can set up it here):
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
To deploy your contract on the network - you need some Test Eth.You can faucet it here.
And now it’s finally time to deploy your contract on the Fuel Network
forc deploy --testnet

You’ll be asked to enter your password again

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
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.
You can see your contract in the block explorer here (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

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)
sudo apt update && sudo apt upgrade -y
sudo apt-get install git-all
Press Y
Now lets install curl
sudo apt-get install curl
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 how to install Fuel Toolchain)
Close and open your terminal again,so the toolchain will be available in your shell
Just paste this commands 1 by 1.
fuelup self update

fuelup default beta-4

You can check your fuelup version by just typing
fuelup --version
Create folder
mkdir fuel-project
Then move into it
cd fuel-project
Then we create a contract project using forc:
forc new counter-contract

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
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 to the official guide - where you can check out how to test your contract and how to check out thee view of your project
If you already have a fuel-wallet(like in my case - btw you can set up it here):
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
To deploy your contract on the network - you need some Test Eth.You can faucet it here.
And now it’s finally time to deploy your contract on the Fuel Network
forc deploy --testnet

You’ll be asked to enter your password again

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
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.
You can see your contract in the block explorer here (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

No activity yet