Navigate:
NEAR Core
~$NECO0.2%

NEAR Core: Reference client for NEAR Protocol

Reference implementation of NEAR Protocol blockchain, providing infrastructure for smart contracts and applications.

LIVE RANKINGS • 03:09 AM • STEADY
OVERALL
#319
84
CRYPTO
#17
4
30 DAY RANKING TREND
ovr#319
·Crypt#17
STARS
2.6K
FORKS
759
7D STARS
+5
7D FORKS
0
Tags:
See Repo:
Share:

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.

NEAR Core

1

WebAssembly Support

Executes smart contracts compiled to WebAssembly, allowing developers to write contracts in multiple programming languages including Rust and JavaScript.

2

Sharding Architecture

Implements a sharded blockchain design to improve transaction throughput and network scalability compared to single-chain architectures.

3

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()
    }
}


v2.10.5

2.10.5: State sync performance optimization: #14830

  • State sync performance optimization: #14830
  • Indexer fix for double hashing of `code` as part of `DeployContract` and `DeployGlobalContract` actions: #14840
  • `GlobalContractIdentifierView` serialization fix: #14828
v2.10.4

2.10.4: ``` CODECOLOR: CODEREDMAINNET RELEASEVERSION: 2.10.4 PROTOCOLUPGRADE: FALSE DATABASEUPGRADE: FALSE S

  • ``` CODECOLOR: CODEREDMAINNET RELEASEVERSION: 2.10.4 PROTOCOLUPGRADE: FALSE DATABASEUPGRADE: FALSE SECURITY_UPGRADE: TRUE ``` This release fixes critical flaws in network code that could cause node crash
  • Upgrade as soon as possible to avoid node downtime.
v2.10.3

2.10.3: Optimize the network traffic involved in distributing state snapshot information between 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.


[ EXPLORE MORE ]

Related Repositories

Discover similar tools and frameworks used by developers