NEAR Core: Reference client for NEAR Protocol
Reference implementation of NEAR Protocol blockchain, providing infrastructure for smart contracts and applications.
Learn more about NEAR Core
NEAR Core is the reference implementation of NEAR Protocol, a blockchain platform designed for smart contracts and decentralized applications. The implementation is written in Rust and supports WebAssembly-based smart contracts, providing a complete node software for participating in the NEAR network. The architecture focuses on usability and scalability through sharding and other consensus mechanisms. Developers use NEAR Core to run validator nodes, build applications, or contribute to the protocol's development.
WebAssembly Support
Executes smart contracts compiled to WebAssembly, allowing developers to write contracts in multiple programming languages including Rust and JavaScript.
Sharding Architecture
Implements a sharded blockchain design to improve transaction throughput and network scalability compared to single-chain architectures.
Multiple Networks
Supports mainnet, testnet, and betanet environments, allowing developers to test and deploy applications across different network configurations.
use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize};
use near_sdk::{env, near_bindgen, AccountId, Balance, Promise};
use std::collections::HashMap;
#[near_bindgen]
#[derive(BorshDeserialize, BorshSerialize)]
pub struct TokenContract {
balances: HashMap<AccountId, Balance>,
total_supply: Balance,
}
impl Default for TokenContract {
fn default() -> Self {
Self {
balances: HashMap::new(),
total_supply: 0,
}
}
}
#[near_bindgen]
impl TokenContract {
pub fn transfer(&mut self, receiver_id: AccountId, amount: Balance) {
let sender_id = env::predecessor_account_id();
let sender_balance = self.balances.get(&sender_id).unwrap_or(&0);
assert!(sender_balance >= &amount, "Insufficient balance");
self.balances.insert(sender_id.clone(), sender_balance - amount);
let receiver_balance = self.balances.get(&receiver_id).unwrap_or(&0);
self.balances.insert(receiver_id, receiver_balance + amount);
}
pub fn get_balance(&self, account_id: AccountId) -> Balance {
self.balances.get(&account_id).unwrap_or(&0).clone()
}
}Performance optimizations and bug fixes for state sync and indexer
- –State sync performance optimization
- –Indexer fix for double hashing of code as part of DeployContract and DeployGlobalContract actions
- –GlobalContractIdentifierView serialization fix
Critical security release fixing network code flaws that could cause node crashes
- –Fixes critical flaws in network code that could cause node crash
- –Upgrade as soon as possible to avoid node downtime
Network traffic and data copying optimizations for state snapshots and archival nodes
- –Optimize the network traffic involved in distributing state snapshot information between nodes
- –Optimize data copying to make sure archival node can keep up with the chain
Top in Crypto
Related Repositories
Discover similar tools and frameworks used by developers
Agave
Blockchain validator software designed for fast, secure, and scalable decentralized applications and marketplaces.
Kubo
The first and most widely used IPFS implementation, providing distributed file storage and content addressing.
Bitcoin Core
Reference implementation of the Bitcoin protocol that connects to the peer-to-peer network for block validation.
Foundry
A modular toolkit for Ethereum application development that includes compilation, testing, and deployment tools.
MetaMask Extension
Browser extension that provides wallet functionality for interacting with Ethereum blockchain applications.
Related Reading
Guides and comparisons from the Greptile content library
How to ACTUALLY Think About Code Reviews: The 3-Layer Checklist
A code review checklist and best practices organized around three layers — Mechanical, Structural, and Narrative — that help any team improve code quality without slowing reviews down.
Greptile Ranks #1 on Martian's AI Code Review Benchmark
Greptile ranks #1 on Martian's independent online AI code review benchmark, leading all evaluated tools in F1 score and precision with near-leading recall.
Guide to Self-Hosted AI Code Review for GitLab and GitHub Enterprise [2026]
How self-hosted AI code review works on GitLab Self-Managed and GitHub Enterprise Server, how it compares to SaaS review tools, what to look for in a self-hosted tool, and what a self-hosted rollout actually takes.
Best AI Code Review Tools for GitLab
Enterprise-grade AI code review tools for GitLab teams. In-depth comparison of accuracy, security, and integration features to accelerate your merge request workflows.