Expected result: basic understanding on how NEAR works from end-user perspective
NEAR is a decentralized application platform which runs atop the NEAR Protocol blockchain. This blockchain, which runs across hundreds of machines around the world, is organized to be permissionless, performant and secure enough to create a strong and decentralized data layer for the new web,
NEAR’s main mission is to present a platform that’s ideal for running applications that have access to a shared — and secure — pool of money, identity and data which is owned by their users. It combines the features of partition-resistant networking, serverless compute and distributed storage into a new kind of platform.
So, before we go any further, let’s learn some of the backstory and see how blockchain platforms have evolved over time.
The Evolution of Blockchain Technology
Ever since Satoshi Nakamoto released the Bitcoin whitepaper in October 2008, the world has gotten acquainted with the game-changing blockchain technology. Over the last decade, the blockchain has gone through three stages of evolutions.
Generation 1: Bitcoin
Bitcoin is the perfect example of the first-gen blockchain. The purpose of this blockchain is to be a simple and straightforward payment system. Starting out as the “internet’s currency,” Bitcoin has since become one of the most in-demand asset classes. However, there is a major problem when it comes to BTC. It is infeasible to conduct complicated transactions with them which may have several layers of metadata and logic attached to it.
Generation 2: Ethereum and Smart Contract Platforms
Ethereum ushered in the second-gen blockchain platforms with smart contracts. Finally, developers were able to program sophisticated transactions through these smart contracts, and were able to create decentralized applications (dApps). Through these dApps, the blockchain’s use cases went through the roof.
However, this space has been struggling with its growing pains. The main thing is that these blockchains are suffering from severe scalability issues. For example, Bitcoin has a throughput of 7 transactions per second, while Ethereum can only manage 25. When you compare that with PayPal (115 tps) and Visa (1,700 tps), it’s pretty abysmal.
To be fair, Ethereum and Bitcoin have recently been trying to fix these scalability issues with several layer-two solutions like lightning network, raiden, plasma protocol etc. The idea here is to create an additional layer over the underlying blockchain which the main protocol can delegate repetitive and cumbersome tasks too.
However, there are two issues with this approach. Firstly, these layer-2 solutions haven’t yet achieved acceptance from the masses. Secondly, these layer-2 solutions ruin the original architecture of the protocol, which may have long-lasting implications.
This is where the third generation comes in.
Generation 3: NEAR
NEAR is an example of gen-3 blockchains, which aim to solve the scalability issues and allow both the end-users and developers to enjoy the full potential of smart contracts and blockchain technology. Instead of relying on layer-2 tech, NEAR breaks free from the idea that every single node which participates in the network has to run all of the code because that essentially creates one big wasteful bottleneck and slows down all of the other approaches.
To fix this issue, NEAR uses a technique that is already extremely prevalent in the database world – sharding. If properly executed, it allows the network’s capacity to scale up as the number of nodes in the network increases so there isn’t a theoretical limit on the network’s capacity. The best part? Sharding is a layer-1 scalability technique.
What is Sharding?
In a database, you sometimes have to deal with large bulky data. This dramatically hinders performance and throughput and it makes the entire process extremely inefficient. This is where sharding comes in.
Sharding does a horizontal partition of your database and turns into smaller, more manageable tables.
So, why a horizontal partition and not a vertical partition?
Consider this table:
Now, if we were to partition this table vertically:
Because of the partition, the table turns into two completely different tables.
As opposed to that, what happens when the table gets partitioned horizontally:
Do you see what happens? When you vertically partition a table they tend to become two completely different tables altogether.
However, if we were to partition them horizontally:
A horizontal partition turns the database into smaller tables of the same database. These smaller databases are called shards.
How does Sharding Help Blockchain?
As we have seen so far, as more and more nodes enter the Ethereum and Bitcoin ecosystem, the entire consensus and verification process takes even more time. Now, what will sharding do to help this?
Sharding is going to break the global state of the blockchain into tinier more manageable shards.
What happens on shard activation?
- The state gets split into shards
- Every single unique account is in one shard, and the accounts in that shard will only transact with the other accounts in the same shard.
In simplistic terms, imagine this scenario. There is a hypothetical network with three nodes- A, B, and C and they have to verify data T. The data T is broken down into three shards T1, T2, and T3. Instead of all these nodes working on T as a whole, they can individually work on a shard at the same time. As you can see the amount of time you are saving is exponential.
Unlike a lot of other sharding approaches, which still require nodes to be run on increasingly complex hardware (reducing the ability of more people to participate in the network), NEAR’s technique allows nodes to stay small enough to run on simple cloud-hosted instances.
Why are scalable blockchains like NEAR necessary?
Hint: It’s not all about speed!
When it comes to second and third gen blockchains, what truly determines its innate value is the dapp ecosystem that thrives on top of it. As such, most of these blockchain platforms are in a perpetual competition to attract as many developers as possible.
However, the problem with the current platforms is that they don’t have the sophistication required to host high quality apps. The issue here is that we have developers trying to create PS4 games on a platform that’s equivalent to Windows 98. As such, they need to heavily compromise on the overall functionality of their dApps.
Plus, there is another factor that should be considered here. Speed is a vital factor when it comes to application usability. After all, why are users going to use an application if it’s not usable at all? Developers require a set number of users to continually use their applications before it reaches critical mass.
This is why a blockchain platform that’s scalable like NEAR is important for the mainstream adoption of blockchain and smart contracts.
NEAR allows developers to just deploy their app without thinking too much about how the infrastructure around it operates or scales, which is more like the modern clouds like Amazon AWS or GCP or Azure which drive almost all of today’s web applications.
NEAR Brief history
NEAR started in summer of 2018 upon Alex Skidanov and Illia Polosukhin deciding to pivot away from their previous entrepreneurial adventure, if you’re curious you can read more about it here. Very quickly, as Misha quit MemSQL, the team expanded from several to 9 people within 3 days in August. Initial team consisted of 7 engineers, Erik doing business operations, and Sasha talking to the market.
Today NEAR Collective is the globally distributed group of teams, made up of many individual organizations and contributors, who self-organize in order to bring this technology to life. It is not a business or anything nearly so formal. Think of it instead like the groups of people who run large open-source software projects.
One of the Collective’s projects is writing the initial code and the reference implementation for the open source NEAR network, sort of like building the rocket boosters on the space shuttle. Their job is to do the necessary R&D work to help the blockchain get into orbit. The code for that chain is open source so literally anyone can contribute to or run it.
It’s important to stress that networks like NEAR are designed to be totally decentralized. This means they ultimately operate completely on their own and can’t actually be censored, shut down or otherwise messed with by third parties… not even the teams who initially built them! So, while members of this collective are here to get the ball rolling on building the reference implementation, they quickly become nonessential to the operation of the network once it has started running. In fact, once it’s launch-ready, anyone could modify and run the NEAR Protocol code to start up their own blockchain because it’s all open source and any changes would have to be democratically accepted by the independent validators who run it.
How NEAR Blockchain works
The technology underpinning cryptocurrency. Blockchain is a technology that can safely store transaction records on a peer-to-peer network instead of storing them in a single location. Independent servers around the world, called nodes, make up the network that operates the blockchain.
One of the most defining aspects of blockchain technology is decentralization. So, why is decentralization useful? Let’s look at it from the perspective of developers and end users.
- Developers: In the centralized world, the developers are often at the mercy of cloud platforms or even the government to make sure that they can continue to run the apps. In the decentralized world, there are no domineering intermediaries.
- End Users: The transparency of decentralized applications can allow users to see the backend code and know exactly how the apps are going to use your personal information.
What is the NEAR consensus algorithm?
Consensus protocols are used to reach agreement on a single value between multiple participants in a system. If all network participants collaborate in accordance with the consensus protocol, new values may be appended to the ledger and verified by nodes. However, in the case of disputes, the network may focus on either safety or liveness.
The consensus mechanism implemented on NEAR is called Nightshade. Nightshade models the system as a single blockchain. The list of all the transactions in each block is split into physical chunks, one chunk per shard. All chunks accumulate to one block. Note that chunks can only be validated by nodes that maintain the state of that shard.
Speaking of validation, a key component of the NEAR are the validators. These validators are responsible for maintaining consensus within the protocol. Validators are specialized nodes that need to keep their servers online 100% of the time while keeping their systems continually updated.
Here are a few points that you must keep in mind about network validators.
- NEAR determines its network validators every new epoch, electing them based on their stake.
- The already elected validators are re-enrolled by automatically re-staking their tokens plus the accrued rewards
- Potential validators have to have their stake above a dynamically determined level.
- There are two methods that a validator can use to strengthen their stake – buy the tokens themself or borrow via stake delegation.
- The reward you receive is directly proportional to your stake. More your stake, more your rewards.
The consensus is based on the heaviest chain consensus. Meaning, once a block producer publishes a block, they collect the signatures of validator nodes. The weight of a block is then the cumulative stake of all the signers whose signatures are included in the block. The weight of a chain is the sum of the block weights. Additionally, the consensus utilises a finality gadget that introduces additional slashing conditions for higher chain security.
Express Quiz: The weight of a block is:
Runtime layer is used to execute smart contracts and other actions created by the users and preserve the state between the executions. It can be described from three different angles: going step-by-step through various scenarios, describing the components of the runtime, and describing the functions that the runtime performs.
What is NEAR token?
NEAR token is the fundamental native asset of the NEAR ecosystem and its functionality is enabled for all accounts. Each token is a unique digital asset similar to Ether which can be used to:
- Pay the system for processing transactions and storing data.
- Run a validating node as part of the network by participating in the staking process.
- Help determine how network resources are allocated and where its future technical direction will go by participating in governance processes.
The NEAR token enables the economic coordination of all participants who operate the network plus it enables new behaviors among the applications which are built on top of that network.
How to start with NEAR?
Before you get started with NEAR, the first thing that you want to do is to set up a NEAR account.
Watch this video about NEAR accounts:
The wallet allows you to make contract calls to the blockchain, set up your local node, and send and receive funds from other users. When you register your Account ID, you have to provide a unique name. Although every wallet has to have a unique name, every user can set-up multiple wallets.
You can imagine this similar to a Facebook or Google account. Once you have registered to either of the services, you can use the same account to log into third-party services. The difference between NEAR Account IDs and Google accounts is that the data, stored against an Account ID, is only accessible and manageable by the owner of the wallet. Additionally, all information is stored on a distributed network of nodes instead of a single server.
Create NEAR account right now: https://wallet.near.org/create
More in-depth information about Accounts at DOCS.NEAR
NEAR Explorer allows you to view block creations in real time! This useful tool allows you to search for transactions and accounts allowing you to view all interactions between users and smart contracts.
How to get NEAR tokens?
There are 4 ways to get $NEAR
FREE NEAR for Ethereum users
Start by setting up a wallet with a bit of free NEAR via faucet for Ethereum users: https://faucet.paras.id
You can earn $NEAR by taking part in development bounties, by running a community which helps people build on NEAR, by winning a NEAR hackathon or otherwise being an active part of the community. If you are able to attract other people to lend you tokens for staking, you can also earn $NEAR by running a validator.
$NEAR is available on several major exchanges (see below), where you can sign up and buy the token using either fiat currency or crypto.
Exchanges which list $NEAR
From a Friend
You don’t have to have a NEAR account to receive NEAR tokens! The “NEAR Drop” approach allows your friend to pre-fund a new account and send you a hot link to retrieve the tokens.
What can I do with NEAR tokens?
Send $NEAR back and forth between accounts of your and a friend and check out the transactions in the Block Explorer. Because transaction fees are very low, you can quickly and easily move very small amounts of $NEAR to play with it.
Send them as a gift on http://redpacket.near.org/
Try a NEAR Drop (Invite a friend)
Send your friend a NEAR drop if they need to create an account.
Use NEAR Apps
To view the growing list of apps being built on NEAR, click here.
Easy start with NFT- purchase/publish/trade art on https://paras.id/
Play at BerryClub to participate in collective art creation: https://berryclub.io/
How much does it cost to use NEAR (Gas)?
When you make calls to the NEAR blockchain to update or change data, the people running the infrastructure of the blockchain incur some cost. At the end of the day, some computers somewhere process your request, and the validators running these computers spend significant capital to keep these computers running.
Like other programmable blockchains, NEAR compensates these people by charging transaction fees, also called gas fees.
If you’re familiar with web2 cloud service providers (Amazon Web Services, Google Cloud, etc), a big difference with blockchains is that users get charged immediately when they make a call to an app, rather than developers fronting the cost of using all that infrastructure. This creates new possibilities, such as apps that have no long-term risk of going away due to developer/company funds running out. However, it also comes with some usability speed bumps. To help with this, NEAR also provides the ability for developers to cover gas costs for users, to create a more familiar experience to those coming from web2.
When thinking about gas, keep two concepts in mind:
- Gas units: internally, transaction fees are not calculated directly in NEAR tokens, but instead go through an in-between phase of “gas units”. The benefit of gas units is that they are deterministic – the same transaction will always cost the same number of gas units.
- Gas price: gas units are then multiplied by a gas price to determine how much to charge users. This price is automatically recalculated each block depending on network demand (if previous block is more than half full the price goes up, otherwise it goes down, and it won’t change by more than 1% each block), and bottoms out at a price that’s configured by the network, currently 100 million yoctoNEAR.
Note that the gas price can differ between NEAR’s mainnet & testnet. Check the gas price before relying on the numbers below.
Thinking in gas
NEAR has a more-or-less one second block time, accomplished by limiting the amount of gas per block. The gas units have been carefully calculated to work out to some easy-to-think-in numbers:
10¹² gas units, or 1 TGas (TeraGas)…
≈ 1 millisecond of “compute” time
…which, at a minimum gas price of 100 million yoctoNEAR, equals a 0.1 milliNEAR charge
This 1ms is a rough but useful approximation, and is the current goal of how gas units are set within NEAR. Gas units encapsulate not only compute/CPU time but also bandwidth/network time and storage/IO time. Via a governance mechanism, system parameters can be tweaked, shifting the mapping between TGas and milliseconds in the future, but the above is still a good starting point for thinking about what gas units mean and where they come from.
Quiz: 1 TeraGas or TGas is equal to:
1 TeraGas or TGas is equal to:
The cost of common actions
To give you a starting point for what to expect for costs on NEAR, the table below lists some common actions and how much TGas they currently require, and what the fee would be, in milliNEAR, at the minimum gas price of 100 million yN.
|Operation||TGas||fee (mN)||fee (Ⓝ)|
|Add Full Access Key||0.42||0.042||4.2⨉10⁻⁵|
How can I earn with NEAR?
Stake your NEAR
Key to the Proof-of-Stake model is how Validators are supported by the community via Staking. Validators earn NEAR token rewards for operating the nodes which run the network in the form of a static inflation rate of 5% each year, creating new tokens for Validators every epoch (~12 hours) as rewards.
Validators must maintain a minimum amount of Stake to keep their Validator seat. Token holders are able to stake with a particular Validator they believe is performing well for the network and earn a portion of Token rewards generated by the network too. This incentivizes Token holders to stay involved with the community!
The NEAR Wallet now has a staking user interface built directly into the web app.
- Select “Staking” from the navigation bar (or dropdown on mobile)
- Click the “Select Validator” button
- Choose a validator
- Confirm your choice and select “Stake with Validator”
- Enter the amount of NEAR you would like to stake, and click “Submit Stake”
You will need to confirm two transactions, one to select the validator, and another to deposit and stake with the validator.
- On the staking dashboard (/staking), select your current validator
- Click “Unstake” and confirm the transaction
After 36 to 48 hours (4 full epochs), you will be able to withdraw your stake. To do so, return to the validator page, and click “Withdraw.”
New tokens are created as rewards after epoch which is approximately every:
So, What Now? How Can I Interact With NEAR?
Alright, so what happens next? If you have read this far, you’d probably want to delve deeper into the NEAR protocol. So, the next thing you should do is checkout the NEAR whitepaper. If you are new to the blockchain and want to learn more about the tech itself, you may check out this video on deconstructing the blockchain ecosystem.
Join NEAR Discord server and check NEAR Forum