For EVM developers
NEAR by Example
Learn NEAR smart contracts the way you already think — in Solidity. Every concept is shown side by side: the Solidity you know on the left, the NEAR equivalent (Rust) on the right. Compact, complete, and (soon) compile-verified.
The Rosetta table
The quick EVM → NEAR lookup. A blank cell means there’s no direct analog on that side.
| Solidity / EVM | NEAR |
|---|---|
ERC-20 | NEP-141Fungible token |
ERC-721 | NEP-171NFT |
ERC-1155 | NEP-245Multi-token |
address | AccountIdNamed accounts (alice.near), not 20-byte hashes |
msg.sender | env::predecessor_account_id() |
tx.origin | env::signer_account_id() |
msg.value | env::attached_deposit()NearToken (yocto-NEAR) |
wei (10^18) | yocto-NEAR (10^24) |
mapping(k => v) | LookupMap / UnorderedMapExplicit, from near_sdk::store |
require / revert | assert! / env::panic_strRolls back, refunds unused gas |
constant | const (module level) |
view / pure | &self methodA receiver, not a keyword |
payable | #[payable] |
emit Event(...) | env::log_str (NEP-297 JSON) |
approve + transferFrom | ft_transfer_callTransfer-and-call; no allowance |
proxy upgrade pattern | DeployContract actionNative self-upgrade |
EIP-712 / meta-tx | NEP-366 + access keysNative account abstraction |
selfdestruct | —No equivalent (accounts deleted explicitly) |
Chapters
Getting started
State & storage
Functions & calls