Step 2 – Reading web3 NEAR Certified Developer

To Share and +4 nLEARNs

In the previous section, you learned about Web3, the Web3 application architecture, and an overview of the NEAR Protocol. In this lesson, you’ll concentrate on mastering contract reading in order to get ready to build Web3 applications on NEAR in the following lessons. Let’s find out how those contracts manage money, property, identity, and ownership!

To fully grasp this lesson

The goal of today’s lesson is to try to read as many smart contracts as you can. For each contract or project, ask the following questions:

  • What is the purpose of this contract?
  • How is it being written?
  • Why is it written like that?

Caution:

  • With JavaScript/TypeScript and Rust programming languages, there are numerous contracts. Choose a language that suits you.
  • You don’t need to build or test any contracts
  • You also don’t need to understand the entire code line
  • Focus on reading the most basic parts of the contract and linking the contract’s purposes to the code.

You might not fully comprehend what you should do at this point. Where to start? No problem; LNC will show you how to read the most basic project. We begin with

Hello NEAR projects – JavaScript

GitHub project: https://github.com/near-examples/hello-near-js

Hello NEAR is a simple dApp used to store a greeting up close and visible to the user. The application consists of 2 main parts:

  • A smart contract allows you to store and change the greeting
  • Simple web interface that displays greetings and allows users to change

We will focus on reading the project Hello NEAR with Javascript programming language.

The structure of the project includes:

  • Frontend – ReactJs in folder/frontend
  • smart contract code in folder/contract

Contract

Go to file/contract/src/contract.ts

In the contract, there is a HelloNear class representing the smart contract:

  • Smart contract stores a greeting variable whose initial value is “Hello”
  • The get_greeting function is marked @view({}), i.e., it only reads data in the blockchain, with absolutely no transaction fees. get_greeting returns the stored greeting value.
  • The function set_greeting is marked @call(), changing the value stored on the blockchain, so there will be a transaction fee when calling the function. set_greeting stores the new greeting value entered by the user.

Your task will be to read as many contracts as you can from the list below and then finish the final assignment.

More Activity

Read the contracts in your favorite language, starting from the basic ones to the more advanced ones here: https://docs.near.org/tutorials/welcome

Generate comment with AI 2 nL

✅ Now, it is time to submit assignment!

Scroll to Top