https://github.com/near-examples/NFT
Example implementations of tokens to represent unique assets, such as collectibles or deeds, using the NEP-171 spec (similar to ERC-721)
https://github.com/near-examples/NFT
cli ready-to-use rust
Last synced: 2 months ago
JSON representation
Example implementations of tokens to represent unique assets, such as collectibles or deeds, using the NEP-171 spec (similar to ERC-721)
- Host: GitHub
- URL: https://github.com/near-examples/NFT
- Owner: near-examples
- License: mit
- Created: 2020-05-14T22:03:41.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2025-03-29T20:32:39.000Z (4 months ago)
- Last Synced: 2025-03-29T21:26:55.098Z (4 months ago)
- Topics: cli, ready-to-use, rust
- Language: Rust
- Homepage: https://nomicon.io/Standards/NonFungibleToken/Core.html
- Size: 1.48 MB
- Stars: 376
- Watchers: 13
- Forks: 282
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-near - NFT example
- awesome-rust-list - near-examples/NFT - examples/NFT?style=social"/> : Example implementations of tokens to represent unique assets, such as collectibles or deeds, using the NEP-171 spec (similar to ERC-721). (Web3 and ZKP Framework)
- awesome-rust-list - near-examples/NFT - examples/NFT?style=social"/> : Example implementations of tokens to represent unique assets, such as collectibles or deeds, using the NEP-171 spec (similar to ERC-721). (Web3 and ZKP Framework)
README
# Non-fungible Token (NFT) Example 🖼️
[](https://docs.near.org/tutorials/welcome)
[](contract-rs)This repository contains an example implementation of a [non-fungible token] contract in Rust which uses [near-contract-standards] and workspaces-rs tests.
[non-fungible token]: https://nomicon.io/Standards/NonFungibleToken/README.html
[near-contract-standards]: https://github.com/near/near-sdk-rs/tree/master/near-contract-standards
[near-workspaces-rs]: https://github.com/near/near-workspaces-rs>**Note**: If you'd like to learn how to create an NFT contract from scratch that explores every aspect of the [NEP-171](https://github.com/near/NEPs/blob/master/neps/nep-0171.md) standard including an NFT marketplace, check out the NFT [Zero to Hero Tutorial](https://docs.near.org/tutorials/nfts/introduction).
## How to Build Locally?
Install [`cargo-near`](https://github.com/near/cargo-near) and run:
```bash
cargo near build
```> Note: to avoid issues, be sure to update your Rust compiler with `rustup update stable`
## How to Test Locally?
```bash
cargo test
```## How to Deploy?
To deploy manually, install [`cargo-near`](https://github.com/near/cargo-near) and run:
```bash
# Create a new account
cargo near create-dev-account# Deploy the contract on it
cargo near deploy# Initialize the contract
near call new_default_meta '{"owner_id": ""}' --accountId
```## Basic methods
```bash
# View metadata
near view nft_metadata# Mint a NFT
near call nft_mint '{"token_id": "0", "token_owner_id": "", "token_metadata": { "title": "Olympus Mons", "description": "Tallest mountain in charted solar system", "media": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/00/Olympus_Mons_alt.jpg/1024px-Olympus_Mons_alt.jpg", "copies": 1}}' --accountId --deposit 0.1# View tokens for owner
near view nft_tokens_for_owner '{"account_id": ""}'# Transfer a NFT
near call nft_transfer '{"token_id": "0", "receiver_id": "", "memo": "transfer ownership"}' --accountId --depositYocto 1
```## Useful Links
- [cargo-near](https://github.com/near/cargo-near) - NEAR smart contract development toolkit for Rust
- [near CLI](https://near.cli.rs) - Iteract with NEAR blockchain from command line
- [NEAR Rust SDK Documentation](https://docs.near.org/sdk/rust/introduction)
- [NEAR Documentation](https://docs.near.org)
- [NFT Zero to Hero Tutorial](https://docs.near.org/tutorials/nfts/introduction)
- [NEAR StackOverflow](https://stackoverflow.com/questions/tagged/nearprotocol)
- [NEAR Discord](https://near.chat)
- [NEAR Telegram Developers Community Group](https://t.me/neardev)
- NEAR DevHub: [Telegram](https://t.me/neardevhub), [Twitter](https://twitter.com/neardevhub)