Skip to main content

Solidity Developer Guide

Prerequisites

Before getting started, make sure to install the following:

*Foundry

Install Foundry

Install Foundry

curl -L https://foundry.paradigm.xyz | bash

Update Foundry

foundryup

reference:

https://book.getfoundry.sh/getting-started/installation

Start Foundry Project

Generate Foundry file in your current directory

forge init 

Start Solidity Contract

In folder

src

create a new file called

Contract.sol

and copy the contract below:

// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

contract SimpleStorage {

uint256 public storedData; //Do not set 0 manually it wastes gas!

event setEvent();

function set(uint256 x) public {
storedData = x;
emit setEvent();
}

}

Deploy and Verify

warning

Note: Blockscout verification might fail during deployment. If this happens, verify the contract after it is deployed.

forge create src/Contract.sol:SimpleStorage \
--private-key $devTestnetPrivateKey \
--rpc-url https://rpc.dev.gblend.xyz/ \
--broadcast \
--verify \
--verifier blockscout \
--verifier-url https://blockscout.dev.gblend.xyz/api/

Verify Contract Already Deployed

info

Replace variable

<contract_address>

with the deployed contract address on Fluent testnet.

forge verify-contract \
--rpc-url https://rpc.dev.gblend.xyz/ \
<contract_address> \
src/Contract.sol:SimpleStorage \
--verifier blockscout \
--verifier-url https://blockscout.dev.gblend.xyz/api/