Browse DIDLab Docs

Smart contracts

Your first DIDLab smart contract

Before deploying, understand what the code actually does. This example is intentionally small: one state value, one state-changing transaction, one read-only call, and one event.

contracts/SimpleStorage.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

contract SimpleStorage {
    uint256 private value;

    event ValueChanged(uint256 value, address indexed changedBy);

    function set(uint256 newValue) external {
        value = newValue;
        emit ValueChanged(newValue, msg.sender);
    }

    function get() external view returns (uint256) {
        return value;
    }
}

State

value is stored in contract storage and remains there between transactions.

Validation profile

Network

DIDLab Blockchain

Chain ID

252501

Client

Hyperledger Besu

Consensus

QBFT

Native asset

TRUST

Platform token

TT (ERC-20)

Solidity examples

0.8.24

Last validated

August 2026

Go deeper in DIDLab Labs

Public documentation explains the workflow and expected result. Authenticated DIDLab Labs adds managed workspaces, deeper exercises, checkpoints, evidence capture, and instructor assessment.

Open DIDLab Labs

Write transaction

set(...) changes blockchain state, so it must be signed and mined.

Validation profile

Network

DIDLab Blockchain

Chain ID

252501

Client

Hyperledger Besu

Consensus

QBFT

Native asset

TRUST

Platform token

TT (ERC-20)

Solidity examples

0.8.24

Last validated

August 2026

Go deeper in DIDLab Labs

Public documentation explains the workflow and expected result. Authenticated DIDLab Labs adds managed workspaces, deeper exercises, checkpoints, evidence capture, and instructor assessment.

Open DIDLab Labs

Read call

get() is view-only. Reading it does not create a transaction or spend gas from your wallet.

Validation profile

Network

DIDLab Blockchain

Chain ID

252501

Client

Hyperledger Besu

Consensus

QBFT

Native asset

TRUST

Platform token

TT (ERC-20)

Solidity examples

0.8.24

Last validated

August 2026

Go deeper in DIDLab Labs

Public documentation explains the workflow and expected result. Authenticated DIDLab Labs adds managed workspaces, deeper exercises, checkpoints, evidence capture, and instructor assessment.

Open DIDLab Labs

Event

ValueChanged creates a log that applications and explorers can query after the transaction.

Validation profile

Network

DIDLab Blockchain

Chain ID

252501

Client

Hyperledger Besu

Consensus

QBFT

Native asset

TRUST

Platform token

TT (ERC-20)

Solidity examples

0.8.24

Last validated

August 2026

Go deeper in DIDLab Labs

Public documentation explains the workflow and expected result. Authenticated DIDLab Labs adds managed workspaces, deeper exercises, checkpoints, evidence capture, and instructor assessment.

Open DIDLab Labs

The two interactions to remember

set(42)

Requires a wallet signature, consumes gas, produces a transaction hash, is included in a block, updates state, and emits an event.

get()

Reads the current value using a call. No wallet approval is needed for a normal read-only request.

What is the ABI?

The Application Binary Interface describes the callable functions and events of a compiled contract. Frontends use it to encode calls such as set(42) and decode results such as get().

Public scope

This page stops at the interaction model. ABI encoding internals, testing patterns, security extensions, and debugging exercises belong in the deeper DIDLab Labs course.

Deploy this exact contract

Choose the workflow that matches your goal. Remix is fastest for a first deployment; Hardhat is the better bridge toward professional local development.