jcarbonnell/preTrainingNEAR huggingface dataset:
---
id: checklist
title: ✅ Checklist
---

Once you finished developing your smart contract please go through the following list in order to ensure everything is safe for the end user.

:::info
Check our [security articles](./welcome.md) to understand how to improve the security of your contract.
:::

---

## Anatomy
1. All private methods are decorated as `private`.

## Environment
2. `predecessor` and `signer` are used correctly through the entire contract.

## Storage
3. Each time the state grows it is ensured that there is enough balance to cover it
4. All collections (i.e. Vector, Map, Tree, etc) have an unique id
5. Check for underflow and overflow!. In rust, you can do this by simply adding the `overflow-checks = true` flag in your `Cargo.toml`.

## Actions
6. When sending money, you leave enough in the contract to cover the storage cost
7. If you are tracking user's fund, you **deduct them before** sending them back to the user. 

## Callbacks
8. All private callbacks are marked as `private`
9. All cross-contract calls have a callback
10. All callbacks check for errors and roll back the state if necessary
11. All callbacks return money to the `predecessor` if necessary
12. Callbacks are free of `panic!`
13. All the callbacks are given enough GAS to execute entirely
14. The contract is not left in an exploitable state between a cross-contract call and its callback
---
id: run-rpc-node-with-nearup
title: Run an RPC Node (with nearup)
sidebar_label: Run a Node (with nearup)
sidebar_position: 3
description: How to run an RPC Node with nearup
---

*We encourage you to set up your node with Neard instead of Nearup as Nearup is not used on Mainnet. Please head to [Run a Node](/rpc/run-rpc-node-without-nearup) for instructions on how to setup a RPC node with Neard.*

<blockquote class="info">
<strong>Heads up</strong><br /><br />

The README for `nearup` (linked above) may be **all you need to get a node up and running** in `testnet` and `localnet`. `nearup` is exclusively used to launch NEAR `testnet` and `localnet` nodes. `nearup` is not used to launch `mainnet` nodes.

</blockquote>


## Prerequisites

- [Git](https://git-scm.com/)
- [Nearup](https://github.com/near-guildnet/nearup): Make sure [`nearup`](https://github.com/near-guildnet/nearup) is installed. You can install `nearup` by following the instructions at https://github.com/near-guildnet/nearup.

---

### Steps to Run an RPC Node using `nearup`

Running a RPC node is very similar to running a [validator node](/validator/running-a-node) as both types of node use the same `nearcore` release. The main difference for running a validator node is requiring `validator_key.json` to be used by the validator node to support its work of validating blocks and chunks on the network.


First, clone the `nearcore` repo:

```text
git clone https://github.com/near/nearcore.git
cd nearcore
```
Checkout the version you wish to build:

```bash
git checkout <version>
```

You can then run:

```bash
make neard
```

This will compile the `neard` binary for the version you have checked out, it will be available under `target/release/neard`.

Note that compilation will need over 1 GB of memory per virtual core
the machine has. If the build fails with processes being killed, you
might want to try reducing number of parallel jobs, for example:
`CARGO_BUILD_JOBS=8 make neard`.

NB. Please ensure you build releases through `make` rather than `cargo
build --release`.  The latter skips some optimizations (most notably
link-time optimisation) and thus produces a less efficient executable.


```bash
nearup run testnet --binary-path path/to/nearcore/target/release
```

You will then be prompted for an Account ID below. You should leave this empty as you are running an RPC node, not a validator node.

```text
Enter your account ID (leave empty if not going to be a validator):
```

Wait until initialization finishes, use the following command to follow logs:
```bash
  $ nearup logs --follow
```
Then run:
```bash
  $ nearup stop
```

Retrieve a copy of the latest RPC snapshot from S3:
```bash
$ aws s3 --no-sign-request cp s3://near-protocol-public/backups/testnet/rpc/latest .
$ LATEST=$(cat latest)
$ aws s3 --no-sign-request cp --no-sign-request --recursive s3://near-protocol-public/backups/testnet/rpc/$LATEST ~/.near/data
```


Finally, run the following command and the node should start syncing headers:
```bash
  $ nearup run testnet
```

>Got a question?
<a href="https://stackoverflow.com/questions/tagged/nearprotocol">
  <h8>Ask it on StackOverflow!</h8></a>
NEAR and Popp Partner on Customer Engagement for Small Businesses
NEAR FOUNDATION
March 24, 2023
NEAR Foundation is excited to announce a new partnership with Popp, a company helping small businesses generate better customer engagement using Web3 technology. 

As part of the partnership, Popp — a solution-as-a-service (SaaS) for small-to-medium consumer brands — will launch its white-labeled tools and products exclusively on NEAR. 

How Popp works for small businesses
Popp helps consumer brands launch micro community spaces for customers, which are embedded in their online stores. Milestone-based customer rewards then drive more engagement for brands. The NEAR partnership will, for instance, allow Popp’s customers to issue NFTs when certain milestones are met. 

On Popp, brands can build deeper, more meaningful connections with customers by rewarding them across multiple touch points. Through these bespoke projects, Popp has already generated over £57k in revenue ($69k USD) in six months via six pilot partners. 

Popp has two interfaces. On the business side, each brand gets its own custom dashboard, where they control its loyalty and rewards program and see customer data. On the customer side, users can see all of the user activity in one place, like new members and the number of “Popps” that are live or completed. Customers can also create and interact with content — the more they interact with the community, the more coins they can earn. 

Popp’s customer brands include Batch LDN, perl Cosmetics, Acid Running, Jenki Matcha, and Ocean Bottle. 

What’s a Popp? 
A Popp is a small task set by a brand for customers. If customers complete the task, they earn coins that can be used to redeem rewards or unlock experiences. 

Each brand can set a variety of Popps for their customers, which are micro-tasks that generate value for the brand. This can include creating content, leaving reviews, or referring friends. Completing various Popps give users things like discounts and vouchers, but brands can also set up popps for charity, sustainability, and much more.

Through Popp’s “Partnerships” feature, brands can make coins redeemable for rewards from partnering bands. This feature even allows companies to “invite” brands to partner with them for these rewards.  Each customer gets their own user profile, through which they can see the number of coins they’ve collected, and explore where to redeem rewards.

 

Head over to Popp to explore the company’s customer rewards ecosystem. Popp’s closed beta is now live and e-commerce brands should head over to the website now to join the waitlist!
---
title: NFTs on NEAR
description: A guide to non-fungible tokens on NEAR.
sidebar_position: 4
---

---
## What's an NFT?

Non-Fungible Tokens (NFTs) are digital certificates of ownership for digital assets. These digital certificates are published into an [NEP-171](https://nomicon.io/Standards/Tokens/NonFungibleToken/Core) token, and once written, they're secured on the blockchain.

To create NFTs, the identifying information for these unique digital assets must be recorded on a smart contract. The information on the smart contract is what makes an NFT unique. Anything can be turned into an NFT, with the most popular being videos, media files, or images.

NFTs are inherently different from fungible assets like Bitcoin because bitcoins can be exchanged, meaning you can send or receive coins without any hitches. Fungible assets are also divisible, allowing you to send smaller amounts. Non-fungible assets are indivisible. For example, you can’t send someone a part of a painting or a ticket.

> A non-fungible asset has a distinct property or properties that set it apart from other assets.
Non-fungible tokens are based on non-fungible assets and are unique digital assets that use blockchain technology.
An example of a non-fungible asset can be a unique painting or limited edition collectibles.

## NFTs on NEAR

Minting NFTs on NEAR is fast, and costs a negligible fee. 
If you'd like to build NFTs on NEAR, check out this [contract example](https://examples.near.org/NFT) to help you get started.
Our develper documentation contains a more detailed minting [tutorial](https://docs.near.org/tutorials/nfts/minting-nfts), if you'd like more information about developing an NFT minting contract on NEAR.


NFT projects on NEAR allow you to mint NFTs, exchange NFTs, or use NFTs in dApps.
You can store the NFTs that you mint, or receive in your NEAR wallet.
The number of NFT projects on NEAR is rapidly growing because of the many different use-cases for NFTs.
Have a look at the community-run resource [AwesomeNEAR](https://awesomenear.com/) to find exciting NFT projects on NEAR.
```bash
near view v2.ref-finance.near get_pools '{"from_index": 0, "limit": 1000}'
```

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

```bash
[
  {
    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>
---
id: post-processing
title: "Post Processing Tools"
---

# Post Processing Tools
The size of the contract is a critical characteristic. The best way to keep it small is a well-designed minimalistic code with a reduced number of dependencies. It is especially important for large contracts and huge multi-contract dApps that can take a fortune to deploy.

When you have done your best with the code optimization it is worth reducing the size of the contract by minifying it. 

## Ready to use script
We have prepared a simple `bash` script that can be used to minify `.wasm` contract file. You can find it [here](https://github.com/near/near-sdk-rs/blob/master/minifier/minify.sh).

The current approach to minification is the following:
1. Snip (i.e. just replace with unreachable instruction) few known fat functions from the standard library (such as float formatting and panic-related) with `wasm-snip`.
2. Run `wasm-gc` to eliminate all functions reachable from the snipped functions.
3. Strip unneeded sections, such as names with `wasm-strip`.
4. Run `binaryen wasm-opt`, which cleans up the rest.

### Requirements to run the script:
- install [wasm-snip](https://docs.rs/wasm-snip/0.4.0/wasm_snip/) and [wasm-gc](https://docs.rs/crate/wasm-gc/0.1.6) with Cargo:
```bash
cargo install wasm-snip wasm-gc
```
- install [binaryen](https://github.com/WebAssembly/binaryen) and [wabt](https://github.com/WebAssembly/wabt) on your system. For Ubuntu and other Debian based Linux distributions run:
```bash
apt install binaryen wabt
```
## WARNING
Minification could be rather aggressive, so you must test the contract after minification. Standalone NEAR runtime could be helpful [here](https://github.com/nearprotocol/nearcore/tree/master/runtime/near-vm-runner).
import {LeadershipResources, CommunicationResources, ResilienceResources} from '@site/src/components/LeadershipCards';


:::info on this page
* Resources to improve you and your team's leadership skills
* Resources to improve you and your team's communication skills
* Resources to improve you and your team's resilience
:::

# Leadership Toolkit

This collection of resources provided by [Abensur Consulting](http://www.abensurconsulting.com/) will help you cultivate better **Leadership** through understanding the roles and responsibilities of everyone on your team, how to foster **Effective Communication**, and how to build **Resilience**.

These resources are PDFs, artiles, and videos to help you be the best leader you can be. Revisit them often to refresh your memory and to learn new skills.

## Leadership

<!-- - DAC: role of a leader (see attached)
- DAC: assess your team (see attached)
- Picture of Success (see attached)
- A great boss according to Google (see attached)
- Five dysfunctions of a team:
https://youtu.be/GCxct4CR-To -->

Discover the factors that can make or break an effective leader.

<LeadershipResources />

## Effective communication
<!-- - Active Listening
https://www.ccl.org/articles/leading-effectively-articles/coaching-others-use-active-listening-skills/?utm_source=pdf&utm_medium=print&utm_campaign=virtual-communication-quiz&utm_content=active-listening&utm_term=resource#
- Feedback (COIN model) (see attached)
- Preparing difficult conversations (see attached)
- List of powerful questions for 1o1s (see attached)
- To Win Over an Audience, Focus on Building Trust
https://hbr.org/2022/03/to-win-over-an-audience-focus-on-building-trust?utm_medium=email&utm_source=circ_newbusiness&utm_campaign=contentmarketingseries_nonsubs&hide_intromercial=true&tpcc=email.circ_newbusiness.content.SEGB&deliveryName=DM181852
- Influencing: The Skill of Persuasion (see attached) -->

Understand your organizational dynamics, and what it takes to build a cohesive team.

<CommunicationResources />

## Resilience


<!-- Resilience
- Practice resilience (see attached)
- Resilience When Staring in the Face of Fear
http://insights.hudsoninstitute.com/resilience-when-staring-in-the-face-of-fear?utm_source=hs_email&utm_medium=email&utm_content=88596425&_hsenc=p2ANqtz-8jccr1KBJY6xqavz8xP8ZlazeYhVMbEah8e6GwErbbb5aw31YtY4XIgEk2EEHQscfYsgwS63O5tJIJcbjls9o5ai0tYg&_hsmi=88597051 -->

Grit is the ability to bounce back from adversity and keep going. Learn how to build resilience in yourself and your team.

<ResilienceResources />

## Further Reading
- **Conscious Business** - Fred Kofman
- **Reinventing Organizations** - Frederic Laloux
- **Crucial conversations** - Kerry Patterson
---
sidebar_position: 4
---

# Payable Methods

We can allow methods to accept token transfer together with the function call. This is done so that contracts can define a fee in tokens that needs to be paid when they are used. By default the methods are not payable and they will panic if someone will attempt to transfer tokens to them during the invocation. This is done for safety reason, in case someone accidentally transfers tokens during the function call.

To declare a method as payable, use the `#[payable]` annotation within the [`near_bindgen` macro](../contract-structure/near-bindgen.md) as follows:

```rust
#[payable]
pub fn my_method(&mut self) {
...
}
```

This will allow the `my_method` function to be called and transfer balance to the contract.

Example:

```rust
#[near_bindgen]
impl Contract {
    #[payable]
    pub fn take_my_money(&mut self) {
        near_sdk::env::log_str("Thanks!");
    }
    pub fn do_not_take_my_money(&mut self) {
        near_sdk::env::log_str("Thanks!");
    }
}
```

is equivalent to:

```rust
#[near_bindgen]
impl Contract {
    pub fn take_my_money(&mut self) {
        near_sdk::env::log_str("Thanks!");
    }
    pub fn do_not_take_my_money(&mut self) {
        if near_sdk::env::attached_deposit() != 0 {
            near_sdk::env::panic_str("Method do_not_take_my_money doesn't accept deposit");
        }
        near_sdk::env::log_str("Thanks!");
    }
}
```
NEAR CLI 3.0.0 Released
DEVELOPERS
December 2, 2021
Our command-line interface tool just got a new major version release that introduced some big changes. NEAR’s DevRel team would like to take a moment to go over these changes to not only show you the changelog but explain why these changes were made. This is a new initiative to give our developer community an insight into our decision-making process as well as a better understanding of how NEAR works.

Deployment changes
– near deploy now warns users if there is an existing contract deployed. (PR #883)

near deploy (used for deploying smart contracts to a given account) now has an added prompt warning users if an existing contract has already been deployed. NEAR accounts can only have one contract deployed per account, but we frequently saw developers would accidentally overwrite existing contracts, especially when first onboarding to our platform. This prompt should help folks understand the singular contract concept and mitigate any accidental state changes to existing smart contracts.  

Access Keys changes
– near delete-key now prompts for confirmation of key deletion. (PR #890)

Similar to the near deploy update, near delete-key (used for deleting an access key from an account) now prompts users for confirmation of this action. It will also ask the user to make sure this key is not for a recovery method. In addition, if you are deleting the last full-access key it will give a second prompt warning the user that this will fully lock the account/contract. Deleting all full-access keys will disable the ability to recover access to an account and should have an extra warning layer to prevent an accidental ownership lockout.

New flags
– `-f, –force`  flags added to override warning prompts. (PR #890)


The two big changes introduced with this CLI release are only new for those who are already using scripts to run the above commands (deploy and delete-key). For those who want to upgrade to NEAR CLI 3.0.0 and still use scripting for these commands, we have added the -f or –force flags to override the warning prompts.
```js
const tokenContract = "token.v2.ref-finance.near";
const tokenMetadata = Near.view(tokenContract, "ft_metadata", {});
```

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

```json
{
  "spec": "ft-1.0.0",
  "name": "Ref Finance Token",
  "symbol": "REF",
  "icon": "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='16 24 248 248' style='background: %23000'%3E%3Cpath d='M164,164v52h52Zm-45-45,20.4,20.4,20.6-20.6V81H119Zm0,18.39V216h41V137.19l-20.6,20.6ZM166.5,81H164v33.81l26.16-26.17A40.29,40.29,0,0,0,166.5,81ZM72,153.19V216h43V133.4l-11.6-11.61Zm0-18.38,31.4-31.4L115,115V81H72ZM207,121.5h0a40.29,40.29,0,0,0-7.64-23.66L164,133.19V162h2.5A40.5,40.5,0,0,0,207,121.5Z' fill='%23fff'/%3E%3Cpath d='M189 72l27 27V72h-27z' fill='%2300c08b'/%3E%3C/svg%3E%0A",
  "reference": null,
  "reference_hash": null,
  "decimals": 18
}
```

</p>

</details>
NEAR Community Update: Nov 29, 2018
COMMUNITY
November 29, 2018
It’s official: as promised, we’re now open source.

As Illia announced in the accompanying post, this is the first milestone on the path to TestNet and it’s intended to help us build a more engaged early developer community. This early community is important because they will help us fulfill our commitment to creating the most developer-friendly toolset out there.

Speaking of community, the ball is officially rolling on our in-person community here in SF and it’s going to pick up speed quickly.

Speaking and Events
We’ve focused primarily on building out our local event series which addresses not just developers but a broad ecosystem of designers, product people and startuppers too.

Recent Highlights

We kicked off our cross-disciplinary San Francisco Meetup group with a look at the state of the ecosystem. Expecting the recording shortly.
We attended a sharding panel with the Stanford Blockchain Club on Nov 28th alongside OmniLedger.
Upcoming Events

[SF] Dec 5: Blockchain 101 Onramp: Start Here! Deconstructing the Blockchain Ecosystem
[SF] Dec 12: Improving Blockchain Developer Experience: When UX Meets Developer Tools
Writing and Content
Aliaksandr Hudzilin started a series on the promise of blockchain in the music industry
Engineering Highlights
I’ve already provided the lead on engineering highlights — we officially open-sourced our core client repos, including:

The NEAR Studio web IDE, which allows you to play with writing contracts using TypeScript in a web window. The interface is still preliminary.
NEARCore repo including the local DevNet code.
This is in the context of the following upcoming milestones:

DevNet: Finish building out the developer experience for our blockchain. We are progressing on this milestone pretty well, but there is still more work to be done.
“Minimum Viable Blockchain” (MVB): a fully functioning blockchain that can provide a platform for running experiments on governance, economics and user experience. This version will only have a Beacon Chain consensus.
Shard Chains: Add sharding of state and processing to MVB.
How You Can Get Involved
If you want to stay up to date with what we build at NEAR, use the following channels:

Twitter — https://twitter.com/nearprotocol,
Discord — https://discord.gg/kRY6AFp, we have open conversations on tech, governance and economics of blockchain on our discord.
https://upscri.be/633436/
---
id: debug-pages
title: Debug Pages
sidebar_label: Debug Pages
description: Debug Pages
---

# Debug Pages
Debug pages is a feature that allows node maintainers to navigate detailed information about the node in a structured way

## Enable Debug Pages
To enable debug pages modify your config.json file and restart the node.
```
...
"rpc": {
    ...
    "enable_debug_rpc": true,
    ...
 }
 ...
```
By default, debug pages will become accessible on `<your node ip>:3030/debug`.  
If you modified your rpc address in config, then debug page will be accessible on `<config.rpc.addr>/debug`.

## Last blocks page
Displays 50 most recent blocks. Shows hash, as well as time and gas stats for block and every shard.  
On the left schematically displays the chain to visualize forks.

## Network info page
Displays a table of peers.
For every peer shows:
- some sync information like height and last block hash;
- id information like validator pool name (if peer is a validator), peer id;
- network information like address, traffic, route;
- node information like archival flag and tracked shards.

## TIER1 Network info page
Similar to network page, but about TIER1 network.

## Epoch info page
Displays several tables related to epochs:
- Start height and epoch hash for last 4 epochs, current epoch and next epoch;
- Validators in the current epoch;
- Validators in the next epoch;
- Validator proposals;
- Validator kickouts;
- Validator type for current validators in 6 epochs described on the page. Whether the validator is a block producer or a chunk-only producer;
- Shard sizes for 5 out of 6 epochs described on the page (because one of them didn't start yet).

## Chain & Chunk info page
Displays information about chunks requested and received by the node 


## Sync info page
Displays a page with tracked shards for this epoch and the next epoch.
Also shows status of three sync algorithms that are executed sequentially if the node is behind:
- Header sync
- State sync
- Block sync

## Validator info page
Displays information related to blocks and chunks produced by the node and approvals or skips sent by other nodes.

## Client Config page
Displays client config JSON of the node.