jcarbonnell/preTrainingNEAR huggingface dataset:
---
id: what-is-a-node
title: What is a Node
sidebar_label: What is a Node
sidebar_position: 1
description: What is a NEAR Node and Why Run a Node
---

NEAR Protocol runs on a collection of publicly maintained computers (or "nodes"). All nodes are running the same `nearcore` codebase with the latest releases available on [GitHub](https://github.com/near/nearcore/releases/). In the following section, we will introduce three types of nodes.

It is important to keep in mind all nodes run the same codebase, with different configurations. As such, we have split up the documentation for running different types of node into sections specific to the type of nodes.

## Why run a Node? {#why-run-a-node}

You may decide to run a node of your own for a few reasons:

- To join a network as a validator running a validator node. Running a validator node is a public good and you are effectively securing the NEAR network and earning rewards.
- To run applications that heavily depend on RPC performance and/or availability.
- To develop and deploy contracts on a local (independent and isolated) node (sometimes called "localnet"). (†)
- To quickly extract blockchain data that can be used for chain analytics, block explorer, etc.

_( † ) `localnet` would be the right choice if you prefer to avoid leaking information about your work during the development process since `testnet` and `betanet` are *public* networks. `localnet` also gives you total control over accounts, economics and other factors for more advanced use cases (ie. making changes to `nearcore`)._


## Types of Network {#types-of-network}

There are a few different networks to potentially run a node. Each network operates with its own independent validators and unique state. To find out more, head to the [network overview](https://docs.near.org/concepts/basics/networks).

* [`mainnet`](https://docs.near.org/concepts/basics/networks#mainnet)
* [`testnet`](https://docs.near.org/concepts/basics/networks#testnet)
* [`betanet`](https://docs.near.org/concepts/basics/networks#betanet)
* [`localnet`](https://docs.near.org/concepts/basics/networks#localnet)


>Got a question?
<a href="https://stackoverflow.com/questions/tagged/nearprotocol">
  <h8>Ask it on StackOverflow!</h8></a>
NEAR Launches Sustainable Learn and Earn Program with Coinbase
COMMUNITY
September 1, 2022
NEAR Foundation is excited to announce a new campaign with Coinbase designed to educate people on the utility of the NEAR token. A secure platform for buying, selling, transferring, and storing digital currency, Coinbase is one of the world’s largest digital currency exchanges, fully registered and operating in over 100 countries. 

This educational series will utilize the Coinbase Earn program to educate users about NEAR through video tutorials and interactive quizzes produced by Coinbase. Learn about running smart contracts in Javascript and Rust, joining or creating a DAO with a NEAR wallet, how Nightshade sharding is powering NEAR’s incredible scalability, and more. 

Funding Learn and Earn with Staking Rewards 
What makes this campaign unique is that it will be the first of its kind to use staking rewards to fund the initiative. Coinbase will manage NEAR tokens over a period of three years, collecting staking rewards and using those rewards to sustainably help users to learn about the utility of the NEAR token and what makes NEAR the world’s leading blockchain for developers, with its low fees, high speeds, and infinite scalability.

“In an era when many crypto companies have relied on unsustainable business models to grow and scale, it was important we found a way of helping educate people about the unique features of NEAR in a sustainable way,” says Marieke Flament, CEO of the NEAR Foundation. 

Certified climate neutral by SouthPole, the leading company for voluntary carbon offsetting, sustainability is at the core of NEAR’s mission of providing a platform that is low-cost, high speed, secure, and easy to use for developers and lay users alike. 

To participate in the Earn campaign, open the Coinbase app and navigate to the “Learning Rewards” tab on the left hand menu. Once there, those logged in and eligible to earn will see the NEAR campaign. 

Integrating NEAR with Coinbase Custody
In addition to the Coinbase Earn program, the partnership will also integrate NEAR with Coinbase Custody—an independent entity offering clients access to secure institutional grade offline custody—and Coinbase Prime, an integrated solution that provides secure custody, an advanced trading platform, and additional prime services. 

“We are committed to democratizing access to the world of Web3 and giving more people the opportunity to help shape its future,” Flament says. “We are making it easier than ever for anyone to learn about the utility of the NEAR token and its ability to create a more accessible and sustainable Web3. We believe that through education, we take another step towards mass adoption.”

This partnership will allow NEAR Foundation to expand its ecosystem by tapping into the huge number of users who put their trust in Coinbase and showing them just how easy NEAR is to use and understand.
Minting Minecraft Blueprints As NFTs
DEVELOPERS
December 9, 2021
Most of the time, when you hear people talking about non-fungible tokens (NFTs), your first thoughts may turn to media files such as images or music. But, actually, NFTs are not limited to such file types. In this article, you’ll discover how the DevRel team created non-fungible tokens based on Minecraft buildings designed inside the game.

Blockheads
Creative possibilities are endless thanks to the new developments and technologies rising in the crypto space. For example, Dorian (a member of Near Inc. DevRel team) runs a YouTube series called Blockheads, where he creates fun examples of things you can build on NEAR. He’s also fond of the world of Minecraft, especially during quarantine. 

After learning about NFTs, Dorian thought it would be fun to give Minecraft artists and builders the ability to mint their buildings and creations as NFTs and sell them on the open web. So, using the Mineflayer JavaScript library, he created a bot that could monitor the in-game chat and pull information about the game’s environment. Then, using that bot, he created blueprints that a user could then mint onto the NEAR blockchain. The following video shows the bot named Jerry in action:


Minting Minecraft with NEAR
The app grew and took shape. Finally, Ben Kurrek from Near Inc. DevRel had the great idea of using the popular World Edit mod to get the building data and store it in a .schem file. This file then gets uploaded to IPFS for storage, and the content identifier (CID) is saved to the NEAR blockchain itself. The flow is smooth, and .schem files capture the building designs more accurately than Jerry could on his own.

If you’re interested in seeing how the complete flow works in minting a Minecraft building, check out the NFTs tutorial Ben created. It’s simple, fun, and very straightforward (of course, if you have questions, you can ask us during Office Hours).

As it currently stands, getting Jerry to read .schem files has been tricky since they aren’t a conventional file type that JavaScript (Jerry’s preferred language of choice) can understand right out of the box. But progress is still being made. So if you would like to join Dorian on this endeavor to make Minecraft NFTs on NEAR, you can contact him on Discord.
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs groupId="nft-contract-tabs" className="file-tabs">
<TabItem value="Paras" label="Paras" default>

```bash
near call x.paras.near buy '{"token_series_id": "299102", "receiver_id": "bob.near"}' --accountId bob.near --deposit 0.20574
```

**Example response:**

```json
"299102:1"
```


</TabItem>

<TabItem value="Mintbase" label="Mintbase">

```bash
near call simple.market.mintbase1.near buy '{"nft_contract_id": "rubennnnnnnn.mintbase1.near", "token_id": "38"}' --accountId bob.near --deposit 0.001
```

**Example response:**

```json
{
  "payout": {
    "rub3n.near": "889200000000000000000",
    "rubenm4rcus.near": "85800000000000000000"
  }
}
```


</TabItem>

</Tabs>
---
sidebar_position: 1
sidebar_label: "Overview"
title: "Intermediate concepts (cross-contract calls and more)"
---

import accessKeys from '/docs/assets/crosswords/keys-cartoon-good--alcantara_gabriel.near--Bagriel_5_10.png';

# Intermediate concepts

This chapter will go a bit faster than the previous ones.

We're going to be covering an important part of smart contract development: cross-contract calls.

## Cross-contract calls

A cross-contract call is when a smart contract calls another smart contract. For instance, if `alice.near` calls contract A, and contract A makes a call to contract B.

NEAR has asynchronous transactions, and some cross-contract calls will have callbacks in order to determine the result of the call. This works a bit different from other blockchains, as we'll explain more in this chapter.

## Access keys

Last chapter covered access keys, and we implemented a login system where a user "logs in" by adding a function-call access key to their account which is tied to the crossword puzzle dApp.

Login is a common use case for access keys, but let's think bigger!

Remember the two (smaller, gray) function-call access keys from the keychain illustration?

<figure>
    <img src={accessKeys} width="600" alt="A keychain with three keys. A large, gold key represents the full-access keys on NEAR. The two other keys are gray and smaller, and have detachable latches on them. They represent function-call access key. Art created by alcantara_gabriel.near" />
    <figcaption>Art by <a href="https://twitter.com/Bagriel_5_10" target="_blank">alcantara_gabriel.near</a></figcaption>
</figure><br/>

Notice that they have a clasp to make them removable.

While it's unlikely you'll want to give another person a full-access key, there are times when you could give a function-call access key to another person or make it public. Why? This can help enable a smooth onboarding experience, as we'll do soon.

## Completed project

Here's the final code for this chapter:

https://github.com/near-examples/crossword-tutorial-chapter-3
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs groupId="nft-contract-tabs" className="file-tabs">
<TabItem value="NFT Primitive" label="Reference" default>

```bash
near call nft.primitives.near nft_transfer '{"token_id": "1", "receiver_id": "bob.near"}' --accountId bob.near --deposit 0.000000000000000000000001
```

</TabItem>

<TabItem value="Paras" label="Paras">

```bash
near call x.paras.near nft_transfer '{"token_id": "490641", "receiver_id": "bob.near"}' --accountId bob.near --deposit 0.000000000000000000000001
```

</TabItem>

<TabItem value="Mintbase" label="Mintbase">

```bash
near call thomasettorreiv.mintbase1.near nft_transfer '{"token_id": "490641" "receiver_id": "bob.near"}' --accountId bob.near --deposit 0.000000000000000000000001
```

</TabItem>

</Tabs>
```bash
near call token.v2.ref-finance.near ft_transfer_call '{"receiver_id": "v2.ref-finance.near", "amount": "100000000000000000", "msg": ""}' --gas 300000000000000 --depositYocto 1 --accountId bob.near
```

<details>
<summary>Example response</summary>
<p>

```bash
'100000000000000000'
```

</p>

</details>
---
id: one-yocto
title: Ensure it is the User (1yⓃ)
---

NEAR uses a system of [Access Keys](../../../1.concepts/protocol/access-keys.md) to simplify handling accounts.
There are basically two type of keys: `Full Access`, that have full control over an account (i.e. can perform all [actions](../anatomy/actions.md)), and 
`Function Call`, that only have permission to call a specified smart contract's method(s) that _do not_ attach Ⓝ as a deposit.

When a user [signs in on a website](../../4.web3-apps/integrate-contracts.md#user-sign-in--sign-out) to interact with your contract, what actually happens is
that a `Function Call` key is created and stored in the website. Since the website has access to the `Function Call` key, it can use it to
call the authorized methods as it pleases. While this is very user friendly for most cases, it is important to be careful in scenarios involving
transferring of valuable assets like [NFTs](../../../2.build/5.primitives/nft.md) or [FTs](../../../2.build/5.primitives/ft.md). In such cases, you need to ensure that
the person asking for the asset to be transfer is **actually the user**.

One direct and inexpensive way to ensure that the user is the one calling is by requiring to attach `1 yⓃ`. In this case, the user will be
redirected to the wallet and be asked to accept the transaction. This is because, once again, only the `Full Access` key can be used to send NEAR.
Since the `Full Access` key is only in the user's wallet, you can trust that a transaction with `1 yⓃ` was made by the user.
```bash
near call v2.keypom.near create_drop '{"public_keys": <PUBLIC_KEYS>, "deposit_per_use": "10000000000000000000000", "nft": {"sender_id": "bob.near", "contract_id": "nft.primitives.near"}}' --depositYocto 23000000000000000000000 --gas 100000000000000 --accountId bob.near
```
NEAR 2019 Year in Review
COMMUNITY
January 8, 2020
We are excited to share with you our NEAR 2019 Year in Review. The year has passed at an accelerating speed, filled with events, community programs and lots of engineering work. We planted the seeds of a now growing global collective and iterated most of NEAR’s sharding design. While continuously marching towards mainnet, we want to take a moment to look back at NEAR 2019 Highlights. 

Content
We launched our Whiteboard Series, which features a collection of over 30 deep-dives into various blockchain protocols.
With finalising NEAR’s design, we started our Lunch & Learn Series on YouTube, providing a deep dive into the underlying mechanisms of NEAR protocol. 
Alex was live coding core features of the NEAR Protocol in October.
Research
Nightshade: Near Protocol Sharding Design
Near Protocol Randomness Beacon
Fast Finality and Resilience to Long Range Attacks with Proof of Space-Time and Casper-like Finality Gadget
Doomslug: block confirmation with single round of communication, and a finality gadget with guaranteed liveness
Events
Throughout 2019, we attended, spoke at and hosted over 50 meetups and discussions. Locations included: Tokyo, Paris, Berlin, London, San Francisco, San Jose, San Mateo, Oakland, Beijing, Shanghai, Boston, and Sydney.

ETH New York: we hosted two great panels and participated in more. Access some of the recordings here. 
Alex spoke at Web3 about the challenges of sharding.
We hosted several events during and after DevCon. 
Check-out our events at San Francisco Blockchain Week!
Community
We launched three unique community programs to support mission-aligned engagement, research, projects, and development. We want to give a big thank you to everyone who got involved!

Stakewars: Our incentivised testnet program; access overview and updates.
The Ambassador Program: Formalising community-driven contributions.
The Beta Program: Providing projects that are building on NEAR with engineering and fundraising support.
Join our mailing list to hear about important developments and to learn when we’re going to be in a city near you.

Our year in a gif — Goku going super Saiyan.
HOW YOU CAN GET INVOLVED
Join us: there are new jobs we’re hiring for across the board!

If you want to work with one of the most talented teams in the world right now to solve incredibly hard problems, check out our careers page for openings. And tell your friends!

Learn more about NEAR in The Beginner’s Guide to NEAR Protocol. 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.

https://upscri.be/633436/
```js
const AMM_CONTRACT_ADDRESS = "v2.ref-finance.near";
const wallet = new Wallet({ createAccessKeyFor: AMM_CONTRACT_ADDRESS });
 
await wallet.viewMethod({
  method: 'get_pools',
  args: {
    from_index: 0,
    limit: 1000
  },
  contractId: AMM_CONTRACT_ADDRESS,
});
```
_The `Wallet` object comes from our [quickstart template](https://github.com/near-examples/hello-near-examples/blob/main/frontend/near-wallet.js)_ 

<details>
<summary>Example response</summary>
<p>

```js
[
  {
    pool_kind: 'SIMPLE_POOL',
    token_account_ids: [ 'token.skyward.near', 'wrap.near' ],
    amounts: [ '51865812079751349630100', '6254162663147994789053210138' ],
    total_fee: 30,
    shares_total_supply: '1305338644973934698612124055',
    amp: 0
  },
  {
    pool_kind: 'SIMPLE_POOL',
    token_account_ids: [
      'c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.factory.bridge.near',
      'wrap.near'
    ],
    amounts: [ '783621938569399817', '1100232280852443291118200599' ],
    total_fee: 30,
    shares_total_supply: '33923015415693335344747628',
    amp: 0
  }
]
```

</p>

</details>
NEAR Community Update: February 14th, 2020
COMMUNITY
February 14, 2020
The event season begins! Starting off, you can find us at ETHDenver and Developer Week in San Francisco. Our team took extra care to create an amazing booth experience. Check-out the video below: 


At #ETHDenver we’re excited to bring our engineers, product, and accelerator team together with developers. If you are around, come chat with us at NEAR’s Friday ETHDenver workshop. Kendall and Illia will be talking about how to write, deploy and interact with Rust, TypeScript, and Solidity smart contracts on NEAR. You can find all the information you need about our hackathon prizes and workshops in the following blog. 

#DEVWEEK2020 @ilblackdragon on stage at @DeveloperWeek discussing #openweb participation. 🌎 pic.twitter.com/H295AEnidi

— NEAR Protocol (@NEARProtocol) February 13, 2020

New Release: The Open Web Collective Incubator and Accelerator
Many teams create exciting new projects at hackathons and then face the difficult decision of whether or not to continue them as side projects or even potentially as businesses. To help teams navigate this decision and then take the next step with their projects, we are supporting the launch of the Open Web Collective (OWC) Incubator and Accelerator.

The Open Web Collective, which is supported by NEAR, is a community of crypto-native entrepreneurs and mentors who are pushing past the hype and building the projects that will bring the vision of the Open Web to reality. They are looking for hungry and talented teams who need support from ideation all the way through funding.

Learn more and apply at https://openwebcollective.com/

Content Highlights
We released Doomslug, our new block production technique, a month ago. As a follow-up to the paper (and to make the content more consumable), we recently released a blog post that highlights how Doomslug compares to PBFT, Tendermint, and Hotstuff. Please let us know what you think about it or if you have any open questions. 

How You Can Get Involved
Join the NEAR 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.
Register for NEAR’s March Town Hall: DAOs on NEAR
NEAR FOUNDATION
March 30, 2022
Hello, NEAR World. 2022 is shaping up to be the year of the DAO. Join the community for NEAR’s March Town Hall on March 21, 5:00pm GMT (1:00PM EDT/10:00am PDT) for a deep dive into NEAR’s ecosystem of DAOs. 

NEAR Foundation CEO Marieke Flament will open the Town Hall with some updates on the ecosystem and the Foundation’s progress in advancing Web3. 

There will also be a flurry of news and NEAR protocol updates, including ecosystem funding and education efforts, the MetaBUILD 2 winners, news on new events, and a panel focused entirely on DAOs. 

There will also be talk of Ukraine, especially how DAOs have stepped up and supported humanitarian relief efforts. 

MetaBUILD 2 Hackathon Winners
Since December, the NEAR community has been hosting the MetaBUILD 2 hackathon—the biggest one yet, with over 3,900 participants and 20+ partners. 

Pagoda’s Maria Yarotska will be at the March Town Hall to talk MetaBUILD 2, including how the war in Ukraine impacted the judging process. Maria will also update the community on the winning teams and projects, and will share information on upcoming hackathons. 

A Panel on DAOs
NEAR Foundation CEO Marieke Flament will return to talk briefly about the DAO community on NEAR. There will also be a panel focused on DAOs, with surprise guests from several different Web3 platforms and DAOs.

Register for the March Town Hall
To join the conversation with the global NEAR community, register for the March Town Hall.
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs groupId="nft-contract-tabs" className="file-tabs">
<TabItem value="Paras" label="Paras">

```js
Near.call(
  "marketplace.paras.near",
  "storage_deposit",
  {
    receiver_id: "bob.near"
  },
  undefined,
  9390000000000000000
);

Near.call(
  "nft.primitives.near",
  "nft_approve",
  {
    token_id: "1e95238d266e5497d735eb30",
    account_id: "marketplace.paras.near",
    msg: {
      price: "200000000000000000000000",
      market_type: "sale",
      ft_token_id: "near"
    }
  }
);
```

The method `nft_approve` will call `nft_on_approve` in `marketplace.paras.near`.

</TabItem>

<TabItem value="Mintbase" label="Mintbase">

```js
Near.call(
  "simple.market.mintbase1.near",
  "deposit_storage",
  {
    autotransfer: true
  },
  undefined,
  9390000000000000000
);

Near.call(
  "nft.primitives.near",
  "nft_approve",
  {
    token_id: "3c46b76cbd48e65f2fc88473",
    account_id: "simple.market.mintbase1.near",
    msg: {
      price: "200000000000000000000000"
    }
  }
);
```

The method `nft_approve` will call `nft_on_approve` in `simple.market.mintbase1.near`.

</TabItem>

</Tabs>