jcarbonnell/preTrainingNEAR huggingface dataset:
---
sidebar_position: 2
---

# Reproducible Builds
Reproducible builds let different people build the same program and get the exact same outputs as one another. It helps users trust that deployed contracts are built correctly and correspond to the source code. To verify your contract user can build it themselves and check that the binaries are identical.

## Problem
If you will build your contract on two different machines, most likely you will get two similar but not identical binaries. Your compiled `.wasm` file is dependent on several factors as the node version used and dependency sub versions. 

## Control for Dependencies
We recommend sharing lockfiles (and updating them only when dependencies are added or removed) between machines and specifying node versions to ensure that the same dependencies are used.
Case Study: OnMachina’s Jonathan Bryce on Building Decentralized Storage for an Open Web
NEAR FOUNDATION
June 5, 2023
NEAR is a home to a number of amazing apps and projects. These developers, founders, and entrepreneurs are using NEAR to effortlessly create and distribute innovative decentralized apps, while helping build a more open web — free from centralized platforms. 

The NEAR Case Studies content vertical made a return recently with a case study featuring Pagoda Chief Product Officer Alex Chiocchi, talking about the BOS.

For the next entry in the NEAR Case Study series, OnMachina co-founder Jonathan Bryce talks about building decentralized infrastructure on NEAR — specifically, developing decentralized storage for an open web.
---
description: A guide to using the Rainbow Bridge.
title: Rainbow Bridge
sidebar_position: 7
---

---

If you have existing assets on Ethereum, it's possible to transfer them to NEAR and vice-versa.
The Rainbow Bridge allows you to move ERC-20 assets between Ethereum, Aurora and NEAR.
The bridge was built by Aurora, the Ethereum-compatible scaling solution built on NEAR.

To use the Rainbow Bridge, you will need to create a [NEAR wallet](overview/tokenomics/creating-a-near-wallet.md), and you will need to install MetaMask.

## How Much Does it Cost?

Transfers between NEAR and Aurora happen instantaneously and require a single transaction.
Similarly, transfers from Ethereum to NEAR or Aurora only require a single transaction, they take approximately 10 minutes and the cost will be estimated by MetaMask.

Transfers to Ethereum, from NEAR or Aurora require two transactions. These transactions are the kickoff, from the network you start with and the finalization Ethereum.
The finalization can take up to 16 hours, and the cost is determined by the Ethereum gas price which makes them hard to predict.

Once a transaction begins, it cannot be cancelled, but you don't have to start the finalization transaction immediately.
If the gas prices are too high, you can wait until they drop to a manageable price before beginning the finalization transaction.

## Using The Rainbow Bridge

Start by connecting MetaMask, and your NEAR wallet so that you can make transfers between the NEAR network and other networks. In the example below we'll transfer NEAR to Aurora.

![Connect your wallets](@site/static/img/rainbowbridge1.png)

Next you need to choose the token you're transferring, and the amount you'll transfer. In the example below we're transferring 1 NEAR to Aurora.

![Enter your transfer details](@site/static/img/rainbowbridge2.png)

Now, you need to confirm your transaction.

![Confirm transfer](@site/static/img/rainbowbridge3.png)

Finally, if the transfer details are accurate and you're satisfied with the fee, click the "Approve" button.

![Approve transfer](@site/static/img/rainbowbridge4.png)

**Note:** Depending on the direction of your bridge transactions, you may be requested to confirm additional transactions in MetaMask and/or NEAR Wallet.
NEAR and Dropt to Revolutionize Loyalty and Engagement
NEAR FOUNDATION
January 19, 2023
NEAR Foundation is excited to announce a new partnership with Dropt, focused on embedding Web3 technologies into customer loyalty and engagement programs. With ownership and interoperability being critical components in the next generation of the customer experience, Dropt chose to build on NEAR. Its compelling tech stack and powerful tooling offer Dropt the ideal foundation for delivering these features at scale and redefining “frictionless onboarding”.

With Dropt, teams and enterprises can now easily and seamlessly introduce blockchain-powered loyalty and engagement mechanics into their customer journey. These Web3 features will help increase engagement, retention, and lifetime value without customers ever even knowing they are interacting with the blockchain. Customers simply use apps and sites just as they do today, but with new NFT-powered features. 

NEAR and Dropt believe this is the key to mass adoption. Users are not interested in what is happening in the background—they simply want a fun experience that is engaging and rewarding. 

For one of its first integrations, Dropt will be partnering with a NBA championship team, led by one of the most dominant players in the world. 

Blockchain mechanics shift the paradigm for customer engagement
By introducing NFTs to the customer journey, brands immediately integrate an incentive structure into the customer experience that elevates participation and engagement like never before. Branded marketplaces, where customers can interact with tokens, give users the ability to monetize their engagement with a brand.”With Dropt, NFTs can feature different kinds of perks and benefits. In this way, customers are better aligned with the brand’s and naturally become true evangelists.

A changing landscape
In an era where customer expectations are evolving and acquisition costs are rising, Dropt’s highly curated experiences enable brands to exceed these expectations. Let’s face it, loyalty is stale. Consumer expectations are shifting—people want to align themselves with brands that connect with authenticity and make consumers feel like part of a community.

Dropt transforms the loyalty experience into a deeper, more community-based level of engagement, enabling brands to better connect with their communities. This not only modernizes how brands engage in this digital era, but also creates new acquisition channels.

To capitalize on this opportunity, NEAR Foundation and Dropt believe user experience is vital. It’s unrealistic to expect customers to change their behavior, which is why Dropt and NEAR are working alongside cutting-edge authentication and gamification partners to build a web that’s both familiar and brings the best of what Web3 has to offer. 

Dropt is confident that in partnering with the Foundation, mass adoption is NEAR.
---
id: transaction-anatomy
title: Anatomy of a Transaction
---

A transaction is a request from a user to the network to perform a set of actions. To create a transaction, the user must specify the following fields:

- `Signer`: the account that signs the transaction
- `Actions`: the set of actions to be performed (see bellow)
- `Receiver`: the account on which to perform the actions

In addition, a transaction has the following fields to ensure its integrity and validity:

- `PublicKey`: the public key used to sign the Transaction (so the network can verify the signature)
- `Nonce`: a number that is incremented for each transaction sent by the `Signer`
- `BlockHash`: the hash of a recent block, to limit the time-validity of the transaction

Users create transactions and sign them with their private keys. Then, the **transaction and its signature** are broadcasted together to the network, where they are validated and processed.

:::tip
Each transaction has exactly one `Signer` and `Receiver`, but can have multiple `Actions`
:::

---

## Actions
Each transaction can have **one or multiple** `Actions`, which are the actual operations to be performed on the `Receiver` account. There are 9 types of actions that can be performed:

1. `FunctionCall`: to invoke a function on a contract (optionally attaching NEAR to the call)
2. `Transfer`: to transfer tokens to another accounts
3. `DeployContract`: to deploy a contract in the account
4. `CreateAccount`: to create a new sub-account (e.g. `ana.near` can create `sub.ana.near`)
5. `DeleteAccount`: to delete the account (transferring the remaining balance to a beneficiary)
6. `AddKey`: to add a new key to the account (either `FullAccess` or `FunctionCall` access)
7. `DeleteKey`: to delete an existing key from the account
8. `DelegateActions`: to create a meta-transaction
9. `Stake`: special action to express interest in becoming a network validator

For example, `bob.near` can bundle the following actions in a single transaction:
- Create the account `contract.bob.near`
- Transfer 5 NEAR to `contract.bob.near`
- Deploy a contract in `contract.bob.near`
- Call the function `init` in `contract.bob.near`

The `Actions` are executed in the **order they are specified in the transaction**. If any of the **actions fails**, the transaction is discarded and none of the actions take effect.

:::warning One Receiver
Notice that all actions are performed on the same account. It is **not possible** to perform actions on multiple accounts in a single transaction, because transactions can have **only one receiver**
:::
---
id: oracles
title: Price Oracles
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

Oracles are smart contracts that enable you to query the current price of an asset.

Since smart contracts cannot connect to
internet and pull information, Oracles rely on having someone constantly updating their prices. Because of that, be mindful
when using an oracle that there might be a delay between the market's latest information and the Oracles data.

Oracle contract's are not standardized. We will here list different providers and how to use their Oracle as they are built.

---

## Price Oracles

- Account: **priceoracle.near** | **priceoracle.testnet**
- Creator: [NearDefi](https://github.com/NearDeFi)
- Smart contract: https://github.com/NearDeFi/price-oracle
- Bot to fill contract: https://github.com/NearDeFi/near-price-oracle-bot

---

## Query Assets

<Tabs>
  <TabItem value="🖥️ CLI" label="🖥️ CLI">

```bash
near view priceoracle.near get_assets
``` 

</TabItem>

</Tabs>

<details>

<summary>Example response</summary>

```json
[
  [
    'wrap.near',
    {
      reports: [
        {
          oracle_id: 'thorinoracle.near',
          timestamp: '1669795900809627816',
          price: { multiplier: '17030', decimals: 28 }
        },
        {
          oracle_id: 'npo-aurora.near',
          timestamp: '1706631791706032710',
          price: { multiplier: '30641', decimals: 28 }
        },
        {
          oracle_id: 'gloriafoster.near',
          timestamp: '1706631808550973590',
          price: { multiplier: '30666', decimals: 28 }
        },
        ...
```

</details>

---

## Get Assets Price

<Tabs>
  <TabItem value="🖥️ CLI" label="🖥️ CLI">

```bash
near view priceoracle.near get_price_data
```

</TabItem>

</Tabs>

<details>

<summary>Example response</summary>

```json
{
  timestamp: '1706631861981947371',
  recency_duration_sec: 90,
  prices: [
    {
      asset_id: 'wrap.near',
      price: { multiplier: '30702', decimals: 28 }
    },
    {
      asset_id: 'aurora',
      price: { multiplier: '235662', decimals: 20 }
    },
    {
      asset_id: 'meta-pool.near',
      price: { multiplier: '38770', decimals: 28 }
    },
    {
      asset_id: 'linear-protocol.near',
      price: { multiplier: '36432', decimals: 28 }
    },
```

</details>

:::tip

Divide the returned `multiplier` by `10000` to obtain the price in USD.

:::
NEAR Protocol Roadmap 2023-4: The Next 2 Years of NEAR
COMMUNITY
November 9, 2022
This post, written by Pagoda’s Head of Protocol Bowen Wang, originally appeared on the Web3 startup platform and main contributor to the core Protocol Pagoda’s blog.

NEAR has evolved tremendously in the two years since the mainnet launch in October 2020. More than 20 protocol upgrades were done live, most recently the launch of Sharding Phase 1. As we look ahead to the next two phases of sharding and beyond, it’s time for an updated protocol roadmap.

This post will outline the next two years of evolving the NEAR Protocol and the technical priorities we believe will benefit builders and users the most. The roadmap is meant to be a living document and anyone is welcome to make suggestions or proposals on how the protocol should evolve.

The roadmap has two major components: Experience and Core. The Experience section encompasses user and/or developer experience and the protocol features needed to enable those experiences. As an example, an iPhone user can freely start to use applications built on top of NEAR without having to register an account if we have meta transactions and support for Secp256r1 keys.

The Core section, on the other hand, covers major efforts to improve the scalability and decentralization of the protocol. Most notably, this features the launch of phase 2 of sharding, which scales the network to 100 shards with no validators tracking all shards. Phase 2 is planned for 2023. The roadmap goes through 2024 with the delivery of phase 3 of sharding, which dynamically adjusts the number of shards based on demand.

Head over to the Pagoda blog to read the NEAR Protocol Roadmap 2023-4 with infographics.
---
description: Easily onboard new users to the NEAR ecosystem
title: NEARDROP
sidebar_position: 5
---

---

[NEARDROP](https://app.neardrop.io) is an easy way to onboard someone new to the NEAR ecosystem by sending them a linkdrop URL to which will send the receiver to the NEAR wallet. In this guide you will learn how to mass-generate onboarding links!\
\
**Warning:** Be sure to store your NEARDROP seed phrase in a safe at step 4, you’ll not be able to recover your Linkdrop account on another device without it.

## **How to mass-generate NEAR onboarding links**

#### **1. Go to the** [**NEARDROP Dashboard**](http://app.neardrop.io)

#### **2. Connect Wallet**

![NEAR Drop](@site/static/img/neardrop1.png)

#### **3. Connect to**[ **mynearwallet.com**](https://app.mynearwallet.com/)

![NEAR Drop](@site/static/img/neardrop2.png)

#### **4. Backup your NEAR Linkdrop specific seed phrase**

![NEAR Drop](@site/static/img/neardrop3.png)

**5. Deposit 5 NEAR to create your own Linkdrop Smart Contract**

![NEAR Drop](@site/static/img/neardrop4.png)

**6. Create new Campaign**

![NEAR Drop](@site/static/img/neardrop5.png)

**7. Specify Campaign Details**

![NEAR Drop](@site/static/img/neardrop6.png)

#### **8. Confirm Campaign details**

![NEAR Drop](@site/static/img/neardrop7.png)

#### **9. Confirm in wallet** ****

![NEAR Drop](@site/static/img/neardrop8.png)

#### **10. Success, your drops are ready**

![NEAR Drop](@site/static/img/neardrop9.png)

#### **11. Generate Custom QR codes out of the Linkdrop URLs**

If you wish to generate QR codes you need to submit each of the URLs into a QR code generator tool like [https://www.qrbatch.com/](https://www.qrbatch.com). You can add colours, your own logo and so forth. Be aware if you wish the QR code to look great you need to also shorten each link using a centralized service like [https://bitly.com/](https://bitly.com).

![NEAR Drop](@site/static/img/neardrop10.png)

**12. Receiving a linkdrop**

![NEAR Drop](@site/static/img/neardrop11.png)

Claiming a linkdrop is easy, just click the URL or scan a linkdrop QR code

#### **Any questions?**

If you have any questions, feature requests or encounter any problems join this[ Telegram support channel](https://t.me/joinchat/sPqlT3Zt-mAyNmI0).
NEAR and Nansen Partner on On-Chain Analytics for Founders and Investors
NEAR FOUNDATION
April 18, 2023
NEAR Foundation is excited to announce a new partnership with Nansen, a blockchain analytics firm, on advanced tools for dApp developers and investors. Led by the NEAR Balkans Hub, the partnership with Nansen will give developers and investors new insights and data-driven solutions, like real-time data on transactions, addresses, and network activity.

“We are excited to join forces with Nansen to offer our developer community even more valuable insights,” says Marieke Flament, CEO of the NEAR Foundation. “This partnership enables us to enhance our ecosystem and bring advanced analytics tools and data-driven insights to the forefront of the Web3 movement, ultimately accelerating the widespread adoption of decentralized applications.”

Nansen gives users access to billions of on-chain data points
With Nansen’s analytics platform, developers, investors, and other users get a comprehensive view of blockchain activity. This includes transaction flows, wallet holdings, and on-chain activity. 

Nansen enables users to analyze billions of on-chain data points with over 250m+ wallet addresses across multiple blockchains, discover opportunities, perform due diligence, and defend their portfolios with real-time dashboards and alerts. The platform also provides users with a suite of tools for monitoring blockchain projects and tracking their performance.

Alex Svanevik, CEO of Nansen, said that the platform is excited to join NEAR Foundation in giving NEAR in expediting “the next chapter of Web3 and empower[ing] developers to craft even more robust dApps.” 

“We’re proud to have led this partnership — our commitment to enabling future Web3 creators is reflected in everything we do, and we are excited to unlock that potential through the power of decentralization,” adds Ida Pandur, CEO of NEAR Balkans. “At the heart of our mission is a desire to empower individuals to create and innovate in a brand new way, and we are committed to continuing our efforts to make this vision a reality.”

As NEAR evolves into the Blockchain Operating System, a common layer for browsing and discovering open web experiences, compatible with all blockchains, this collaboration will help drive innovation on NEAR and onboard many new developers, investors, and end users into Web3.
```rust
// Set of possible action to take
#[derive(BorshSerialize, BorshDeserialize, Serialize, Deserialize, Debug)]
#[serde(crate = "near_sdk::serde")]
pub enum Action {
  // Action to add proposal. Used internally.
  AddProposal,
  // Action to remove given proposal. Used for immediate deletion in special cases.
  RemoveProposal,
  // Vote to approve given proposal or bounty.
  VoteApprove,
  // Vote to reject given proposal or bounty.
  VoteReject,
  // Vote to remove given proposal or bounty (because it's spam).
  VoteRemove,
  // Finalize proposal, called when it's expired to return the funds
  // (or in the future can be used for early proposal closure).
  Finalize,
  // Move a proposal to the hub to shift into another DAO.
  MoveToHub,
}

// Validator interface, for cross-contract calls
#[ext_contract(ext_dao_contract)]
trait ExternalDaoContract {
  fn act_proposal(&mut self, id: u64, action: Action, memo: Option<String>) -> Promise;
}

// Implement the contract structure
#[near_bindgen]
impl Contract {
  #[payable]
  pub fn act_proposal(&mut self, id: u64, action: Action, memo: Option<String>) -> Promise {
    let promise = ext_dao_contract::ext(self.dao_contract.clone())
      .with_attached_deposit(env::attached_deposit())
      .with_static_gas(Gas(10*TGAS))
      .act_proposal(id, action, memo);

    return promise.then( // Create a promise to callback query_greeting_callback
      Self::ext(env::current_account_id())
      .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")
    }
  }
}
```
# GenesisConfig

## protocol_version

_type: u32_

Protocol version that this genesis works with.

## genesis_time

_type: DateTime_

Official time of blockchain start.

## genesis_height

_type: u64_

Height of the genesis block. Note that genesis height is not necessarily 0. 
For example, mainnet genesis height is `9820210`.

## chain_id

_type: String_

ID of the blockchain. This must be unique for every blockchain.
If your testnet blockchains do not have unique chain IDs, you will have a bad time.

## num_block_producers

_type: u32_

Number of block producer seats at genesis.

## block_producers_per_shard

_type: [ValidatorId]_

Defines number of shards and number of validators per each shard at genesis.

## avg_fisherman_per_shard

_type: [ValidatorId]_

Expected number of fisherman per shard.

## dynamic_resharding

_type: bool_

Enable dynamic re-sharding.

## epoch_length

_type: BlockIndex,_

Epoch length counted in blocks.

## gas_limit

_type: Gas,_

Initial gas limit for a block

## gas_price

_type: Balance,_

Initial gas price

## block_producer_kickout_threshold

_type: u8_

Criterion for kicking out block producers (this is a number between 0 and 100)

## chunk_producer_kickout_threshold

_type: u8_

Criterion for kicking out chunk producers (this is a number between 0 and 100)

## gas_price_adjustment_rate

_type: Fraction_

Gas price adjustment rate

## runtime_config

_type: [RuntimeConfig](RuntimeConfig.md)_

Runtime configuration (mostly economics constants).

## validators

_type: [AccountInfo]_

List of initial validators.

## records

_type: Vec\<[StateRecord](StateRecord.md)\>_

Records in storage at genesis (get split into shards at genesis creation).

## transaction_validity_period

_type: u64_

Number of blocks for which a given transaction is valid

## developer_reward_percentage

_type: Fraction_

Developer reward percentage.

## protocol_reward_percentage

_type: Fraction_

Protocol treasury percentage.

## max_inflation_rate

_type: Fraction_

Maximum inflation on the total supply every epoch.

## total_supply

_type: Balance_

Total supply of tokens at genesis.

## num_blocks_per_year

_type: u64_

Expected number of blocks per year

## protocol_treasury_account

_type: AccountId_

Protocol treasury account

## protocol economics

> For the specific economic specs, refer to [Economics Section](../Economics/Economic.md).