Skip to main content

Best Practices

Pre-Development

  • Understand NEAR Protocol: Get acquainted with the NEAR protocol by reading the “NEAR Whitepaper” and to learn some key aspects such as Design principles, Economics and Technology used in the NEAR protocol. Something that's highly recommended to read are Account model , Access keys, Asynchronous by design, and Sharding to name a few. Familiarize yourself with the NEAR Protocol documentation, the NEAR GitHub repository, and other resources such as NEAR University or the NEAR YouTube channel.
  • Design Smart Contracts: Plan your smart contracts in advance. Remember that smart contract updates can be complex on blockchain, so good initial design is crucial. Some source code examples can be found at this Github repo. Please visit this link to learn more about how to “upgrade NEAR smart contracts”.
  • Select the Right Tools: NEAR provides Rust and Javascript for smart contract development. Choose based on your team's expertise and project requirements.

Development Stage

  • Use Test Driven Development (TDD): NEAR provides tools like the simulation testing framework for Rust and as-pect for JS. TDD allows you to ensure your contract behaves as expected. Some code samples can be found at this github repo.
  • Utilize NEAR SDKs: NEAR SDKs offer handy utilities and abstractions for account management, contract interaction, transaction construction, and more.
  • Ensure Efficient Gas Usage: Be mindful of computational and storage costs in smart contracts to ensure efficient usage of gas.
  • Optimizing contracts - Avoid the pitfalls of chunky (expensive) contracts which can also result in high gas fees. Please refer to the best practices for contract optimization.

Pre-Mainnet Deployment

  • Code Review and Auditing: Have your smart contracts reviewed and audited by third parties to detect potential security vulnerabilities and inefficiencies.Please contact your account manager who can guide you with some of the preferred smart contract partners we have in the NEAR Ecosystem such as Hacken, Ottersec, Certik, Halborn, etc.
  • Test on NEAR Testnet: Deploy your contract to NEAR Testnet to verify that it operates correctly in a live network environment.
  • Create a Rollout Plan: This should include contingency plans for any problems or bugs discovered after deployment.

Building on BOS

Maintenance and DevOps

Community Resources


Queries and suggestions ! email us blockchain-success@near.foundation