Archives: Docs

Docs

Environment

Login with NEAREvery method execution has an environment associated with information such as: Who called the method How much money is attached to the call How many computational resources are available The current timestamp Helper functions for Public Key derivation, for example Environment Variables | Variable Name | SDK Variable | Description | |————————|——————————-|————————————————————————————–| | …

Environment Read More »

Cross-Contract Calls

Login with NEARYour contract can interact with other deployed contracts, querying information and executing functions on them. Since NEAR is a sharded blockchain, its cross-contract calls behave differently than calls do in other chains. In NEAR. cross-contract calls are asynchronous and independent. info Cross-Contract Calls are **Independent** You will need two independent functions: one to …

Cross-Contract Calls Read More »

Best Practices

Login with NEARBest practices Enable overflow checks It’s usually helpful to panic on integer overflow. To enable it, add the following into your Cargo.toml file: [profile.release] overflow-checks = true Use require! early Try to validate the input, context, state and access using require! before taking any actions. The earlier you panic, the more gas you …

Best Practices Read More »

Collections

Login with NEARWhen deciding on data structures it is important to understand their tradeoffs. Choosing the wrong structure can create a bottleneck as the application scales, and migrating the state to the new data structures will come at a cost. You can choose between two types of collections: Native collections (e.g. Array, Map, Set), provided …

Collections Read More »

Basic Anatomy

Login with NEARLet’s illustrate the basic anatomy of a simple “Hello World” contract. The code on this page comes from our Hello NEAR repository on GitHub. ### Importing the SDK All contracts will import the **NEAR SDK**, enabling them to [access the execution environment](https://raw.githubusercontent.com/Techbridge3/docs/master/docs/2.build/2.smart-contracts/anatomy/./environment.md), [call other contracts](https://raw.githubusercontent.com/Techbridge3/docs/master/docs/2.build/2.smart-contracts/anatomy/./crosscontract.md), [transfer tokens](https://raw.githubusercontent.com/Techbridge3/docs/master/docs/2.build/2.smart-contracts/anatomy/./actions.md), and much more. You can also …

Basic Anatomy Read More »

Transfers & Actions

Login with NEARSmart contracts can perform specific Actions such as transferring NEAR, or calling other contracts. An important property of Actions is that they can be batched together when acting on the same contract. Batched actions act as a unit: they execute in the same receipt, and if any fails, then they all get reverted. …

Transfers & Actions Read More »

What is a Smart Contract?

Login with NEARSmart contracts are pieces of executable code that live in a NEAR account. They can store data, perform transactions in the account’s name, and expose methods so other accounts can interact with them. Developers can choose between using Javascript or Rust to write smart contracts in NEAR. Indistinctly from the language chosen, the …

What is a Smart Contract? Read More »

Wallet Chain Key Rules

Login with NEAROverview In this article you’ll find details on how to parse and present multichain transactions to the user so they can take an informed decision about their wallet’s assets, while minimizing the number of times the user has to consent. You’ll also learn how to ensure that a signature on one chain is …

Wallet Chain Key Rules Read More »

NFT Chain Keys Smart Contract

Login with NEARThe NFT Chain Keys smart contract makes the ownership of remote accounts both provable and transferrable. This new paradigm allows you to create new end-user experiences that leverage provable and transferrable remote accounts as a core primitive. Contract overview The MPC Account Recovery smart contract provides a sign method that accepts a path …

NFT Chain Keys Smart Contract Read More »

Scroll to Top