[Report] Tutorial Repository for developing Near Contracts in Rust (may 01-> may 08 2022)

Project Title: New Full Tutorial for Near in Rust.

One-liner: 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, Matias Wald

Period: May 01 → May 08

Extra : Project is written in Brazilian Portuguese. Translations to English and Spanish are also being made by Matias Wald.

The following list are the results obtained by me:

Week 13

  • I gave Matias around 2000 lines of tutorial to translate last week. I’m letting the github repository still as I make the latest lessons locally. Lesson 6-3 is almost done though. It’s easier to organize both of our changes when we deliver in big packages.
  • Lesson 6-3 explains what the ‘?’ operator does. It has a function that simulates some random computation. Something similar to “increase a counter 500-20000 times according to a random value”. The function will consume gas in the process. Calculate the remaining available gas. Then return most of it back to the caller.
  • It’s a very small example. But explains some useful things: How to organize error management in a clean way, and how to control computing costs.
  • Studying all the changes that near-sdk-rs 4.0 full release will bring. It will be released next month. So will only update the tutorials by then.
  • Also was studying ways to optimize compile times in web-assembly projects. Had an idea for a new possible grant project. Front-end languages like svelte, react and vue are optimized for Web-2. It isn’t the best option for Web-3. So what if we created a front-end language designed for the blockchain? It’s more of a research idea at the moment. But if we use the latest updates to browser and web-assembly development. This could be a front-end language that is cheaper to maintain, easier to share, easier to develop and way more effective than any front-end language that came during the Web-2 era.
  • I would need a working prototype to show what I mean about the possible grant project. It might fail in the end. But it’s worth the attempt… I think.
  • I still intend to make Youtube/Odysee video classes. My voice is not loud enough for good quality classes. So maybe I should use text-to-speech instead.
  • This saturday I gave support to a fellow developer on the subject of rust smart contracts. He has a grant project. Was in Near group, but wasn’t in Near University. So, after the lesson, I suggested him joining for Near NCD and going for Office Hours for both Near Discord and Near University discord groups. Won’t say his name because I forgot to ask his permission. But if he finds this report, wish him the best.

Edit: Changed my mind from using text-to-speech in the course.
Edit2: Changed my mind about lesson 6-3. A useful example is better. So instead it will be a smart contract for a game. It creates sub-accounts for each player. The main smart contract holds data about all games. Each sub-account holds data about each player, and represents the runtime for each player. No player can directly call their sub-account. Instead they will be redirected from the main account by receiving a promise.

1 Like