NEAR Smart Contracts Development
Comprehensive guide for developing secure and efficient smart contracts on NEAR Protocol using Rust and the NEAR SDK (v5.x).
When to Apply
Reference these guidelines when:
- Writing new NEAR smart contracts in Rust
- Reviewing existing contract code for security and optimization
- Implementing cross-contract calls and callbacks
- Managing contract state and storage
- Testing and deploying NEAR contracts
- Optimizing gas usage and performance
Getting Started
Prerequisites
Install the required tools before starting development:
# Install Rust (if not already installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Add wasm32 target for compiling contracts
rustup target add wasm32-unknown-unknown
# Install cargo-near (build, deploy, and manage contracts)
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/cargo-near/releases/latest/download/cargo-near-installer.sh | sh
# Install near-cli-rs (interact with NEAR network)
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/near-cli-rs/releases/latest/download/near-cli-rs-installer.sh | sh
Create a New Project
CRITICAL: ALWAYS run cargo near new to create new projects. NEVER manually create Cargo.toml, lib.rs, or any project files. The command generates all required files with correct configurations.
# REQUIRED: Create a new contract project using the official template
cargo near new my-contract
# Navigate to project directory
cd my-contract
# Build the contract
cargo near build
# Run tests
cargo test
Why cargo near new is mandatory:
- Generates correct
Cargo.toml with proper dependencies and build settings
- Creates proper project structure with
src/lib.rs template
- Includes integration test setup in
tests/ directory
- Configures release profile with
overflow-checks = true
- Sets up correct crate-type for WASM compilation
- Avoids common configuration mistakes that cause build failures
DO NOT:
- Manually create
Cargo.toml
- Manually create
src/lib.rs
- Copy-paste project structure from examples
- Skip this step and create files directly
Project Structure
my-contract/
├── Cargo.toml # Dependencies and project config
├── src/
│ └── lib.rs # Main contract code
├── tests/ # Integration tests
│ └── test_basics.rs
└── README.md
Deploy to Testnet
# Create a testnet account (if needed)
near account create-account sponsor-by-faucet-service my-contract.testnet autogenerate-new-keypair save-to-keychain network-config testnet create
# Build in release mode
cargo near build --release
# Deploy to testnet
cargo near deploy my-contract.testnet without-init-call network-config testnet sign-with-keychain send
Rule Categories by Priority
| Priority |
Category |
Impact |
Prefix |
| 1 |
Security & Safety |
CRITICAL |
security- |
| 2 |
Contract Structure |
HIGH |
structure- |
| 3 |
State Management |
HIGH |
state- |
| 4 |
Cross-Contract Calls |
MEDIUM-HIGH |
xcc- |
| 5 |
Contract Upgrades |
MEDIUM-HIGH |
upgrade- |
| 6 |
Chain Signatures |
MEDIUM-HIGH |
chain- |
| 7 |
Gas Optimization |
MEDIUM |
gas- |
| 8 |
Yield & Resume |
MEDIUM |
yield- |
| 9 |
Testing |
MEDIUM |
testing- |
| 10 |
Best Practices |
MEDIUM |
best- |
1. Security & Safety (CRITICAL)
security-storage-checks - Always validate storage operations and check deposits
security-access-control - Implement proper access control using predecessor_account_id
security-reentrancy - Protect against reentrancy attacks (update state before external calls)
security-overflow - Use overflow-checks = true in Cargo.toml to prevent overflow
security-callback-validation - Validate callback results and handle failures
security-private-callbacks - Mark callbacks as #[private] to prevent external calls
security-yoctonear-validation - Validate attached deposits with #[payable] functions
security-sybil-resistance - Implement minimum deposit checks to prevent spam
2. Contract Structure (HIGH)
structure-near-bindgen - Use #[near(contract_state)] macro for contract struct (replaces old #[near_bindgen])
structure-initialization - Implement proper initialization with #[init] patterns
structure-versioning - Plan for contract upgrades with versioning mechanisms
structure-events - Use env::log_str() and structured event logging (NEP-297)
structure-standards - Follow NEAR Enhancement Proposals (NEPs) for standards
structure-serializers - Use #[near(serializers = [json, borsh])] for data structs
structure-panic-default - Use #[derive(PanicOnDefault)] to require initialization
3. State Management (HIGH)
state-collections - Use SDK collections from near_sdk::store: IterableMap, IterableSet, Vector, LookupMap, LookupSet, UnorderedMap, UnorderedSet, TreeMap
state-serialization - Use Borsh for state, JSON for external interfaces
state-lazy-loading - Use SDK collections for lazy loading to save gas (loaded on-demand, not all at once)
state-pagination - Implement pagination with .skip() and .take() for large datasets
state-migration - Plan state migration strategies using versioning
state-storage-cost - Remember: 1 NEAR ≈ 100kb storage, contracts pay for their storage
state-unique-prefixes - Use unique byte prefixes for all collections (avoid collisions)
state-native-vs-sdk - Native collections (Vec, HashMap) load all data; use only for <100 entries
4. Cross-Contract Calls (MEDIUM-HIGH)
xcc-promise-chaining - Chain promises correctly
xcc-callback-handling - Handle all callback scenarios (success, failure)
xcc-gas-management - Allocate appropriate gas for cross-contract calls
xcc-error-handling - Implement robust error handling
xcc-result-unwrap - Never unwrap promise results without checks
5. Contract Upgrades & Migration (MEDIUM-HIGH)
upgrade-migration - Use enums for state versioning and implement migrate method with #[init(ignore_state)]
upgrade-self-update - Pattern for contracts that can update themselves programmatically
upgrade-cleanup-old-state - Always remove old state structures to free storage
upgrade-dao-controlled - Use multisig or DAO for production upgrade governance
6. Chain Signatures (MEDIUM-HIGH)
chain-signatures - Derive foreign blockchain addresses, request MPC signatures, and build multichain transactions
chain-callback-handling - Handle MPC signature callbacks properly
chain-gas-allocation - Allocate sufficient gas for MPC calls (yield/resume pattern)
7. Gas Optimization (MEDIUM)
gas-batch-operations - Batch operations to reduce transaction costs
gas-minimal-state-reads - Minimize state reads and writes (cache in memory)
gas-efficient-collections - Choose appropriate collection types (LookupMap vs IterableMap)
gas-view-functions - Mark read-only functions as view (&self in Rust)
gas-avoid-cloning - Avoid unnecessary cloning of large data structures
gas-early-validation - Use require! early to save gas on invalid inputs
gas-prepaid-gas - Attach appropriate gas for cross-contract calls (recommended: 30 TGas)
8. Yield & Resume (MEDIUM)
yield-resume - Create yielded promises, signal resume, handle timeouts, and manage state between yield/resume
yield-gatekeeping - Protect resume methods from unauthorized callers
9. Testing (MEDIUM)
testing-integration-tests - Use near-sandbox + near-api for integration tests
testing-unit-tests - Write comprehensive unit tests with mock contexts
testing-sandbox - Test with local sandbox environment before testnet/mainnet
testing-edge-cases - Test boundary conditions, overflow, and empty states
testing-gas-profiling - Profile gas usage in integration tests
testing-cross-contract - Test cross-contract calls and callbacks thoroughly
testing-failure-scenarios - Test promise failures and timeout scenarios
testing-time-travel - Use sandbox.fast_forward() for time-sensitive tests
10. Best Practices (MEDIUM)
best-contract-tools - Use near-sdk-contract-tools for NEP standards (FT, NFT, etc.) and NEP-297 structured events
best-panic-messages - Provide clear, actionable panic messages
best-logging - Use env::log_str() for debugging and event emission
best-documentation - Document public methods, parameters, and complex logic
best-error-types - Define custom error types or use descriptive strings
best-constants - Use constants for magic numbers and configuration
best-require-macro - Use require! instead of assert! for better error messages
best-promise-return - Return promises from cross-contract calls for proper tracking
best-sdk-crates - Reuse SDK-exported crates (borsh, serde, base64, etc.)
best-account-id-encoding - Encode AccountIds in base32 for 40% storage savings
How to Use
Read individual rule files for detailed explanations and code examples:
rules/security-storage-checks.md
rules/structure-near-bindgen.md
rules/state-collections.md
rules/xcc-promise-chaining.md
rules/upgrade-migration.md
rules/chain-signatures.md
rules/yield-resume.md
rules/best-contract-tools.md
rules/testing-integration-tests.md
Each rule file contains:
- Brief explanation of why it matters
- Incorrect code example with explanation
- Correct code example with explanation
- Additional context and NEAR-specific considerations
Latest Tools & Versions
Development Tools
- cargo-near: Latest - Build, deploy, and manage contracts (
cargo near build, cargo near deploy)
- near-cli-rs: Latest - Command-line interface for NEAR (
near contract call, near contract view)
- rustc: Latest stable - Rust compiler
- near-sandbox: Latest - Local sandbox environment for integration testing
- near-api-rs: Latest - Rust API client for interacting with NEAR (replaces near-workspaces-rs for tests)
- omni-transaction-rs: Latest - Build transactions for multiple blockchains (Bitcoin, Ethereum, etc.)
SDK Versions
- near-sdk-rs: v5.x (v6.x coming with structured errors support)
- near-sdk-contract-tools: Latest - Derive macros for NEP standards (FT, NFT, Storage Management)
Key Features
- Unified macro syntax:
#[near(contract_state)] replaces #[near_bindgen] + derives
- Flexible serialization:
#[near(serializers = [json, borsh])] for data structs
- Store collections:
near_sdk::store::IterableMap, IterableSet, LookupMap, LookupSet, Vector, UnorderedMap, UnorderedSet, TreeMap
- Simplified cross-contract calls: High-level promise API with
Promise::new() and .then()
- Built-in NEP support: FT (NEP-141), NFT (NEP-171), and other standards
- Result handling:
#[handle_result] for methods returning Result<T, E> without panicking
- Yield/Resume: Contracts can yield execution and wait for external services to resume
- Chain Signatures: Sign transactions for other blockchains (Bitcoin, Ethereum, Solana, etc.)
- Contract Tools: Derive macros for Owner, Pause, Role-based access control patterns
Resources
Storage Costs Reference
| Storage |
Cost |
Notes |
| 1 byte |
0.00001 NEAR |
~10kb per 0.1 NEAR |
| 100 KB |
~1 NEAR |
Approximate reference |
| AccountId |
64+ bytes |
Can save 40% with base32 encoding |
| Contract code |
Variable |
Paid by contract account |
SDK Collections Reference
| Collection |
Iterable |
Clear |
Ordered |
Range |
Use Case |
Vector |
Yes |
Yes |
Yes |
Yes |
Ordered list with index access |
LookupMap |
No |
No |
No |
No |
Fast key-value, no iteration needed |
LookupSet |
No |
No |
No |
No |
Fast membership checks |
IterableMap |
Yes |
Yes |
Yes |
No |
Key-value with iteration |
IterableSet |
Yes |
Yes |
Yes |
No |
Set with iteration |
UnorderedMap |
Yes |
Yes |
No |
No |
Key-value, unordered iteration |
UnorderedSet |
Yes |
Yes |
No |
No |
Set, unordered iteration |
TreeMap |
Yes |
Yes |
Yes |
Yes |
Sorted key-value with range queries |
1---2name: near-smart-contracts3description: NEAR Protocol smart contract development in Rust. Use when writing, reviewing, or deploying NEAR smart contracts. Covers contract structure, state management, cross-contract calls, testing, security, and optimization patterns. Based on near-sdk v5.x with modern macro syntax.4license: MIT5---6
7# NEAR Smart Contracts Development
8
9Comprehensive guide for developing secure and efficient smart contracts on NEAR Protocol using Rust and the NEAR SDK (v5.x).
10
11## When to Apply
12
13Reference these guidelines when:
14
15- Writing new NEAR smart contracts in Rust
16- Reviewing existing contract code for security and optimization
17- Implementing cross-contract calls and callbacks
18- Managing contract state and storage
19- Testing and deploying NEAR contracts
20- Optimizing gas usage and performance
21
22## Getting Started
23
24### Prerequisites
25
26Install the required tools before starting development:
27
28```bash
29# Install Rust (if not already installed)
30curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
31
32# Add wasm32 target for compiling contracts
33rustup target add wasm32-unknown-unknown
34
35# Install cargo-near (build, deploy, and manage contracts)
36curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/cargo-near/releases/latest/download/cargo-near-installer.sh | sh
37
38# Install near-cli-rs (interact with NEAR network)
39curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/near-cli-rs/releases/latest/download/near-cli-rs-installer.sh | sh
40```
41
42### Create a New Project
43
44> **CRITICAL**: ALWAYS run `cargo near new` to create new projects. NEVER manually create Cargo.toml, lib.rs, or any project files. The command generates all required files with correct configurations.
45
46```bash
47# REQUIRED: Create a new contract project using the official template
48cargo near new my-contract
49
50# Navigate to project directory
51cd my-contract
52
53# Build the contract
54cargo near build
55
56# Run tests
57cargo test
58```
59
60**Why `cargo near new` is mandatory:**
61- Generates correct `Cargo.toml` with proper dependencies and build settings
62- Creates proper project structure with `src/lib.rs` template
63- Includes integration test setup in `tests/` directory
64- Configures release profile with `overflow-checks = true`
65- Sets up correct crate-type for WASM compilation
66- Avoids common configuration mistakes that cause build failures
67
68**DO NOT:**
69- Manually create `Cargo.toml`
70- Manually create `src/lib.rs`
71- Copy-paste project structure from examples
72- Skip this step and create files directly
73
74### Project Structure
75
76```
77my-contract/
78├── Cargo.toml # Dependencies and project config
79├── src/
80│ └── lib.rs # Main contract code
81├── tests/ # Integration tests
82│ └── test_basics.rs
83└── README.md
84```
85
86### Deploy to Testnet
87
88```bash
89# Create a testnet account (if needed)
90near account create-account sponsor-by-faucet-service my-contract.testnet autogenerate-new-keypair save-to-keychain network-config testnet create
91
92# Build in release mode
93cargo near build --release
94
95# Deploy to testnet
96cargo near deploy my-contract.testnet without-init-call network-config testnet sign-with-keychain send
97```
98
99## Rule Categories by Priority
100
101| Priority | Category | Impact | Prefix |
102| --------- | ---------- | -------- | --------- |
103| 1 | Security & Safety | CRITICAL | `security-` |
104| 2 | Contract Structure | HIGH | `structure-` |
105| 3 | State Management | HIGH | `state-` |
106| 4 | Cross-Contract Calls | MEDIUM-HIGH | `xcc-` |
107| 5 | Contract Upgrades | MEDIUM-HIGH | `upgrade-` |
108| 6 | Chain Signatures | MEDIUM-HIGH | `chain-` |
109| 7 | Gas Optimization | MEDIUM | `gas-` |
110| 8 | Yield & Resume | MEDIUM | `yield-` |
111| 9 | Testing | MEDIUM | `testing-` |
112| 10 | Best Practices | MEDIUM | `best-` |
113
114### 1. Security & Safety (CRITICAL)
115
116- `security-storage-checks` - Always validate storage operations and check deposits
117- `security-access-control` - Implement proper access control using `predecessor_account_id`
118- `security-reentrancy` - Protect against reentrancy attacks (update state before external calls)
119- `security-overflow` - Use `overflow-checks = true` in Cargo.toml to prevent overflow
120- `security-callback-validation` - Validate callback results and handle failures
121- `security-private-callbacks` - Mark callbacks as `#[private]` to prevent external calls
122- `security-yoctonear-validation` - Validate attached deposits with `#[payable]` functions
123- `security-sybil-resistance` - Implement minimum deposit checks to prevent spam
124
125### 2. Contract Structure (HIGH)
126
127- `structure-near-bindgen` - Use `#[near(contract_state)]` macro for contract struct (replaces old `#[near_bindgen]`)
128- `structure-initialization` - Implement proper initialization with `#[init]` patterns
129- `structure-versioning` - Plan for contract upgrades with versioning mechanisms
130- `structure-events` - Use `env::log_str()` and structured event logging (NEP-297)
131- `structure-standards` - Follow NEAR Enhancement Proposals (NEPs) for standards
132- `structure-serializers` - Use `#[near(serializers = [json, borsh])]` for data structs
133- `structure-panic-default` - Use `#[derive(PanicOnDefault)]` to require initialization
134
135### 3. State Management (HIGH)
136
137- `state-collections` - Use SDK collections from `near_sdk::store`: `IterableMap`, `IterableSet`, `Vector`, `LookupMap`, `LookupSet`, `UnorderedMap`, `UnorderedSet`, `TreeMap`
138- `state-serialization` - Use Borsh for state, JSON for external interfaces
139- `state-lazy-loading` - Use SDK collections for lazy loading to save gas (loaded on-demand, not all at once)
140- `state-pagination` - Implement pagination with `.skip()` and `.take()` for large datasets
141- `state-migration` - Plan state migration strategies using versioning
142- `state-storage-cost` - Remember: 1 NEAR ≈ 100kb storage, contracts pay for their storage
143- `state-unique-prefixes` - Use unique byte prefixes for all collections (avoid collisions)
144- `state-native-vs-sdk` - Native collections (Vec, HashMap) load all data; use only for <100 entries
145
146### 4. Cross-Contract Calls (MEDIUM-HIGH)
147
148- `xcc-promise-chaining` - Chain promises correctly
149- `xcc-callback-handling` - Handle all callback scenarios (success, failure)
150- `xcc-gas-management` - Allocate appropriate gas for cross-contract calls
151- `xcc-error-handling` - Implement robust error handling
152- `xcc-result-unwrap` - Never unwrap promise results without checks
153
154### 5. Contract Upgrades & Migration (MEDIUM-HIGH)
155
156- `upgrade-migration` - Use enums for state versioning and implement `migrate` method with `#[init(ignore_state)]`
157- `upgrade-self-update` - Pattern for contracts that can update themselves programmatically
158- `upgrade-cleanup-old-state` - Always remove old state structures to free storage
159- `upgrade-dao-controlled` - Use multisig or DAO for production upgrade governance
160
161### 6. Chain Signatures (MEDIUM-HIGH)
162
163- `chain-signatures` - Derive foreign blockchain addresses, request MPC signatures, and build multichain transactions
164- `chain-callback-handling` - Handle MPC signature callbacks properly
165- `chain-gas-allocation` - Allocate sufficient gas for MPC calls (yield/resume pattern)
166
167### 7. Gas Optimization (MEDIUM)
168
169- `gas-batch-operations` - Batch operations to reduce transaction costs
170- `gas-minimal-state-reads` - Minimize state reads and writes (cache in memory)
171- `gas-efficient-collections` - Choose appropriate collection types (LookupMap vs IterableMap)
172- `gas-view-functions` - Mark read-only functions as view (`&self` in Rust)
173- `gas-avoid-cloning` - Avoid unnecessary cloning of large data structures
174- `gas-early-validation` - Use `require!` early to save gas on invalid inputs
175- `gas-prepaid-gas` - Attach appropriate gas for cross-contract calls (recommended: 30 TGas)
176
177### 8. Yield & Resume (MEDIUM)
178
179- `yield-resume` - Create yielded promises, signal resume, handle timeouts, and manage state between yield/resume
180- `yield-gatekeeping` - Protect resume methods from unauthorized callers
181
182### 9. Testing (MEDIUM)
183
184- `testing-integration-tests` - Use `near-sandbox` + `near-api` for integration tests
185- `testing-unit-tests` - Write comprehensive unit tests with mock contexts
186- `testing-sandbox` - Test with local sandbox environment before testnet/mainnet
187- `testing-edge-cases` - Test boundary conditions, overflow, and empty states
188- `testing-gas-profiling` - Profile gas usage in integration tests
189- `testing-cross-contract` - Test cross-contract calls and callbacks thoroughly
190- `testing-failure-scenarios` - Test promise failures and timeout scenarios
191- `testing-time-travel` - Use `sandbox.fast_forward()` for time-sensitive tests
192
193### 10. Best Practices (MEDIUM)
194
195- `best-contract-tools` - Use `near-sdk-contract-tools` for NEP standards (FT, NFT, etc.) and NEP-297 structured events
196- `best-panic-messages` - Provide clear, actionable panic messages
197- `best-logging` - Use `env::log_str()` for debugging and event emission
198- `best-documentation` - Document public methods, parameters, and complex logic
199- `best-error-types` - Define custom error types or use descriptive strings
200- `best-constants` - Use constants for magic numbers and configuration
201- `best-require-macro` - Use `require!` instead of `assert!` for better error messages
202- `best-promise-return` - Return promises from cross-contract calls for proper tracking
203- `best-sdk-crates` - Reuse SDK-exported crates (borsh, serde, base64, etc.)
204- `best-account-id-encoding` - Encode AccountIds in base32 for 40% storage savings
205
206## How to Use
207
208Read individual rule files for detailed explanations and code examples:
209
210```
211rules/security-storage-checks.md
212rules/structure-near-bindgen.md
213rules/state-collections.md
214rules/xcc-promise-chaining.md
215rules/upgrade-migration.md
216rules/chain-signatures.md
217rules/yield-resume.md
218rules/best-contract-tools.md
219rules/testing-integration-tests.md
220```
221
222Each rule file contains:
223
224- Brief explanation of why it matters
225- Incorrect code example with explanation
226- Correct code example with explanation
227- Additional context and NEAR-specific considerations
228
229## Latest Tools & Versions
230
231### Development Tools
232
233- **cargo-near**: Latest - Build, deploy, and manage contracts (`cargo near build`, `cargo near deploy`)
234- **near-cli-rs**: Latest - Command-line interface for NEAR (`near contract call`, `near contract view`)
235- **rustc**: Latest stable - Rust compiler
236- **near-sandbox**: Latest - Local sandbox environment for integration testing
237- **near-api-rs**: Latest - Rust API client for interacting with NEAR (replaces near-workspaces-rs for tests)
238- **omni-transaction-rs**: Latest - Build transactions for multiple blockchains (Bitcoin, Ethereum, etc.)
239
240### SDK Versions
241
242- **near-sdk-rs**: v5.x (v6.x coming with structured errors support)
243- **near-sdk-contract-tools**: Latest - Derive macros for NEP standards (FT, NFT, Storage Management)
244
245### Key Features
246
247- **Unified macro syntax**: `#[near(contract_state)]` replaces `#[near_bindgen]` + derives
248- **Flexible serialization**: `#[near(serializers = [json, borsh])]` for data structs
249- **Store collections**: `near_sdk::store::IterableMap`, `IterableSet`, `LookupMap`, `LookupSet`, `Vector`, `UnorderedMap`, `UnorderedSet`, `TreeMap`
250- **Simplified cross-contract calls**: High-level promise API with `Promise::new()` and `.then()`
251- **Built-in NEP support**: FT (NEP-141), NFT (NEP-171), and other standards
252- **Result handling**: `#[handle_result]` for methods returning `Result<T, E>` without panicking
253- **Yield/Resume**: Contracts can yield execution and wait for external services to resume
254- **Chain Signatures**: Sign transactions for other blockchains (Bitcoin, Ethereum, Solana, etc.)
255- **Contract Tools**: Derive macros for Owner, Pause, Role-based access control patterns
256
257## Resources
258
259- NEAR Documentation: <https://docs.near.org>
260- Smart Contract Quickstart: <https://docs.near.org/smart-contracts/quickstart>
261- Contract Anatomy: <https://docs.near.org/smart-contracts/anatomy/>
262- NEAR SDK Rust: <https://docs.near.org/tools/sdk>
263- SDK Rust Reference: <https://docs.rs/near-sdk>
264- Storage & Collections: <https://docs.near.org/smart-contracts/anatomy/collections>
265- Best Practices: <https://docs.near.org/smart-contracts/anatomy/best-practices>
266- Cross-Contract Calls: <https://docs.near.org/smart-contracts/anatomy/crosscontract>
267- Yield & Resume: <https://docs.near.org/smart-contracts/anatomy/yield-resume>
268- Contract Upgrades: <https://docs.near.org/smart-contracts/release/upgrade>
269- Chain Signatures: <https://docs.near.org/chain-abstraction/chain-signatures>
270- Chain Signatures Implementation: <https://docs.near.org/chain-abstraction/chain-signatures/implementation>
271- Security Best Practices: <https://docs.near.org/smart-contracts/security/welcome>
272- Integration Testing: <https://docs.near.org/smart-contracts/testing/integration-test>
273- NEP-297 Events: <https://github.com/near/NEPs/blob/master/neps/nep-0297.md>
274- NEAR Standards (NEPs): <https://github.com/near/NEPs>
275- NEAR Examples: <https://github.com/near-examples>
276- Sandbox Testing: <https://github.com/near/near-sandbox>
277- NEAR API Rust: <https://github.com/near/near-api-rs>
278- Omni Transaction RS: <https://github.com/near/omni-transaction-rs>
279- Contract Tools: <https://github.com/near/near-sdk-contract-tools>
280
281## Storage Costs Reference
282
283| Storage | Cost | Notes |
284|---------|------|-------|
285| 1 byte | 0.00001 NEAR | ~10kb per 0.1 NEAR |
286| 100 KB | ~1 NEAR | Approximate reference |
287| AccountId | 64+ bytes | Can save 40% with base32 encoding |
288| Contract code | Variable | Paid by contract account |
289
290## SDK Collections Reference
291
292| Collection | Iterable | Clear | Ordered | Range | Use Case |
293|------------|----------|-------|---------|-------|----------|
294| `Vector` | Yes | Yes | Yes | Yes | Ordered list with index access |
295| `LookupMap` | No | No | No | No | Fast key-value, no iteration needed |
296| `LookupSet` | No | No | No | No | Fast membership checks |
297| `IterableMap` | Yes | Yes | Yes | No | Key-value with iteration |
298| `IterableSet` | Yes | Yes | Yes | No | Set with iteration |
299| `UnorderedMap` | Yes | Yes | No | No | Key-value, unordered iteration |
300| `UnorderedSet` | Yes | Yes | No | No | Set, unordered iteration |
301| `TreeMap` | Yes | Yes | Yes | Yes | Sorted key-value with range queries |