Docs Category: Rust

Reducing Contract Size

To Share and +4 nLEARNs Login with NEARReducing a contract’s size Advice & examples This page is made for developers familiar with lower-level concepts who wish to reduce their contract size significantly, perhaps at the expense of code readability. Some common scenarios where this approach may be helpful: contracts intended to be tied to one’s …

Reducing Contract Size Read More »


To Share and +4 nLEARNs Login with NEARDeploying Contracts You might want your smart contract to deploy subsequent smart contract code for a few reasons: The contract acts as a Factory, a pattern where a parent contract creates many child contracts (Mintbase does this to create a new NFT store for anyone who wants one; …

deploy-contract Read More »


To Share and +4 nLEARNs Login with NEARSending $NEAR You might want to send tokens from a contract for many reasons. The contract uses something like the Storage Standard and needs to return deposits to users when they unregister. Users pay into the contract and the contract later pays these fees to the maintainers, redistributes …

token-tx Read More »


To Share and +4 nLEARNs Login with NEARnear_bindgen The #[near_bindgen] macro is used on a struct and the function implementations to generate the necessary code to be a valid NEAR contract and expose the intended functions to be able to be called externally. For example, on a simple counter contract, the macro will be applied …

near-bindgen Read More »


To Share and +4 nLEARNs Login with NEARCollections Nesting Traditional approach for unique prefixes Hardcoded prefixes in the constructor using a short one letter prefix that was converted to a vector of bytes. When using nested collection, the prefix must be constructed manually. use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; use near_sdk::collections::{UnorderedMap, UnorderedSet}; use near_sdk::{near_bindgen, AccountId}; #[near_bindgen] #[derive(BorshDeserialize, …

nesting Read More »


To Share and +4 nLEARNs Login with NEARSerialization Protocols Serialization formats within the SDK define how data structures are translated into bytes which are needed for passing data into methods of the smart contract or storing data in state. For the case of method parameters, JSON (default) and Borsh are supported with the SDK and …

serialization-interface Read More »

Scroll to Top
Report a bug👀