// the find
near/near-sdk-rs
Rust library for writing NEAR smart contracts
The official Rust SDK for writing smart contracts on the NEAR blockchain. You decorate a struct with `#[near(contract_state)]` and an impl block with `#[near]`, and the proc macros handle WASM serialization, ABI generation, and the boilerplate that bridges your Rust code to the NEAR runtime. If you're building on NEAR, this is the only serious option.
The macro API is genuinely well-designed — `#[payable]`, `#[private]`, `#[init]` map directly to real NEAR runtime concepts and keep contracts readable. The SDK ships `near-contract-standards` with production-ready NEP-141 (fungible token) and NEP-171 (NFT) implementations, so you're not rewriting token logic from scratch. Unit tests run without a blockchain at all since the mock environment (`VMContext`) is built in. The workspace-level `cargo-near` toolchain handles build, ABI generation, and deployment in one place, which removes a lot of friction from the deploy loop.
510 stars for the canonical SDK of a live L1 blockchain is low — NEAR's overall developer mindshare is thin, which means fewer Stack Overflow answers and fewer people who've already debugged the edge cases you'll hit. Cross-contract calls with promises are verbose and easy to get wrong; the callback pattern (schedule → await → callback) requires careful state management that the SDK gives you primitives for but no guardrails against misusing. Upgradability is in `near-contract-standards` but the story for migrating contract state across schema changes is manual and not prominently documented. The MSRV policy explicitly warns that security patches may silently bump the minimum Rust version, which is a real annoyance in CI pipelines that pin toolchains.