The first contract on sidestr:txbt4-evm, a sidestr chain that runs Ethereum contracts with sats as gas. Sixteen lines of Solidity, what each does, its live state as this page has validated it, and a button. Deploy your own in the ide · directory
reading the chain…
pragma solidity ^0.8.20;Which compiler dialect. The page compiled this with 0.8.28, optimiser on, for the Cancun rules, which is what this chain runs.
uint256 public drip = 1000 gwei;How much one drip pays. Solidity counts in wei; on this chain 1 gwei is 1 sat, so this is 1,000 sats. Writing a bare 1000 would pay 1,000 wei, a millionth of a sat, which is exactly the mistake the first version of this contract made.
uint256 public interval = 600;Seconds between drips for one address. public makes the compiler write a free getter, which is what the numbers above are read from.
mapping(address => uint256) public last;When each address last asked. A mapping is storage on the chain, paid for by whoever writes it; reads are free.
event Drip(address indexed to, uint256 amount);A log line the contract writes when it pays. Logs are cheap, live in the receipt, and are how pages and explorers notice things without reading storage.
receive() external payable {}Lets anyone top the faucet up by sending it value with no data. Without this a plain transfer to the contract would be refused.
require(block.timestamp >= last[msg.sender] + interval, "wait");The rule. block.timestamp is the sidestr block's time. If it fails, the whole call is undone and the reason "wait" comes back. This page runs the call on its own copy of the state first, so you see "wait" before you spend anything.
require(address(this).balance >= drip, "dry");A contract has its own balance, separate from yours. If it cannot pay, it says so instead of paying less.
last[msg.sender] = block.timestamp;Write before paying. If the payment failed and this line came after it, a caller could ask again in the same block. Order matters in contracts.
payable(msg.sender).transfer(drip);Pay the caller. The caller also paid gas for this call, about 56,000 gas at 1 gwei each, so a drip has to be worth more than that to be worth asking for. This one is not: it is a lesson, not an income.
emit Drip(msg.sender, drip);Write the log. The activity below is built from these.
Compiled with solc 0.8.28, deployed with the wallet library and the chain signer's key (the ide does the same from a page), funded with 500,000 gwei by a plain send to its address. The deploy cost 226,942 gas. Every block since then carries the state root that includes this contract's storage, and this page recomputed all of it before showing you a number. There is no server behind these figures.