Fuel Testnet Contract Deploy Guide
Transactions made here do not guarantee any rewards. Think of these actions as actions you will take to improve yourself.
Here it is explained how you can deploy a contract with GitHup Codespaces.
Video
You can make your transactions by following the video below.
First, we obtain root permission with the code below and continue the process in this way.
sudo su
Updating the System and Installing Required Libraries
apt update
apt upgrade -y
apt-get install curl git screen -y
Installing the Rust
curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
You can check the version.
rustc --version
Installing the Stable Version, Update and Default Set up
rustup install stable
rustup update stable
rustup default stable
Installing the Fuel
curl https://install.fuel.network | sh
source /root/.bashrc
Installing and Updating the Fuel Toolchain
fuelup toolchain install latest
fuelup self update
fuelup update && fuelup default latest
Creating the Contract
mkdir fuel-project && cd fuel-project
forc new counter-contract
main.sw Dosyasını Düzenleme
nano counter-contract/src/main.sw
Open the file and delete everything in it, then paste the codes below, save and exit with CTRL, X, Y and Enter.
- Codes for main.sw file
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);
}
}
Preparing the Contract
cd counter-contract
forc build
Wallet
Importing an Existing Wallet
forc wallet import
If the above code gives an error, use the code below.
forc-wallet import
Creating a New Wallet
forc wallet account new
If the above code gives an error, use the code below.
forc-wallet new
Don't forget to keep your wallet words in a safe place.
Musluk
Kontar deploy etmek için cüzdanımızda test ETH olması gerekiyor. Token almak için faucetsayfasına gidin.
Creating the Contract
After entering the code below, first type 0
and enter, and then type y
and enter.
forc deploy --testnet
You can check the TX Hash given in the output from Fuel Explorer.