jcarbonnell/preTrainingNEAR huggingface dataset:
---
description: Everything you need to know about NEAR Token
title: NEAR Token
sidebar_position: 0
---


---

This is the native token used in NEAR Protocol.
It has multiple use cases:
- Secures the network through staking
- Provides a unit of account - NEAR is used for processing transactions and storing data
- Serves as a medium of exchange

### Securing the Network
NEAR Protocol is a proof-of-stake (PoS) network, which means that resistance from various attacks comes from staking NEAR.
Staked NEAR represents the decentralized infrastructure of servers that maintain the network and process transactions for applications and users on NEAR.
Rewards for providing this service are received in NEAR.

## Providing a Unit of Account
NEAR is used to price computation and storage on the NEAR infrastructure.
The network charges transaction fees in NEAR to process changes and transactions.

## Medium of Exchange
NEAR is readily available on the protocol level, so it can be used to transfer value between NEAR applications and accounts.
This means that applications can use NEAR to charge for various functions, like access to data or other complex transactions.
Entities can also easily exchange NEAR between each other, without the need for trusted third parties to clear and settle transactions.


For a deeper dive on NEAR Economics: [https://near.org/blog/near-protocol-economics](https://near.org/blog/near-protocol-economics)

For more information about the NEAR token, visit [NEAR Token Supply and Distribution](https://near.org/blog/near-token-supply-and-distribution/) or [Nomicon](https://nomicon.io).
```js
import { Wallet } from './near-wallet';

const KEYPOM_CONTRACT_ADDRESS = "v2.keypom.near";
const NFT_CONTRACT_ADDRESS = "nft.primitives.near";
const NFT_TOKEN_ID = "1";
const DROP_AMOUNT = "10000000000000000000000";

const wallet = new Wallet({ createAccessKeyFor: DAO_CONTRACT_ADDRESS });

await wallet.callMethod({
  method: "create_drop",
  contractId: KEYPOM_CONTRACT_ADDRESS,
  args: {
    public_keys: state.publicKeys,
    deposit_per_use: DROP_AMOUNT,
    fcData: {
      // 2D array of function calls. In this case, there is 1 function call to make for a key use
      // By default, if only one array of methods is present, this array of function calls will be used for all key uses
      methods: [
        // Array of functions for Key use 1. 
          [{
            receiverId: NFT_CONTRACT_ADDRESS,
            methodName: "nft_mint",
            args: JSON.stringify({
            // Change this token_id if it already exists -> check explorer transaction
                token_id: NFT_TOKEN_ID,
                metadata: {
                  title: "My NFT drop",
                  description: "",
                  media: "",
                }
            }),
            accountIdField: "receiver_id",
            // Attached deposit for when the receiver makes this function call
            attachedDeposit: "10000000000000000000000"
          }]
      ]
    }
  },
  deposit: "23000000000000000000000" // state.publicKeys.length * dropAmount + 3000000000000000000000,
  gas: "100000000000000",
});
```

_The `Wallet` object comes from our [quickstart template](https://github.com/near-examples/hello-near-examples/blob/main/frontend/near-wallet.js)_
```rust
// Validator interface, for cross-contract calls
#[ext_contract(ext_dao_factory_contract)]
trait ExternalDaoFactoryContract {
  fn create(&mut self, name: AccountId, args: Base64VecU8) -> Promise;
}

// Implement the contract structure
#[near_bindgen]
impl Contract {
  #[payable]
  pub fn create_dao(&mut self, name: AccountId, args: Base64VecU8) -> Promise {
    let promise = ext_dao_factory_contract::ext(self.dao_factory_contract.clone())
      .with_attached_deposit(env::attached_deposit())
      .with_static_gas(Gas(30*TGAS))
      .create(name, args);

    return promise.then( // Create a promise to callback query_greeting_callback
      Self::ext(env::current_account_id())
      .with_static_gas(Gas(50*TGAS))
      .external_common_callback()
    )
  }

  #[private] // Public - but only callable by env::current_account_id()
  pub fn external_common_callback(&self, #[callback_result] call_result: Result<(), PromiseError>) {
    // Check if the promise succeeded
    if call_result.is_err() {
      log!("There was an error contacting external contract")
    }
  }
}
```
Mintbase Brings New Open Web Wallet Tech to Families Celebrating Raksha Bandhan
NEAR FOUNDATION
August 29, 2023
Mintbase, a leading NFT platform that allows users to mint, buy, and sell digital assets has partnered with the NEAR Foundation to help friends and family celebrate the traditional Indian festival, Raksha Bandhan, with Open Web technology.

By bringing together several pieces of breakthrough wallet technology for the first time, photos can be instantly converted into NFTs and stored permanently on the NEAR blockchain — all without users needing to create seed phrases or pre-loaded wallets. 

A new type of wallet 
Mintbase’s new wallet streamlines the blockchain user experience like never before thanks to innovations on the NEAR blockchain. 

FastAuth, created by NEAR, is an open-source protocol that provides an onboarding and account recovery process similar to what you find in Web2. It uses meta transactions, allowing a third party to pay the gas fee on behalf of the user, solving one of the most significant problems new users face in the blockchain world.

The other killer feature is NEAR’s built-in account abstraction system. Users no longer need to deal with seed phrases or require NEAR to mint. Instead, a full access key is stored in the user’s passkey system, so biometric signing will work in a noncustodial way without any local storage interactions.

This means no more seed phrases, and no more having to pre-load the wallet with currency before use. Instead, users of Mintbase’s wallet will be able to use and interact with blockchain in the same way they would with Web2 apps. 

Celebrating the essence of Rakhi  
To celebrate Raksha Bandhan, the popular Indiana festival where sisters tie a talisman or amulet called a Rakhi around the wrists of their brothers, users will be able to capture the moment with a photo and upload it instantly to the blockchain via the Mintbase wallet. 

The metadata will be permanently stored on the Arweave blockchain and a NFT of the moment will be minted on the NEAR blockchain and delivered back to the user. It’s a sizable step forward in showcasing how far Web3 technology has come in making the user experience easier and more familiar to non-blockchain users. 

As part of this celebration, there’s more than just memories to win. Participants can win prizes for NFTs they created and share them on X (formerly Twitter) with the hashtag #RakhisNEAR.  

For more details, please visit https://rakhi.mintbase.xyz. Participate, share, and make this Raksha Bandhan more memorable with Mintbase and NEAR Foundation.
Join Stake Wars to Become a Chunk-Only Producer
DEVELOPERS
June 30, 2022
Stake Wars is back to help decentralize the NEAR network and help the community with cool new challenges and rewards to members who want to become validators. In Stake Wars: Episode III, NEAR is focusing on Chunk-Only Producers—NEAR’s next step toward a fully-sharded protocol.

By introducing this new type of validator, NEAR can increase the total number of validator seats. Stake Wars is helping Chunk-Only Producers to prepare for this moment. It’s an opportunity to gain confidence and learn how to work with contract-based delegation.

With Stake Wars III set for July 13, here’s a brief rundown of the new Chunk-Only Producer role, and what to expect from the Stake Wars program.

Chunk-Only Producers help decentralize and secure NEAR
The NEAR Network is currently secured by 100 validators. NEAR’s roadmap will allow the protocol to become fully-sharded. This will help reach the ambitious goal to decentralize NEAR while keeping the network secure. Chunk-Only Producers are an important milestone along this path.

Chunk-Only Producers are solely responsible for producing chunks in a single shard (a network partition). A chunk, of course, is a shard block (see Nightshade for more detail). What’s cool for Chunk-Only Producers is that they can run their validator node on a less demanding machine, such as a 4-Core CPU, with 8GB of RAM and 200GB SSD of storage.

Once the Chunk-Only Producer is available on NEAR mainnet at the end of Q3, NEAR plans to onboard an additional 200-300 validators. This, combined with a lower barrier to entry (minimum stake) for validators, is a win for the NEAR network as it moves toward a more scalable future. By increasing the total number of validators, NEAR will become more decentralized and more secure.

How Stake Wars III works
Chunk-Only Producers can deploy the open-source Staking Pool smart contract from Github, to test their systems and gain confidence with contract-based delegation. Validators are also free to customize their delegation contract, build their web applications, and integrate the Staking Pool into their existing systems.

Stake Wars is community-operated, and community members such as Metapool, Everstake, LiNEAR and Open Shards Alliance (OSA) will offer their support to the program. NEAR plans to use more than 4M $NEAR tokens as delegation rewards for the participants who complete the challenges. These rewards help put participants in a position to become a mainnet validators by Q4 of 2022. 

The Stake Wars: Episode III incentivized testnet for Chunk-Only Producers will launch on July 13th and run until early September. Any potential validators should join the Stake Wars community on Telegram and Discord to coordinate with other Validators, and follow @PagodaPlatform on twitter. 

The full Stake Wars III page is launching soon. So stay tuned.
Enter the Black Dragon: NEAR Co-Founder Joins the NEAR Foundation as CEO
NEAR FOUNDATION
November 7, 2023
The NEAR Foundation announced today that Illia Polosukhin, co-founder of NEAR Protocol, has been appointed NEAR Foundation CEO to lead the NEAR ecosystem into the next phase of building an open web. As the person who has driven the vision for NEAR from the very beginning, there is no one better to oversee the growth of the NEAR Open Web Ecosystem and guide the constellation of teams building on NEAR to work together towards that common vision. From the earliest days of NEAR, Illia’s vision of an open web has guided the development of the ecosystem and served as a north star for the Foundation. In his new role as CEO, he will be able to realize that vision in a more direct and streamlined way. 

“I’m honored and excited to officially join the NEAR Foundation and continue working together with the ecosystem to build towards our shared vision of an open web,” said Illia Polosukhin about his new role. “Effectively coordinating a decentralized ecosystem involves a lot of iteration and experimentation and I’m proud that NEAR has committed to refining this process since the very beginning. I believe this next step in our shared evolution will help us build our respective verticals faster and work together more efficiently.” 

With his ability to bring together key nodes and align people across the ecosystem, Illia has always been a powerful guiding force for NEAR, something that his new role will allow him to continue and expand. As NEAR cements its position as the entry point to an open web, Illia’s appointment will help to create common work streams across the organization and broader ecosystem organizations that will help accelerate this journey. Combining a decentralized ecosystem approach with a more streamlined strategic coordination function will accelerate NEAR into its next phase of evolution, the details of which Illia will share at this week’s NEARCON. 

To help ensure the ecosystem nodes building this open web vision are coordinating effectively, Chris Donovan will be stepping into the position of NEAR Foundation COO to oversee the day-to-day operations of the Foundation, and will also remain as a member of the NEAR Foundation Council. Chris has been essential in this transition to a founder-led organization, and the Foundation and the whole ecosystem extend gratitude and appreciation for his work.

With a clear vision, strong leadership, an engaged ecosystem, and a passionate community all building towards a common vision, NEAR is poised to take its next bold step into an open web. All members of the NEAR community are invited to join this week for the biggest, most exciting NEARCON ever in Lisbon, or tune in virtually at nearcon.org starting Wednesday, November 8. You won’t want to miss the chance to hear exciting announcements and strategy updates from Illia, demos from top projects across the ecosystem, and leading perspectives from the Web3 industry during three days of talks, hackathons, and celebration.
---
sidebar_position: 1
---

# Unit Tests

Testing contract functionality can be done through the `cargo test` framework. These tests will run with a mocked blockchain and will allow testing function calls directly without having to set up/deploy to a network and sign serialized transactions on this network.

A common framework for tests, along with setting up a basic testing environment looks like:

```rust
#[cfg(all(test, not(target_arch = "wasm32")))]
mod tests {
    use super::*;
    use near_sdk::test_utils::VMContextBuilder;
    use near_sdk::{testing_env, VMContext};

    fn get_context(is_view: bool) -> VMContext {
        VMContextBuilder::new()
            .signer_account_id("bob_near".parse().unwrap())
            .is_view(is_view)
            .build()
    }

    #[test]
    fn my_test() {
        let context = get_context(false);
        testing_env!(context);
        // ... Write test here
    }
}
```

Where `VMContextBuilder` allows for modifying the context of the mocked blockchain to simulate the environment that a transaction would be run. The documentation for what can be modified with this context can be found [here](https://docs.rs/near-sdk/4.1.1/near_sdk/struct.VMContext.html).

The `testing_env!` macro will initialize the blockchain interface with the `VMContext` which is either initialized through `VMContextBuilder` or manually through itself.

:::info Note

This `testing_env!` and `VMContext` is only used for testing outside of `wasm` environments. When running the built contract on a network in a `wasm` environment, the context from the blockchain will be used through host functions on the runtime.

:::

To test read-only function calls, set `is_view` to `true` on the `VMContext`. This will test to verify that function calls which just read state do not try to modify state through unit tests. In the above example, `true` should be passed into the `get_context` call, which initializes the context as read-only.

You will want to use `testing_env!` each time you need to update this context, such as mocking the `predecessor_accound_id` to simulate the functions being called by or only allowing view operations as mentioned above. Each time this is done, a new mocked blockchain will be initialized while keeping the existing state.
---
sidebar_position: 3
sidebar_label: Get API Keys 
title: Get Pagoda API Keys
---

:::warning

Please be advised that these tools and services will be discontinued soon.

:::

1. Register an account on [Pagoda Console](https://console.pagoda.co/):

   ![](/docs/pagoda/getkey1.png)

2. Create a blank project

   ![](/docs/pagoda/getkey2.png)

3. Give your project a cool name

   ![](/docs/pagoda/getkey3.png)

4. Grab your API Key

   Click the API Tab and you will see your API key already generated for you and ready to use, remember to switch networks for `MainNet` using the button on top, you can also navigate through your different projects there.

   ![](/docs/pagoda/getkey4.png)

5. Connect to Pagoda RPC Node

   Follow the instructions on the screen to set up your Pagoda RPC Access, we have created a quick setup guide for all NEAR tools.
   - `https://near-testnet.api.pagoda.co/rpc/v1/`
   - `https://near-mainnet.api.pagoda.co/rpc/v1/`

   ![](/docs/pagoda/getkey5.png)

6. You can use this line of code for a quick test

   ```sh
   curl -X POST -H 'x-api-key:<YOUR-API-KEY>' -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0", "id":"dontcare","method":"status","params":[] }' https://near-testnet.api.pagoda.co/rpc/v1/
   ```

   ![](/docs/pagoda/getkey6.png)

Congrats! You are connected!
Refer-and-Earn Guidelines Update: Q3 2022
NEAR FOUNDATION
December 9, 2022
NEAR’s ever-growing and engaged community is one of the ecosystem’s greatest strengths. Remember the NEAR Foundation Grants team’s Refer-and-Earn Program? A number of NEAR community members participated in Refer-and-Earn in early 2022, resulting in grants for dozens of exciting projects currently building on the NEAR ecosystem.  

The Foundation has had the pleasure of seeing the community being a key contributor in providing ecosystem support and building dapps. The community does this in a number of ways, including running and sponsoring events, educating developers and entrepreneurs on the benefits of NEAR, bringing projects with active user bases from other chains, and so on.

NEAR Foundation wants to build on the community’s successes through a new incentive structure that aligns with the Grants Program (more information can be found at the Grants Program Handbook here bit.ly/Grants-Program-Handbook). 

The payout for each project referred will be awarded a total of 10% of the project awarded grant amount. This amount is awarded in nUSDC (wrapped USDC on NEAR) and is calculated at the end of each quarter.
The first half of the 5% will be awarded at the point of the contract signed.
The second half of the 5% will be awarded once all project milestones are completed. 
Refer-and-Earn: Q3 Qualified Projects
The NEAR ecosystem receives a number of your recommendations and referrals. A total of 12 quality projects emerged from Refer-and-Earn, each aligning with NEAR Foundation’s Grants program objectives. 

In no particular order, here are the Q3 2022 qualified projects: 

Scene 
Azadi Record
Vital Carbon 
Metavision Games 
Murder Mystery Collective 
MetaLordz 
Klabrate and ClimaFi
Meteor wallet 
Mintmade 
NEARKai
EVIE Marketplace 
Autify 
The Grants team has reached out to all Refer-and-Earn referrers. Thanks to your help and support, the Grants team is able to support innovative projects like those listed above.
---
title: DAO Basics
description: Your map to navigating the world of DAOs on NEAR
slug: /governance
sidebar_position: 0
---

# Your Guide to DAOs on NEAR

## What’s a DAO?

In short, a DAO is a Decentralised Autonomous Organisation. It’s like a company, coop, club, or task force. The secret that sets DAOs apart from these examples is all in the name.

Decentralization is a core concept of blockchains. SputnikDAOs operate on NEAR blockchain, enabling peer to peer transactions without borders or gate keepers. You can collaborate with whoever you want from around the world!

Autonomous Organization is a tricker concept tied up in a new work revolution. Companies and platforms typically have someone in the middle to handle logistics (and taking a cut for their effort). SputnikDAOs replace those positions with apps running on the NEAR blockchain to automate things like distributing funds, recording consensus, and managing membership. All of that saved effort and cost is then passed onto the members of the DAOs, paying them more for the value they contribute!

To make things tangible let’s look at an example like AirBNB. If people with open space for short term rental coordinate directly with each other through a DAO then they don’t have to give a cut of their profits to AirBNB for providing that organizational service. Record labels, foundations, setting up group buys, crowdfunding, and more are all more efficient as DAOs!

In short, DAOs are digital companies living on a blockchain with participants united by a common purpose. SputnikDAO enables individuals to come together to form cooperative, open, accessible, and transparent organisations.

## Why a DAO?

DAOs empower communities to govern on-chain activity, make united decisions, and interact with other DAOs.Ultimately, DAOs unlock an unprecedented level of transparent and collaborative coordination with built-in tools to allow for:

* Transparency and legitimacy via built-in reporting
* Community ownership through stakeholder participation
* Responsible fund distribution through openness and transparency which results in meaningful accountability

## DAOs on NEAR

In line with the goal of being the most accessible, user-friendly blockchain, DAOs on NEAR are created in a matter of clicks through the [Astro](https://astrodao.com/) dApp. 

AstroDAO is a hub of DAOs empowering communities in the NEAR ecosystem. [This playbook](how-to-launch-a-dao.md) will guide you through the process of creating and interacting with DAOs in the NEARverse Astro.


## Your Guide to DAOs

The following playbook will serve as documentation and a guide to creating DAOs in Astro, the leading DAO Tooling service on NEAR, as well as a key for unlocking the full potential of DAOs within the NEAR Ecosystem.
---
id: what-is
title: What is Data Infrastructure? 
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import {CodeTabs, Language, Github} from "@site/src/components/codetabs"

NEAR offers ready-to-use solutions to access and monitor on-chain data easily. This is very useful to automate actions based on specific **events**, cache data to **reduce latency**, gather **usage data** of the blockchain, and even **study user preferences**.

![img](/docs/assets/welcome-pages/data-lake.png)

NEAR offers three main solutions to access and monitor on-chain data: [**BigQuery Public Dataset**](#bigquery-public-dataset), [**QueryAPI**](#queryapi-indexers-made-simple), and [**NEAR Lake**](#near-lake). Each of these solutions is designed to fit different needs and use cases, and can be used in combination to create a complete data infrastructure for your application.
 
---

## [BigQuery: Public Dataset](./big-query.md)
A large dataset with on-chain data publicly available on Google Cloud Platform. Obtain near real-time blockchain data using simple SQL queries. **All the data, zero setup**.

- Instant insights: Historic on-chain data queried at scale. No need to run your own infrastructure.
- Cost-effective: Eliminate the need to store and process bulk NEAR Protocol data. Query as little or as much data as you like.
- As easy as SQL: No prior experience with blockchain technology is required. Just bring a general knowledge of SQL to unlock insights.

<hr subclass="subsection" />

## [QueryAPI: Indexers Made Simple](./query-api/intro.md)

A fully managed solution to build indexer functions, extract on-chain data, and easily query it using GraphQL endpoints and subscriptions.

- Your data, your way: Decide how you want to store data. Design the tables and databases that better suit your needs.
- Indexers made simple: Create the logic of your indexer and we will execute it for you. Forget about infrastructure—focus on solutions.
- Plug & play to your app: Fetch your data from any application through our API. Leverage GraphQL to query exactly what you need.

<hr subclass="subsection" />

## [NEAR Lake](./lake-framework/near-lake.md)
A solution that watches over the NEAR network and stores all the events for your easy access.

- Cost-efficient solution: Cost-efficient solution for building self-hosted indexers in Rust, JavaScript, Python, Go and other languages
- Streamlined data management: Use NEAR Lake Framework to stream blocks to your server directly from NEAR Lake