Skip to main content

This site is for educational purposes only. Nothing here constitutes financial advice.

Topic 68 of 189

NEAR Contract Model

How NEAR's sharded execution, async cross-contract calls, and storage staking model differ from Ethereum and Solana — and what writing production NEAR contracts looks like.

Beginner
8 min readUpdated November 2026Block Clarity Hub Editorial Team

The basics

NEAR's Bet — Sharded Execution

NEAR Protocol is a sharded blockchain that splits the network into multiple 'shards' that process transactions in parallel. Sharding went live in late 2021, when mainnet moved from one shard to four, and nearcore 2.7.0 (August 2025) later grew it from 8 to 9 shards. The model lets the network scale horizontally without requiring all validators to process every transaction. Each shard maintains its own state; cross-shard transactions are handled via async message passing. This is a different scaling approach than rollups or single-chain throughput optimisation.

Contracts in Rust

NEAR contracts are written in Rust; near-sdk-rs is NEAR's only official smart-contract SDK, and the older AssemblyScript and JavaScript SDK repositories are now archived. Contracts compile to WebAssembly and run inside a NEAR runtime. The contract model is account-based — each contract has an account, and contracts can call other contracts. Unlike Ethereum's synchronous calls, NEAR contract calls are async: when contract A calls contract B, A's execution finishes; B runs in a subsequent transaction block; A receives a callback with B's result.

Account Names — Human Readable

NEAR supports human-readable named accounts such as alice.near and contract.alice.near, alongside implicit addresses derived from a public key. The hierarchical structure (subaccounts under accounts) provides namespacing similar to DNS. This is a quality-of-life feature relative to Ethereum's 0x... addresses. Users can use any-account-name they want as long as it's available, similar to claiming an ENS name but native to the protocol rather than bolted on.

  • Sharded execution: multiple shards process transactions in parallel
  • Contracts written in Rust (near-sdk-rs), compile to WebAssembly
  • Cross-contract calls are async: callbacks rather than synchronous returns
  • Human-readable account names baked in (alice.near format)

Key Takeaways

  • NEAR uses sharded execution for horizontal scaling
  • Contracts are Rust-based and compile to WASM
  • Async cross-contract calls are structurally different from Ethereum's synchronous calls
  • Human-readable account names improve UX over hex addresses

Going deeper

Storage Staking

NEAR's storage model is unusual: contracts and accounts must stake NEAR tokens proportional to the data they store. The stake is locked while the storage is used and refunded when the data is deleted. This eliminates state-bloat economics problems by directly pricing storage. The downside: contracts need to manage storage staking carefully — a popular contract storing data per user must collect storage fees from each user, or absorb the cost. Patterns for handling this are now well-established.

Account Abstraction Throughout

NEAR has native account abstraction: every account has access keys and can optionally hold a smart contract with custom logic. Multi-sig wallets, social recovery, key rotation, and meta-transactions are all first-class features of the account model. Function-call access keys (limited-authority keys that can only call specific contract functions) enable session-key patterns that on Ethereum require ERC-4337 infrastructure. NEAR's AA-native design predates ERC-4337 and is more deeply integrated than the Ethereum retrofit.

Async Cross-Contract Programming

The async model takes adjustment. A simple swap on Ethereum is one transaction; on NEAR, calling a DEX contract that calls a token contract typically requires the calling contract to wait for the result in a callback. The Promise pattern (similar to JavaScript Promises) makes this manageable, but designing protocols that handle partial-failure scenarios (callback fails, intermediate state is committed) requires careful thought. Production NEAR contracts handle these cases explicitly.

Nightshade Sharding

NEAR's sharding mechanism is called Nightshade. Mainnet moved from one shard to four in late 2021 and has resharded since: nearcore 2.7.0 (August 2025) grew it from 8 to 9 shards, and nearcore 2.13.0 (July 2026) stabilised dynamic resharding, which splits shards automatically at epoch boundaries based on state size. Chunk producers are assigned to shards and reassigned each epoch. Cross-shard calls travel as receipts and take multiple blocks to fully settle.

Key Takeaways

  • Storage staking prices storage at the contract level, eliminating state-bloat economics issues
  • Account abstraction is native — predates ERC-4337 and is more deeply integrated
  • Async cross-contract programming requires Promise patterns and careful failure handling
  • Nightshade sharding has been live since late 2021; the shard count has since grown, and nearcore 2.13.0 stabilised dynamic resharding

Under the hood

BOS — The Blockchain Operating System

NEAR introduced BOS (Blockchain Operating System) as a framework for building decentralised frontend apps that can target any blockchain. BOS components are written in a React-like syntax and executed in a BOS gateway. The architecture was designed to solve the decentralised-frontend problem (most 'decentralised' apps have centralised frontends served from regular web servers). As of November 2026, BOS is not listed in NEAR's developer documentation, whose Web3 Apps guide covers conventional React and Next.js frontends with wallet login, and near.org presents NEAR as open infrastructure for the agent economy, highlighting NEAR Intents and NEAR AI.

Chain Signatures and Cross-Chain

Chain Signatures lets NEAR accounts control accounts on other chains via threshold cryptography. A NEAR account can hold Bitcoin via Chain Signatures without bridges — the signature is produced jointly by a network of independent MPC nodes (none of which can sign alone; the participant set is public in the v1.signer contract), which can sign Bitcoin, EVM, Solana and other chains' transactions. This is a fundamentally different model than wrapped-asset bridges and has interesting implications for cross-chain UX. NEAR's docs include worked examples such as multichain DAO governance.

NEAR's TVL and Ecosystem Reality

NEAR's DeFi TVL is smaller than EVM chains and Solana — roughly $145M on DefiLlama on 15 November 2026, against roughly $38B for Ethereum and $4.7B for Solana. The chain has strong infrastructure (sharding works, account model is clean, tooling is solid) but ecosystem adoption has been slower than the technical merits would suggest. Reasons: the async cross-contract model is harder to develop for, network-effect drag from EVM dominance, and the strategic pivot to BOS, Chain Signatures and, more recently, Intents and NEAR AI rather than pure DeFi competition. The chain remains technically interesting; whether the technical positioning translates to ecosystem mass is the open question.

NEAR-Specific Bug Patterns

NEAR contracts have their own bug catalog. Callback failure handling: a cross-contract call's callback may fail; the contract needs to handle the partial-commit state. Storage cost accounting: contracts that store user data must properly meter and refund storage stake. Access key abuse: function-call access keys with overly broad permissions enable unintended actions. Promise chain bugs: complex Promise chains can have subtle state inconsistencies. Audit reports from NEAR-focused firms catalog these patterns.

Reading NEAR Contract Source

Most NEAR contracts are Rust crates structured as standard Cargo projects. The near-sdk crate provides the basic abstractions. When reading a NEAR contract, focus on: the storage layout, how Promise patterns handle cross-contract calls, what access-key model the contract assumes, and how storage staking is handled. The Rust foundation is familiar to web2 systems engineers; the NEAR-specific patterns require dedicated learning.

Key Takeaways

  • BOS is an earlier NEAR bet on decentralised frontends; it is not listed in NEAR's current developer docs
  • Chain Signatures via threshold MPC lets NEAR accounts control assets on other chains without bridges
  • NEAR's DeFi TVL is modest; ecosystem adoption has lagged technical positioning
  • Bug patterns include callback failure handling, storage cost accounting, access key abuse, Promise chain inconsistencies
  • NEAR contracts are Rust crates structured around near-sdk; familiar to systems engineers

Related Content

Move Language (Aptos and Sui)

Why Move's resource model fundamentally differs from Solidity, how Aptos and Sui evolved from the same Facebook-origin language, and what 'resources' mean for safety guarantees.

Cairo and StarkNet Contract Development

How Cairo as a language differs from Solidity and Rust, why account abstraction is native to StarkNet, and what writing production StarkNet contracts actually involves.

CosmWasm and Cosmos Smart Contracts

How CosmWasm enables smart contracts on Cosmos chains via WebAssembly, what makes the developer experience distinct from EVM, and why Cosmos's sovereign-chain architecture is a different bet from rollup-style scaling.

Cardano Plutus and EUTxO Contracts

How Cardano's Extended UTXO (EUTxO) model differs fundamentally from Ethereum's account model, what writing Plutus contracts actually involves, and why concurrency on Cardano works differently.

ICP Canister Model

How Internet Computer (ICP)'s canisters fundamentally differ from Ethereum-style smart contracts — combining compute, storage, and HTTP-server-like functionality in a single on-chain primitive.

ERC-721A and Compressed NFTs

How gas-optimised NFT standards like ERC-721A made batch mints affordable, and how Solana state compression takes the same idea further by committing compressed NFTs to a Merkle tree instead of storing each one in its own account.

ERC-6551 Token-Bound Accounts

How ERC-6551 lets NFTs own smart contract wallets that can in turn own other assets — enabling 'NFTs that own NFTs,' character-bound inventories, and new composability patterns.

Ordinals, Inscriptions, and BRC-20

How Casey Rodarmor's 2023 Ordinals protocol brought NFTs and tokens to Bitcoin via inscriptions, what BRC-20 means in practice, and how Runes evolved the model.

References & further reading