Skip to content

Near

NEAR Protocol is a developer-friendly, sharded blockchain platform that aims to solve scalability issues through its unique Nightshade technology. NEAR is designed to be highly accessible, with a focus on usability and low barriers to entry for both developers and end-users. The protocol uses a novel sharding approach called “Nightshade” that allows parallel processing of transactions across multiple shards.


FeatureValueDescription
ConsensusNightshadeCustom sharding mechanism with Doomslug consensus
Block Time~1 secondFast block production
TPS100,000+Theoretical max across all shards
Finality1-2 blocksNear-instant finality
ShardingDynamicAdaptive number of shards
TokenNEARNative cryptocurrency
┌─────────────────────────────────────────────────────────────┐
│ NEAR NIGHTSHADE │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Beacon Chain │ │
│ │ (Phase 0 - Later) │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
│ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ │
│ │Shard│ │Shard│ │Shard│ │Shard│ │Shard│ │
│ │ 0 │ │ 1 │ │ 2 │ │ 3 │ │ 4 │ │
│ └──┬──┘ └──┬──┘ └──┬──┘ └──┬──┘ └──┬──┘ │
│ │ │ │ │ │ │
│ ▼ ▼ ▼ ▼ ▼ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Chunk Producers (One per shard) │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Block Producers (Chunk Only) │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
ParameterValue
Total Supply1 billion NEAR
Inflation5% initially, decreasing over time
Staking Reward~4% APY for validators
Transaction FeesBurned (deflationary)

Node TypeDescriptionStorageRequirements
ValidatorParticipates in consensus~500GB+High (staked)
RPC NodeProvides API services~500GB+Medium-High
Archive NodeFull history storage~2TB+Very High
Chunk ProducerProduces shards~500GB+High
Light ClientVerifies proofs onlyMinimalLow

Terminal window
# Hardware Requirements (Validator/RPC)
- CPU: 16+ cores (AMD Zen 2+ or Intel Ice Lake+)
- RAM: 32-64 GB
- Storage: 1 TB NVMe SSD
- Network: 100 Mbps minimum
# Install Dependencies
sudo apt-get update
sudo apt-get install -y \
build-essential \
git \
curl \
wget \
tar \
cmake \
clang \
libssl-dev \
pkg-config \
libncurses5
Terminal window
# Install nearup
pip3 install nearup
# Or use standalone binary
wget https://github.com/near/nearcore/releases/download/2.1.0/nearcore-2.1.0-x86_64-unknown-linux-gnu.tar.gz
tar -xzf nearcore-2.1.0-x86_64-unknown-linux-gnu.tar.gz
# Initialize nearcore
cd nearcore
./target/release/neard init --chain-id mainnet
Terminal window
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/env
# Install protobuf
sudo apt-get install -y protobuf-compiler
# Clone nearcore
git clone https://github.com/near/nearcore.git
cd nearcore
# Checkout stable version
git checkout 2.1.0
# Build
cargo build --release -p neard
# This may take 30+ minutes
Terminal window
# Pull official image
docker pull nearprotocol/nearcore:v2.1.0
# Run RPC node
docker run -d \
--name near-node \
-v ~/.near-data:/near/data \
-p 3030:3030 \
-p 2456:2456 \
nearprotocol/nearcore:v2.1.0 \
neard run
# Run with custom config
docker run -d \
--name near-node \
-v ~/.near-data:/near/data \
-p 3030:3030 \
-p 2456:2456 \
nearprotocol/nearcore:v2.1.0 \
neard run \
--chain-id mainnet \
--bootnodes ed25519:AA34680d569f37a0...

~/.near/config.json
{
"genesis_file": "genesis.json",
"genesis_records_file": "genesis_records.json",
"validator_key_file": "validator_key.json",
"node_key_file": "node_key.json",
"rpc": {
"addr": "0.0.0.0:3030",
"allowed_origins": ["*"],
"cors": ["*"],
"rate_limit": {
"enabled": true,
"requests_per_minute": 1000
}
},
"network": {
"addr": "0.0.0.0:2456",
"boot_nodes": "ed25519:AA34680d569f37a0...",
"max_num_peers": 40,
"handshake_timeout": 20,
"reconnect_delay": 5,
"tsunami_mode": false
},
"consensus": {
"min_num_peers": 3,
"epoch_length": 43200,
"aggregate_signature": true
},
"tracked_shards": [0, 1, 2, 3, 4, 5, 6, 7],
"archive": false,
"save_trie_changes": false
}
~/.near/mainnet.env
export NEAR_ENV=mainnet
export RUST_LOG=info
export RUST_BACKTRACE=1
# For high performance
export NEARCLERK_DIR=/data/near
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4317
Terminal window
# Create systemd service
sudo nano /etc/systemd/system/near.service
[Unit]
Description=NEAR Protocol Node
After=network.target
[Service]
Type=simple
User=near
WorkingDirectory=/home/near
ExecStart=/home/near/nearcore/target/release/neard run --chain-id mainnet
Restart=always
RestartSec=10
StandardOutput=append:/home/near/near.log
StandardError=append:/home/near/near.log
[Install]
WantedBy=multi-user.target
Terminal window
# Enable and start
sudo systemctl daemon-reload
sudo systemctl enable near
sudo systemctl start near
# Check status
sudo systemctl status near
# View logs
journalctl -fu near

EndpointPortDescription
HTTP RPC3030Main RPC interface
WebSocket3030Subscription interface
Prometheus20001Metrics
Terminal window
# Mainnet
https://rpc.mainnet.near.org
https://rpc.mainnet.near.wallet.geyser(apps.ctafarm.io/...)
https://rpc.playnet.pikespeak(dao.pikespeak.io/...)
# Testnet
https://rpc.testnet.near.org
Terminal window
# Check node status
curl -s https://rpc.mainnet.near.org/status | jq
# Get current block
curl -s https://rpc.mainnet.near.org/block | jq
# Get block by height
curl -s https://rpc.mainnet.near.org/block?block_id=100 | jq
# Get chunk
curl -s https://rpc.mainnet.near.org/chunk?chunk_id=123456 | jq
# Get transaction
curl -s https://rpc.mainnet.near.org/tx/<TX_HASH> | jq
# Get account
curl -s https://rpc.mainnet.near.org/account/<ACCOUNT_ID> | jq
# Get account balance
curl -s https://rpc.mainnet.near.org/balance/<ACCOUNT_ID> | jq
# Get validators
curl -s https://rpc.mainnet.near.org/validators | jq
# Get gas price
curl -s https://rpc.mainnet.near.org/gas_price | jq
# Get protocol config
curl -s https://rpc.mainnet.near.org/experimental_protocol_config | jq
Terminal window
# Using near-api-js
const { connect, keyStores } = require('near-api-js');
const config = require('./config');
async function getBalance() {
const near = await connect({
...config,
keyStore: new keyStores.BrowserLocalStorageKeyStore()
});
const account = await near.account('example.near');
const balance = await account.getAccountBalance();
console.log(balance);
}
Terminal window
# Using CLI
near view <account_id> <method_name> <args>
# Example: View lockup contract
near view lockupxxxxx.tnear get_owner
Terminal window
# Change method (requires signing)
near call <contract_id> <method_name> <args> --accountId <your_account>
# View method (read-only)
near view <contract_id> <method_name> <args>

NEAR uses a delegated Proof of Stake system. Validators are selected based on stake.

RequirementValue
Minimum StakeDetermined by seat price (varies)
HardwareSee validator requirements
Uptime>95% required
Terminal window
# Create account
near create-account <account_id> --useFaucet
# Generate validator key
near generate-key <account_id>
# Copy to working directory
cp ~/.near-credentials/testnet/<account_id>.json ~/.near/validator_key.json
Terminal window
# Stake via CLI
near stake <account_id> <staking_key> <amount>
# Example: Stake 1000 NEAR
near stake my-validator --amount 1000
Terminal window
# Check validator info
curl -s https://rpc.mainnet.near.org/validators | jq '.current_validators[] | select(.account_id | contains("myvalidator"))'
# View staking pool info
near view <pool_account> get_accounts_delegated_balance_of {"account_id": "your_account"}
# Delegate to pool
near call <pool_account> deposit "{}" --accountId <your_account> --amount 100

Terminal window
# Install near-cli
npm install -g near-cli
# Or use nearup
nearup
Terminal window
# Install create-near-app
npm install -g create-near-app
# Create new project
create-near-app my-near-dapp
cd my-near-dapp
# Install dependencies
npm install
# Start local blockchain
npm run dev
// lib.rs - Example Rust contract
use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize};
use near_sdk::{env, near_bindgen};
#[near_bindgen]
#[derive(BorshDeserialize, BorshSerialize)]
pub struct Counter {
count: u32,
}
impl Default for Counter {
fn default() -> Self {
Self { count: 0 }
}
}
#[near_bindgen]
impl Counter {
pub fn get_count(&self) -> u32 {
self.count
}
pub fn increment(&mut self) {
self.count += 1;
env::log(format!("Count: {}", self.count).as_bytes());
}
pub fn decrement(&mut self) {
self.count -= 1;
env::log(format!("Count: {}", self.count).as_bytes());
}
pub fn reset(&mut self) {
self.count = 0;
}
}
Terminal window
# Build contract
cd contract
cargo build --target wasm32-unknown-unknown --release
# Deploy
near deploy <contract_id> --wasmFile path/to/contract.wasm
# Initialize
near call <contract_id> new '{}' --accountId <account_id>

prometheus.yml
scrape_configs:
- job_name: 'near'
static_configs:
- targets: ['localhost:20001']
MetricDescriptionAlert
near_block_production_delayBlock production delay> 1s
near_chunk_production_delayChunk production delay> 2s
near_validator_uptimeValidator uptime< 95%
near_gas_usedGas used per block-
near_transactions_countTransactions per block-
Terminal window
# Check node health
curl -s http://localhost:3030/health | jq
# Check network info
curl -s http://localhost:3030/network_info | jq
# Check sync status
curl -s http://localhost:3030/status | jq '.sync_info'

Terminal window
# Check disk usage
df -h
# Clear old data (if not validator)
rm -rf ~/.near/data
# Restart to reinitialize
systemctl restart near
Terminal window
# Check if you're in validator set
curl -s https://rpc.mainnet.near.org/validators | jq '.current_validators[] | select(.account_id == "your_account")'
# Check your stake
near view <pool_account> get_accounts_delegated_balance_of {"account_id": "your_account"}
Terminal window
# Clear database and resync
pkill -f neard
rm -rf ~/.near/data
systemctl restart near
# Check logs
tail -f ~/.near/near.log
Terminal window
# Increase swap
sudo fallocate -l 16G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

Terminal window
# Connect to testnet
nearup testnet
# Or manually
cd nearcore
./target/release/neard init --chain-id testnet
./target release/neard run --chain-id testnet
Terminal window
# Start local network
cd nearcore
cargo build --release
./target/release/neard init
./target/release/neard run
# Or use multiple nodes
./target/release/neard localnet

  • NEAR Protocol uses Nightshade sharding for high scalability
  • Block time is ~1 second with theoretical TPS of 100,000+
  • Node setup requires building from source or using nearup tool
  • RPC runs on port 3030, metrics on port 20001
  • Validators must meet minimum stake requirements (seat price)
  • NEAR CLI provides easy interaction with the network
  • Smart contracts can be written in Rust or AssemblyScript
  • Public RPC endpoints are available for testing without running a node

This completes the comprehensive Blockchain Node Guide! You now have detailed knowledge of:

  • Ethereum nodes (Geth, Erigon, Besu, Reth)
  • Cosmos/Tendermint chains
  • Solana nodes
  • Avalanche, Polkadot, Bitcoin, and NEAR
  • RPC APIs, security, monitoring, and troubleshooting

Practice the hands-on exercises and review the interview questions in Chapter 55 to prepare for your blockchain engineering interviews!


Last Updated: 2026-02-22