What we will build
A simple "timestamp register": it records any text once, and later anyone can see when that text was recorded. The same idea, with files instead of text, is the basis of document timestamping services. All you need for this guide is a browser.
Solidity at a glance
Solidity is the most common language for EVM contracts and looks a bit like JavaScript. A few ideas you will see in the code below:
contract: like a class; keeps data and functions together.mapping: a key-to-value table stored on chain.event: a message recorded in the transaction log that outside programs can follow.require: if the condition fails, the whole transaction reverts and nothing is recorded.msg.senderandblock.timestamp: the sender of the transaction and the block time.
The contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
contract Notary {
mapping(bytes32 => uint256) public registeredAt;
event Registered(bytes32 indexed hash, address indexed by, uint256 at);
function register(string calldata text) external {
bytes32 h = keccak256(bytes(text));
require(registeredAt[h] == 0, "already registered");
registeredAt[h] = block.timestamp;
emit Registered(h, msg.sender, block.timestamp);
}
function check(string calldata text) external view returns (uint256) {
return registeredAt[keccak256(bytes(text))];
}
}
The contract does not store the text itself; it keeps only its fingerprint (hash) with the time it was recorded.
Step by step in Remix
- Open Remix in your browser, create a new file called
Notary.soland paste the code above. - Go to the Solidity compiler tab. Pick compiler 0.8.24 or later and, under Advanced configurations, set the EVM version to
cancun(the version SUR runs). Then press Compile. - Go to the Deploy & run transactions tab. Set the environment to Remix VM (Cancun): a test blockchain inside your browser with accounts full of test coins. Press Deploy.
- Under the deployed contract, type a text into
register(for example"hello SUR", with quotes) and run it. Now callcheckwith the same text: it returns the time it was recorded. Callregisterwith the same text again: the transaction reverts withalready registered.
The text you send to register is visible to everyone in the transaction data, even though the contract keeps only the hash. For a real document, compute the file's hash off chain and send only the hash.
Deploying on SUR
The SUR main network has not launched yet. Until then, test the contract in Remix VM or on a local node.
After launch, deploying on SUR takes only three extra steps:
- Add the SUR network to MetaMask (the network page, one button).
- Have some SUREN for fees; deploying this contract and a few calls cost a few tens of SUREN (buy SUREN from licensed exchanges).
- In Remix, set the environment to Injected Provider - MetaMask and deploy again. Once recorded, find the contract in the SUR explorer and verify its source code there so anyone can read it.
Next steps
- For a real project use Hardhat or Foundry: developer quickstart.
- For tokens and common patterns use audited libraries such as OpenZeppelin, and get a security audit before deploying any contract that holds money.
- The official Solidity documentation is the best place to go deeper.
Last reviewed: 2026/11/26