[Report] New Tutorial Repository for developing Near Contracts in Rust (feb 01 -> mar 01, 2022)

Project Title: New Full Tutorial for Near in Rust.

One-liner: New Tutorial Repository for developing Near Contracts in Rust

Project Summary: : There are many great tutorials about creating NEAR contracts in Rust. This project isn’t intended to be a replacement to any of those. Instead, it will be detailed examples about the features of Rust using NEAR contracts. Several times when the compiler gives an error, a new developer may feel compelled to just try making changes until the error go away.

This tutorial will show all possible implementations for all kinds of features in rust. Including ownership, modules, traits, generics, enums and so on. That way it can work as reference for aspiring rustaceans.

Project Members: Lucas Lemos

Period: Feb 01 → Mar 01 (Brazil)

Extra : Project has the main branch in Brazilian Portuguese, and another in English. Will also create a near-in-minutes video for each one of the lessons (which hopefully will be worthy of the platform).

The following list are the results obtained by me:

Week 01

  • lesson_1_contract: Mostly for the Near-in-minutes submission. The minimum required for implementing and deploying contracts with rust. Link https://github.com/On0n0k1/Tutorial_NEAR_Rust/tree/English/lesson_1_contract
  • lesson_2_ownership: Detailed examples on how ownership work in function and variable implementations. Link: https://github.com/On0n0k1/Tutorial_NEAR_Rust/tree/English/lesson_2_ownership
  • lesson_3_structs: Detailed examples on structs. How to implement them. How ownership is implemented with them. self, &self and &mut self explained. Link https://github.com/On0n0k1/Tutorial_NEAR_Rust/tree/English/lesson_3_structs
  • lesson_4_modules: Detailed examples on modules. Two ways to use directories as modules. How private imports work. Testing modules. How to organize how modules are available for outside crates. Link: https://github.com/On0n0k1/Tutorial_NEAR_Rust/tree/English/lesson_4_modules

Week 02

  • Written a tutorial introduction (portuguese-br). Not finished. Link: https://github.com/On0n0k1/Tutorial_NEAR_Rust
  • Written a tutorial on installing near-cli (portuguese-br). Link: https://github.com/On0n0k1/Tutorial_NEAR_Rust/blob/main/static/tutorials/nearcli.md
  • Written a tutorial on installing rust (portuguese-br). Link: https://github.com/On0n0k1/Tutorial_NEAR_Rust/blob/main/static/tutorials/rust.md
  • Written a tutorial on lesson_1_contracts explaining what happens on each line of code for a simple NEAR contract in rust (portuguese-br). Still need to explain unit tests. Link: https://github.com/On0n0k1/Tutorial_NEAR_Rust/tree/main/lesson_1_contract

Last week I implemented the code examples for the first 4 topics. Only after that I realized that most people would rather have something to read instead.

I still need to create a tutorial on using cargo and near-cli (portuguese-br). That way I can be sure that learners won’t be missing anything. English versions will come later. Please ignore english versions for now.

Week 03

  • Started studying NEAR NFT standards, to be used in later tutorials.
  • I intend to offer classes in brazilian portuguese about NEAR as well. Currently sharing a hackmd course announcement in social media groups like linkedin, twitter and reddit, interested learners will join through a google forms document.
  • Created a tutorial introducing about cargo, the tool we use to manage rust projects (crates). Link: https://github.com/On0n0k1/Tutorial_NEAR_Rust/blob/main/static/tutorials/cargo.md
  • Written a tutorial about the first example, the boilerplate and introduction to NEAR contracts. Link: https://github.com/On0n0k1/Tutorial_NEAR_Rust/tree/main/lesson_1_contract
  • Written a tutorial introducing the usage of NEAR CLI. Link: https://github.com/On0n0k1/Tutorial_NEAR_Rust/blob/main/static/tutorials/nearcli.md
  • Finished setting up the tools needed for the video lessons.

The reason I felt the need to write these tutorials in portuguese is because I know by experience that many brazilians lose interest in a topic if they have to read everything in english. So, an introduction course would be useful to get them to write their first contract. After they write the first contract, it will be a lot easier to get interested in researching more by themselves.

Carefully writing tutorials about installing software is extremely boring. I’m glad I’m done with it and can move on to the more interesting topics now. I believe a full course in rust and in this language is going to be really valuable. Very few portuguese speakers are experienced in rust, and even less have time to create full courses about it. And it’s a course about creating NEAR contracts. It’s a very low probability.

I would gladly take any feedback from anyone about this project. Discord: On0n0k1#3800

Week 04

  • Still studying NFT standards and details about NEAR in nomicon.io.
  • I want to make a tutorial about cross-contract testing using Rust. I heard about https://github.com/near/workspaces-rs, so I started studying about it. Generated documentation using the command cargo doc --open, cloned the repository locally and started to check the implementation manually. If I figure out the uses for it, will prioritize creating the tutorial in both languages. Because there’s demand for it.
  • The course announcement resulted in only 1 brazilian assigning for it. Will meet with him tomorrow, give an introduction about NEAR programs, teach about the NEAR protocol, and introduce about programming in rust for web3.
  • Written a tutorial about ownership. Link: https://github.com/On0n0k1/Tutorial_NEAR_Rust/commit/c0e25e2f217a60ead26084cc45d395f6c8f026a2
  • Written a tutorial about structs. Link: https://github.com/On0n0k1/Tutorial_NEAR_Rust/commit/762bf0fd0972a02b55afd52bfcb36d0780095a03
  • Written a tutorial about modules. Link: https://github.com/On0n0k1/Tutorial_NEAR_Rust/tree/main/lesson_4_modules

Will make another announcement for the Brazilian Near + Rust course by the end of the week. Each developer we bring means a healthier platform.

Edited: Need to include that in the first week I worked in the code for the lessons. The other weeks I cleaned the code and created written markdown tutorials for the lessons and other topics.