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
- BOS overview video
- Longer Technical Workshop (video)
- Technical Workshop (slides)
- Technical docs (site)
- Ecosystem projects on BOS
- EVM decentralized frontends on BOS
- BOS telegram community channel
Maintenance and DevOps
- Monitoring: Set up monitoring for your contract. Explorers like NEAR explorer, NEAR blocks and indexers like near lake can help with this.
- Updating Contracts: Design your contracts to be upgradable or, alternatively, make sure you have a way to migrate state to a new contract if needed. There are two different ways to update your smart contracts:
- Through tools such as NEAR CLI or near-api-js (requires the account's full access key).
- Programmatically, by implementing a method that takes the new code and deploys it.
Community Resources
- Community Engagement: Regularly communicate updates with your user base. This includes being active in NEAR community forums, hosting AMAs, etc.
- Join NEAR community channels to stay up to date about NEAR:
3. Technical docs - https://docs.near.org/
4. Github - https://github.com/near
5. Telegram - t.me/cryptonear
6. Community - https://t.me/nearprotocolnews (announcements)
7. Discord - near.chat 8. Blockchain Operating System - near.org 9. Twitter - https://twitter.com/NEARProtocol 10. Companies & projects building on NEAR - NEAR Horizon
Queries and suggestions ! email us blockchain-success@near.foundation