jcarbonnell/preTrainingNEAR huggingface dataset:
P2P Validator Joins NEAR as a Node Operator
COMMUNITY
February 19, 2021
All decentralized platforms have their own disadvantages and difficulties that developers face when building decentralized applications. Ethereum scaling limitations and spiked transaction fees make operating dApps challenging, causing tangible limitations for many users.

NEAR Protocol has been in continuous design for the last few years to address the most pressing issues of blockchain application development lowering the entry barrier for end users. Successfully implemented solutions can effectively offer dApp creators high-quality toolkits improving end user experience.

NEAR’s homogeneous sharding design is specifically adapted to give developers the simplicity they need providing dynamic scalability and stabilized fees. The ultimate goal is to make building dApps simple, thus accelerating their development.

In light of the evolving nature of blockchains, P2P Validator is excited to announce the launch of NEAR node on mainnet to facilitate the development of new open financial instruments giving access to permissionless economies for the users. 

Please follow this link for a guide to staking your NEAR with P2P Validator.

Our team has extensive experience in setting up secure infrastructure for more than 15 blockchains. P2P Validator maintains high-availability nodes and provides secure staking services for the most groundbreaking projects in the blockchain space. The node infrastructure is under advanced monitoring with 24/7 technical support, backups and alerts.

About NEAR
NEAR exists to enable community-driven innovation to benefit people around the world. NEAR is a decentralized application platform that secures high value assets like money and identity with the performance necessary to make them useful for everyday people, putting the power of Open Finance and the Open Web in their hands. NEAR’s unique account model allows developers to build secure apps that consumers can actually use similarly to today’s web apps, something which requires multiple second-layer add-ons on other blockchains.

If you’re a developer, be sure to sign up for a developer program and join the conversation in NEAR Discord chat. You can also keep up to date on future releases, announcements, and event invitations by subscribing to NEAR newsletter, or following @NEARProtocol on Twitter for the latest news.

About P2P Validator
P2P Validator is a world-leading staking provider with the best industry security practices and proven expertise. At the time of publishing, more than one billion of USD value is staked with P2P Validator by over 6000 delegators across 15+ networks. We provide comprehensive due-diligence of digital assets and offer top-notch staking opportunities.
Interaction with NEAR is done with [JSON RPC API](../../5.api/rpc/introduction.md) via HTTP calls.

With the API, you can call smart contracts, send transactions, manage keys and get information about blockchain data and status.

The NEAR CLI abstracts some actions, such as deploying a contract, but eventually, all actions are done via JSON RPC.

:::info
We recommend using the CLI for deploying contracts. In a CI/CD environment, you can write a shell script to utilize the CLI for deployments.
:::

### API requests flow

There are different types of [Nodes on NEAR](./validators.md): RPC Nodes, Validators, and Archival Nodes.

When calling an endpoint on `near.org`, it resolves to a server that chooses an available RPC node to handle the request.
Then the RPC node passes the request to an available Validator node. Finally, the validator node spawns a VM environment to execute the contract.

Due to the decentralized nature of a blockchain network, there are many RPC nodes, and a request can reach any one of them, after which it can pass it to any one of the validators.

![JSON Network Arch](/docs/assets/JSONNetworkArch.png)
```bash

export COUNCIL='["bob.near"]'
export ARGS=`echo '{"config": {"name": "Primitives", "purpose": "Building primitives on NEAR", "metadata":""}, "policy": '$COUNCIL'}' | base64`

near call sputnikv2.testnet create "{\"name\": \"primitives\", \"args\": \"$ARGS\"}" --accountId bob.near --amount 6 --gas 150000000000000
```

:::note
The full list of roles and permissions you can find [here](https://github.com/near-daos/sputnik-dao-contract#roles-and-permissions).
:::
BitGo Becomes First Qualified Custodian to Support NEAR Protocol and its Assets
COMMUNITY
July 19, 2022
NEAR Foundation is excited to announce its partnership with BitGo, the leader in digital asset financial services, to create secure custodial support on the Protocol. This partnership will enable institutions to custody their tokens on BitGo’s platform using hot wallets and Qualified Custody wallets. BitGo clients will also be able to stake NEAR tokens and earn rewards through their BitGo wallets.

“BitGo is proud to become the first qualified custodian to provide services to the entire NEAR Protocol ecosystem, including holders of the NEAR token who have been searching for a secure way to store and stake their assets,” says Mike Belshe, BitGo CEO. “We are excited to deliver them safe and secure custody and staking services for their NEAR tokens and other valuable assets.”

BitGo shares with NEAR Foundation a commitment to the evolution of the Open Web.

Currently, BitGo is the largest processor of on-chain Bitcoin transactions, processing a whopping 20% (approximately) of all Bitcoin transactions around the world and supports over 500 other coins and tokens, now including the NEAR token. NEAR is so confident in BitGo that the Foundation has chosen to custody its own treasury with them and stake part of this treasury using BitGo’s wallets. 

Customers of BitGo include the largest exchanges of crypto-assets in the world as well as institutional investors across 50+ countries. Backed by Goldman Sachs, Craft Ventures, Digital Currency Group, DRW, Galaxy Digital Ventures, Redpoint Ventures, and Valor Equity Partners, BitGo is the global leader in digital asset financial services, providing liquidity, custody, and security solutions. 

NEAR Foundation CEO Marieke Flament sees the BitGo partnership as proof of the community’s commitment to widening the ecosystem, as well as creating a more diverse community of users.

“This is a significant step for NEAR and its foray into the world of institutional enterprise,” Flament adds. “With BitGo, we will support their clients and give them the ability to stake NEAR assets, both safely and securely. We are also putting our confidence into BitGo by putting a part of our own treasury in its custody because it is simply the best at what it does.”

Together we can truly make significant inroads in broadening the number of people leveraging our ecosystem and ultimately bring us closer to achieving our goal for mass web3 adoption.”

In 2020 BitGO launched Prime Trading and Lending, in addition to BitGo Portfolio and Tax, providing clients with a full-stack solution for digital assets. In 2018, it launched BitGo Trust Company, the first qualified custodian purpose-built for storing digital assets. Approaching a decade since its 2013 inception, BitGo, like NEAR, is in it for the long-haul.
---
id: unit-test
title: Unit Testing
#sidebar_label: 🧫 Unit Testing
---
import {CodeTabs, Language, Github} from "@site/src/components/codetabs"

Unit tests allow you to test the contract methods individually. They are suitable to check the storage is updated correctly, and that methods return their expected values. They are written in the contract's language and execute locally.

If you used one of our [examples](https://github.com/near-examples/docs-examples) as template, then you simply need to navigate to the contract's folder, and use `yarn test`. In case you didn't, then we recommend you copy the necessary node files (e.g. `package.json`) from one of our templates.

:::tip
You can run `yarn test` from the root folder of each project to run both unit and [integration](integration-test.md) tests.
:::

---

## Snippet I: Testing a Counter

The tests in the [Counter Example](https://github.com/near-examples/counters) rely on basic functions to check that the `increment`, `decrement`, and `reset` methods work properly.

<CodeTabs>
  <Language value="rust" language="rust">
    <Github fname="lib.rs"
            url="https://github.com/near-examples/counters/blob/main/contract-rs/src/lib.rs"
            start="50" end="71" />
  </Language>
</CodeTabs>

---

## Snippet II: Modifying the Context

While doing unit testing you can modify the [Environment variables](../anatomy/environment.md) through the `VMContextBuilder`. This will enable you to, for example, simulate calls from different users, with specific attached deposit and GAS. Here we present a snippet on how we test the `donate` method from our [Donation Example](https://github.com/near-examples/donation-examples) by manipulating the `predecessor` and `attached_deposit`.

<CodeTabs>
  <Language value="rust" language="rust">
    <Github fname="lib.rs"
            url="https://github.com/near-examples/donation-examples/blob/main/contract-rs/src/lib.rs"
            start="59" end="117" />
  </Language>
</CodeTabs>

---

## ⚠️ Limitations

Unit tests are useful to check for code integrity, and detect basic errors on isolated methods. However, since unit tests do not run on a blockchain, there are many things which they cannot detect. Unit tests are not suitable for:

- Testing [gas](../anatomy/environment.md) and [storage](../anatomy/storage.md) usage
- Testing [transfers](../anatomy/actions.md)
- Testing [cross-contract calls](../anatomy/crosscontract.md)
- Testing complex interactions, i.e. multiple users depositing money on the contract

For all these cases it is necessary to **complement** unit tests with [integration tests](integration-test.md).
---
sidebar_position: 3
---

# Build

> Creating Decentralized Frontends and components w/ BOS Web Engine

A BWE component looks, for the most part, like a standard React component. There are some syntactical variations and essential enhancements to adapt seamlessly to the engine's framework.

## Terms

- **Outer Window Application (OWA)** - The application responsible for rendering Components and brokers messages between containers.

- **Components** - The functions returning JSX to be rendered in BOS Web Engine. Their source is stored on chain in the SocialDB contract.

- **Root Component** - The top-level Component loaded by the outer application.

- **Containers** - Provide the runtime context for one or more Components. They are implemented as sandboxed `<iframe>`s,
communicating with other containers via the outer window application's `window.postMessage` method.
NEAR Community Update: February 28th, 2020
COMMUNITY
February 28, 2020
Welcome to the NEAR community update!

In this community update, we want to introduce Stardust, which is one of the projects that is building on NEAR. The Stardust API just went live, and within a few weeks of its launch, they are already supporting over 2,000 players daily. If you are creating a game, collectible art house, or any other business with NFTs (non-fungible tokens), you can use their API to help you leverage blockchain technology in under 10 lines of code. How cool is that? Reach out to Canaan to learn more and check out their website at https://stardust.gg/.

We are really excited to see what projects are building on NEAR. If you would like to contribute to NEAR or start your own project, we would love to hear from you. 

Content Highlight
We released a blog post in which Alex explains “How Randomness Beacons based on Threshold Signatures work”. Modern Proof-of-Stake protocols need a source of unbiased randomness. Dfinity pioneered the idea of using threshold signatures as such a beacon. This post explains in simple terms how such randomness beacons work. 

Engineering
The engineering work on the unbiased randomness beacon is in full swing. We pushed the cryptographic primitives and are almost done with the integration.

It will take time to stabilize the beacon, and the initial launch of NEAR will use a simpler beacon, in which block producers have one bit of influence. The simple beacon is done and pushed.

The team is largely in the stabilization mode, preparing to restart Stake Wars. In the past two weeks we have fixed a variety of issues:

Distribution of reward based on the stake, not seats:
https://github.com/nearprotocol/nearcore/commit/3e6b14a5ba7112223e6aea69a4eda1991c873cf4
Fixing the pricing of storage:
https://github.com/nearprotocol/nearcore/commit/4d9b1a45a2804ffed31f560807e2ce2757f0e352
Using the correct epoch for approvals on epoch switch:
https://github.com/nearprotocol/nearcore/commit/fcb0746d9b629716e58b575638b14d0f4d36086d
Fixing an inconsistency in the epoch manager:
https://github.com/nearprotocol/nearcore/commit/fc4e26852fbe40734fe6e2c3edfecfbbe3d49ce4
Fixing a bug with empty method names:
https://github.com/nearprotocol/nearcore/commit/29cb2522870d4a33824a25f9e2fe8d897251a5b5
Batman (Alex’ dog) wishes you a great weekend!
How You Can Get Involved
Join theNEAR Contributor Program. If you would like to host events, create content or provide developer feedback, we would love to hear from you! To learn more about the program and ways to participate, please head over to the website. 

If you’re just getting started, learn more in The Beginner’s Guide to NEAR Protocol or read the official White Paper. Stay up to date with what we’re building by following us on Twitter for updates, joining the conversation on Discord and subscribing to our newsletter to receive updates right to your inbox.
NEAR Foundation Partners with Hibiki Run on Open Web Digital Gachapon
NEAR FOUNDATION
July 5, 2023
NEAR Foundation is thrilled to announce a new strategic partnership with Hibiki Run, a platform lying at the nexus of innovation in music streaming and digital collectibles. Hibiki Run is revolutionizing music discovery by melding gaming thrills with crypto-driven Listen-to-Earn  (L2E) incentives. 

Together, NEAR Foundation and Hibiki Run will explore innovative paths for creating engagement between Web3 content creators and end users. With the Japanese “Gachapon” vending machine capsule toys as a model, the collaboration will meld NEAR’s cutting-edge blockchain technology with Hibiki Run’s expertise in digital music, art, and exercise, new opportunities in each vertical for creation, distribution, and ownership.

Bringing a ‘Digital Gachapon’ economy to the open web
With “Digital Gachapon”, NEAR and Hibiki Run will bring a powerful economic tool to creators. When interacting with a Japanese Gachapon, layers insert coins into the machine, turn the knob, and receive a capsule with a random item. 

Hibiki Run has innovatively digitized this exciting concept, integrating it with blockchain technology. In the digital Gachapon system, users utilize their tokens to receive digital items such as NFTs or unique digital assets — anything from exclusive music tracks, collectible art pieces, and rare gaming items, to access tokens for specific events or experiences. 

The digital Gachapon’s strength lies in its element of surprise and the potential for rare, high-value rewards — transforming the token expenditure into an exciting event while providing a way for creators to distribute their content in a fun and engaging manner. 

Hibiki Run and NEAR hope that with these types of innovative concepts, blockchain technology, and user-friendly interfaces, a new frontier of digital arts will open up. One that is interactive and immersive for creators and consumers alike. Like NEAR, Hibiki Run is committed to creating a decentralized, fair, and accessible ecosystem for artists.
An Update On the NEAR Validator Upgrade
DEVELOPERS
January 28, 2022
At NEAR Foundation, our goal has always been to provide the best experience for validators, delegators, community members, and project builders. As part of NEAR Protocol’s goal to increase the number of validators securing the network and improve decentralization, we invited the community to submit an application through our call for applications on December 2, 2021. 

We received an overwhelming interest of more than 160 applications for delegation.

After the latest upgrade, which now allows up to 100 validators to the Mainnet and a lowered seat price of 64,000 $NEAR, many validators (73) managed to enter the validator pool with their own funds. The Foundation only had 27 seats available for delegation, which means that the selection process was extremely competitive. 

As NEAR Protocol is certified carbon neutral by South Pole, we ask validators to think through how they offset their validator operation’s carbon footprint, and communicate any CO2 offsetting that they implement on their end, such as using a renewable energy source to operate the nodes. An important criteria in the selection for delegation was ecological, and validators who took steps to offset their carbon footprint were selected.

Additionally, please note that the minimum criteria to qualify for delegation, such as keeping commission to 7% and maintaining high uptime on testnet node or mainnet node, is essential and the Foundation reserves the right to withdraw delegation and re-delegate to another validator. 

Additional Opportunities 
For any validators that were not selected in this round, there will be many more opportunities to be involved in the NEAR Ecosystem. 

NEAR Protocol will introduce a new type of validator, Chunk-Only Producer, in mid-2022 to further decentralize NEAR and increase the number of validators on Mainnet from 100 to 300. 

For those interested in being considered for a Chunk-Only Producer, please fill out this typeform.

For additional information about Chunk-Only Producers, please visit the Decentralize page. Additional details can be found on the NEAR protocol roadmap. 

Another route to helping secure the network is via the Open Shards Alliance. The Open Shards Alliance (OSA) and the GuildNet network have been an ecosystem guild since the Mainnet launch. It’s been a home for validators, those interested in becoming one, and new devs that enter the ecosystem. Ideas are bootstrapped in the OSA and often move on into their own projects. The OSA is comprised of technical aficionados, sysadmins, and devs. 

Please join the Open Shards Alliance server at the OSA Discord.
NEAR at ETHCC: Step into the Open Web on the BOS
NEAR FOUNDATION
June 13, 2023
NEAR Foundation is excited to announce that NEAR will be returning to ETHCC 2023. The Foundation will be hosting a 2-day side event at the Paris tech conference on July 16-17.

NEAR experts will be on hand at ETHCC to share the latest updates for building apps on the open web  with the BOS  — an industry-first OS that makes it easy to use the tools you already know to build apps that engage users, while fostering an open web untethered from centralized platforms. 

Also, learn how your project can get funding and other support from NEAR Horizon, the new Web3 startup platform built on the BOS. 

NEAR at ETHCC — What to expect
NEAR is hosting a two-day ETHCC side event on July 16-17th, that will feature Technical Workshops (BOS) hosted by Pagoda, a Horizon Pitch Competition, small ETH research group workshops (invite only), and other speaker sessions, keynotes, and panels. You can’t forget about our exclusive networking and happy hours!

Learn from the best in the NEAR ecosystem about what makes the BOS so revolutionary. Ask your questions. Learn in-person. Make connections!

Agenda: NEAR at ETHCC
NEAR’s 2-day ETHCC side event will be located at the Museum National D’Histoire Naturelle: Verniquet. 

Day 1: Technical Day 

11am – 12pm: Breakfast bites & Networking – Cafe au laits and pastries
12-12:30pm: Stateless Validation – Invite Only Research Group 
12:30-1pm: Token Economics – Invite Only Research Group 
1-1:30pm: BOS Vision 
1:30-2pm: BOS for Devs 
2-2:30pm: BOS Tech Breakdown for Partners 
2:30-3pm: Simona/ETH Session 
3pm-4pm: Programming Break, Happy hour guests arrive 
4pm – 7pm: Happy Hour – Appetizers and drinks 
Structure for Day 2: Founders Day 

11am – 12pm: Networking and Co-working: Cafe au laits and pastries
12pm-12:30pm: Pantera Capital Workshop 
12:30-1pm: Proximity Workshop 
1-1:30pm: Simona/ETH Session 
1:30-2pm: Pitchfest Guests arrive 
2-4pm: Horizon Pitch Fest 
4pm – 7pm: Horizon Pitch Competition Happy Hour: Aperol spritz and appetizers
NEAR Speakers at ETHCC
Illia Polosukhin, CEO of Pagoda, Co-Founder of NEAR
Matt Stephenson, Head of Cryptoeconomics, Pantera Capital
Vy Le, Bain Capital
Kendall Cole, Co-Founder and Director of Proximity
Mya Shofany, Regulatory Lead, NEAR Foundation
Bowen Want, Director of Protocol, Pagoda
And more!
---
sidebar_position: 6
---

# Tools

Currently, the only tool which supports authoring and publishing BWE components is the BWE sandbox. This is a web-based development environment built by the BWE team at Pagoda.

The sandbox can be found at [bos-web-engine-sandbox.vercel.app](https://bos-web-engine-sandbox.vercel.app/)

Code for the sandbox can be found under `apps/sandbox` in the BWE repository [here](https://github.com/near/bos-web-engine/tree/main/apps/sandbox)

We look forward to supporting other tool developers as they adopt BWE.

<details>
  <summary>Want to build tooling for BWE?</summary>
  <p>The main thing to know is that BWE is still highly subject to change as we receive feedback on DevX and functionality. If you don't mind potential rework due to engine changes and want to start building now:</p>
  <p>Our sandbox package was built from the start to be reusable in other web implementations. Feel free to fork our project or pull out pieces you need. In the future we hope to publish many of our packages on NPM to make it easier to receive future updates.</p>
</details>