NEAR Protocol Deep Dive

NEAR Protocol Deep Dive


NEAR is a Layer 1 network that leverages a novel approach to Proof of Stake and sharding to optimize scaling and transaction speeds. NEAR’s consensus mechanism, Doomslug, and sharding framework, Nightshade, collectively enable the protocol to achieve throughput of up to 100,000 transactions per second under ideal conditions and transaction costs of less than $0.001. Beyond its L1 network, NEAR has developed a fully decentralized platform to seamlessly and securely build enterprise-grade applications. Ultimately, NEAR’s core focus can be thought of as a highly performant base layer with a permissionless application platform built on top of it.

Framing the Problem: Layer 1 and dApp Platform Limitations

The shortcomings and tradeoffs facing existing Layer 1 networks are well-known. In many cases they are a function of the trilemma between security, scalability, and decentralization, and stem from the underlying rules and consensus mechanism that govern a blockchain. Ethereum, for instance, requires that every node in the network needs to process every single transaction. As a result, it can only process about 20 transactions per second on the main chain. During times of high activity this leads to extremely high gas prices and long confirmation times. In general, a new block is produced every 10–20 seconds, but it actually takes roughly 1.2 minutes for a transaction to be added to the blockchain. Scaling the Ethereum network, therefore, becomes quite challenging as it faces hurdles of expensive transaction prices, low throughput, and high latency.

These limitations found within the blockchain layer can extend to the applications built on top of it. One area in particular is cloud computing. Current solutions fail to bridge the gap between highly performant, decentralized cloud computing and mainstream adoption. Part of the reason is that many of the proposed solutions do not scale, are quite expensive, and do not have industry-grade throughput. As a result, the only viable options are applications that run on traditional cloud services such as AWS and Azure, which come with a variety of inherent risks due to their centralized underpinnings. For instance, users are beholden to any centralized platform to act honestly and maintain their data.

Even under the assumption of an honest operator, these platforms are vulnerable to other exogenous threats such as government interventions and hacker attacks to steal, modify, or censor personal user data. They are also subject to risks associated with a single point of failure and decidedly permissioned. Ultimately, users must ask for permission to be able to create content and deploy applications on the dominant platforms. This hinders innovation and monopolizes large ecosystems of Web2.

Doomslug and Nightshade: Innovating Layer 1

NEAR attempts to overcome these challenges in a very practical way. Starting at the blockchain layer, their instantiation of Doomslug, a novel consensus mechanism, and development of Nightshade sharding, will fundamentally change the way in which the network scales and is able to deliver extremely performant services. NEAR’s goal is to develop a network that can scale without limit, onboard billions of users, and deploy enterprise-grade applications.

Doomslug enables a set of block producers to create new blocks with a single round of communication per block. Unless a block producer is found to have acted maliciously or inaccurately, in which case they are slashed, each block is considered irreversible.

Digging a bit deeper, Doomslug selects a set of block producers at random to take turns producing and broadcasting blocks. Once a specific block height is received by other participants, they then send endorsements on the given block to the block producer assigned to produce and broadcast the next block height. Transactions can only be reversed in the event of a slashing incident and each block only needs to receive an endorsement (or skip message) from more than half of the block producers to be confirmed. Even if the network is slow and messages are delayed, a block that contains endorsements from more than half the block producers will be created at some point. This means that the algorithm will not stall under harsh conditions.

So the key benefits of Doomslug is that it facilitates block production after just one round of communication and it maintains liveness even if close to one half of the block producers are offline. Both attributes are incredibly powerful and enable NEAR to achieve fast block production functionality.

In order to optimize scaling and performance, NEAR has developed a sharding solution, Nightshade. In short, a key limitation of blockchains is that they can become congested as user adoption grows and network activity increases. Sharding effectively splits the workload of processing transactions across many different participating nodes and enables a network to scale more efficiently, since each shard only handles a fraction of the total work being done. As a result, sharding can help achieve increased speed and performance without compromising security. Nightshade can scale linearly with the number of shards, giving NEAR the ability to meet the demands for mass adoption of the network and onboard billions of users. Ultimately, Nightshade’s capacity is theoretically limitless, since it can continuously increase the number of shards, which can then handle millions of transactions per second.

The fundamental difference between Nightshade and other methods of sharding is that it assumes all of the shards combine together to produce a single block. This block is produced with a regular cadence irrespective of whether each individual shard has produced its “chunk” for that specific block height. Therefore, every chunk for each shard will either be present or not.  Nightshade assigns a single validator for each block and this validator must also assemble the chunks which are provided to it during that block’s time period into the period’s block. Nightshade rotates validator assignment through a pool of existing validators.

In terms of each individual shard and period, Nightshade assigns a single validator to produce its chunk. If that validator is not present (e.g. offline), the shard will stall for that period. Each shard has its own smaller pool of validators which is pulled from the main pool. Similar to the process by which the overall block leader (i.e. validator) rotates, the shard leader position also rotates. Nightshade selects shard leaders from a pool of existing candidates. If a single validator is absent and the shard chunk stalls for one period, there is a high probability that the next validator will be present to continue the chain’s operation in the following period. So in this sense, the chain does not truly stall.

NEAR is deploying Nightshade in four stages to help ensure a frictionless and secure transition to the final iteration:

  • Phase 0: Simple Nightshade instantiation and splitting the NEAR state into four shards. This significantly increased the throughput of the network. To put this into perspective, Simple Nightshade's deployment increased token transfer transaction speeds from about 800-1000 TPS to a minimum of 2500-3000 TPS.
  • Phase 1: Chunk-only producers, participants who only validate one shard, are introduced. This creates a role in which participants only produce chunks (shard blocks) for some specific shard and are not required to use inexpensive hardware. without sacrificing the security of the network. This helps increase the total number of validators and improve the decentralization of NEAR as a whole. Overall, the goal of this phase is to have 200-400 total validators, and only a fraction of which will need to run more expensive hardware.
  • Phase 2: NEAR will then shift to eliminating the need for any validators to track all the shards. Both state and processing will be fully sharded at this point and hardware requirements of running a block producer on NEAR will be further reduced, making the network more accessible for validators and more decentralized in general.
  • Phase 3: The final iteration of Nightshade will implement a fully functional sharded mainnet with a fixed number of shards. The key feature here is that NEAR will create the ability for the network to dynamically split and merge shards based on resource utilization. This will make NEAR almost infinitely scalable and resilient to short-term usage spikes. Eventually, the network itself will dynamically adjust the number of shards based on their utilization and no validators will need to validate all of the shards.

NEAR’s Decentralized Application Platform

As the computational layer is developed, NEAR is building a community-operated, decentralized platform for deploying highly performant dApps. The goal of NEAR’s platform is to serve as the infrastructure for delivering intuitive experiences for end users, scalability for mass adoption, and sustainable business models for developer applications in a truly permissionless nature. The platform’s decentralized design and widely distributed community of node operators ensure that data cannot be censored, modified or removed without the consent of the users that it serves.

dApps running on the platform have access to a shared pool of capital, identity, and data which is owned by its users, rather than a centralized entity. In general, its core functions can be thought of as a decentralized database and serverless computer platform that users leverage to engage in activity. One of the key advantages is its infrastructure composition, which is created from a potentially infinite number of nodes run by users who offer portions of their CPU and hard drive space (e.g. via personal computers, professionally deployed servers).

Developers can then create smart contracts and deploy them as if they were deploying to a single server. Overall, the process is very similar to how applications are deployed to existing centralized clouds. The payment and usage model is also similar to existing systems: NEAR requires users and developers to pay operators for usage of the infrastructure. Prices are structured upon easily understandable metrics that are not heavily influenced by factors like system congestion, which create undue complexity. Updates to the protocol are generated by the community and must be accepted by a sufficient quorum of the network participants.

One of the more interesting aspects of NEAR is its developer-friendly business model in which developers receive tokens proportional to the usage of the apps they create. More specifically, developers are rewarded whenever a contract that they created is called. A portion of the fees (30%) generated by the network are automatically allocated to that contract and can be withdrawn by its developer. This is a powerful incentive that facilitates early infrastructure development (e.g. early contracts will build network effects) and creates a sustainable, long-term business model for developers.

From an end-user perspective, NEAR has a decidedly simple onboarding process. Users are not required to provide a wallet address or interact with the native token as a prerequisite of being able to use the applications. NEAR also enables developers to pay for usage on behalf of their users in order to hide the costs of infrastructure in a way that is in line with familiar web usage paradigms. NEAR has made a decided effort around predictable pricing. Part of the protocol’s core focus is on keeping transaction costs in simple terms to allow end-users to experience predictable pricing and less cognitive load when using the platform.


In terms of NEAR’s performance, there are currently 793 nodes online powering the network, with 100 nodes acting as validators. This has helped NEAR realize an average block time of around 1.17 seconds.

Daily activity has increased over time, with over 500,000 transactions each day during the month of May and cumulative transactions growing to over 100,000,000 since September 2021.

Looking into recent activity a bit deeper, NEAR serviced over 600,000 transactions nearly each day during the last half of May, with gas prices of 0.0001 $NEAR, making it an extremely cost effective Layer 1 solution.

During this same period the number of daily new users surged and the network achieved its most successful user growth to date.

NEAR also realized a significant uptick in active accounts in March 2022 as nearly 1.2 million accounts were using the network on the rolling 30 day average, with daily active accounts reaching over 200,000 during this same period.


NEAR token use
$NEAR is the network's native token and has utility and governance functionalities. Users can pay for processing transactions and storing data using $NEAR and validators can stake $NEAR to run a node. Moreover, token holders can participate in governance by staking $NEAR to submit proposals and vote on existing proposals to upgrade the protocol. In general, governance decides how the protocol is updated (e.g. fixing bugs, updating system parameters) and how its resources are allocated (e.g. allocating grants). $NEAR is also used as an incentive mechanism for developers to build applications and receive a portion of the transaction fees that their contract generates.

In exchange for producing blocks and chunks and providing security and data availability, validators are rewarded with $NEAR every epoch (i.e. 12 hours). The target value of this reward is computed in such a way that it will be 4.5% of the total supply on an annualized basis. Token holders that do not wish to run nodes can stake their tokens and delegate to validators to earn rewards on the network. Currently this reward is about 9% APY.

Developers receive a portion of the fees generated by a particular transaction in the form of a “contract reward.”  The percentage of fees that are allocated to this reward is set to a minimum value of initially 30%. This parameter can be modified by governance and  developers can charge extra fees outside of this mechanism by requiring users to attach funds to the call. So there is a strong incentive for developers to build meaningful smart contracts that go on to be widely used as they are directly compensated in proportion to the usage of these contracts. This also creates an incentive for other developers to continuously iterate existing code in order to capture these fees by optimizing smart contracts wherever possible. Another feature of this approach is that establishing a minimum fee at the system level avoids a “race to the bottom” which results in zero rewards due to competition (or simply the “forking out” of the fee by another developer).

The NEAR Treasury receives 10% of the inflation, or a total of 0.5% annually. This is provisioned for ecosystem development.

There are six main agents that operate within the NEAR network. Validators run nodes which power the network and provide computational resources and security. Developers build dApps which run atop the network, while users consume these dApps. There are also token holders which can be thought of as simply accounts or applications that maintain a token balance at a given time as well as third party observers which proactively monitor the network for fraud detection. Finally, the NEAR Foundation is an independent entity which coordinates the governance and protocol upgrade efforts of the network participants.

NEAR’s token inflation is calculated as such:

[payouts to validators + the protocol treasury] - the collected tx fees

The maximum inflation of the network is 5% per annum. This rate can change over time as the network activity increases and more transaction fees are burned.

Ultimately, inflation is determined by how large the epoch reward is for running a validating node. The rate of minting of new tokens is capped at 5% per annum and the effective rate is computed per epoch (every 12 hours) by calculating the expected inflation rate per epoch minus the fees collected during the epoch.  Each portion of fees captured by the platform is removed from inflation, thus reducing the overall inflation of the system as its usage increases. If the system’s usage fees reliably exceed the tokens generated by the inflation, it will become deflationary.