Cohorts
  • Discover
  • About Us
  • Blog
  • Patika.dev
  • Web3

NEAR Developer Course

NEAR Certified Developer Final Project
What Does a Successful Project Look Like?
The Course Outline
NEAR CLI (Command Line Interface)
NEAR Explorer

What is Assembly Script?
Contract
File Structure
Imports
Practice I

Assert
Models
Context
Storage
Practice II

Collections
Arrays
Iteration
Classes

Introduction
Keys
Identity
Money

Smart Contract Overview
Account Model
View & Change Methods
Serde
NEAR Wallet
Practice: NEAR Academy-Meme Museum

Previous successful projects
Example: Thanks
Example: Guest Book
Example: Sample Lottery
Example: CRUD dApp
Develop project ideas
Submit and build your project plan

Loom video
Documentation and explanations
How to submit

Context

Contracts can import the blockchain context from near-sdk-as. How to import context from near-sdk-as?

import { context } from "near-sdk-as";

// contract code below this line can now make use of the context object

This object provides context for contract execution including information about the transaction sender, blockchain height, and attached deposit available for use during contract execution, etc. The snippet below is the complete interface as currently implemented.

// REFERENCE ONLY
// interface provided by the context object imported above

class Context {
  // Context API
  get sender(): string; // account ID that signed the original transaction that led to this execution (aka. signer account id)
  get contractName(): string; // account ID of current contract being executed (aka. current account id)
  get blockIndex(): u64; // current block index (aka. height)
  get storageUsage(): u64; // contract account storage usage before the contract execution

  // Economics API
  get attachedDeposit(): u128; // balance that was attached to the call that will be immediately deposited before the contract execution starts.
  get accountBalance(): u128; // balance attached to the given account. Excludes the `attachedDeposit` that was attached to the transaction.
  get prepaidGas(): u64; // gas attached to the call and available to pay for the gas fees
  get usedGas(): u64; // gas that was irreversibly used for contract execution (aka. burnt gas) + gas attached to any promises (cannot exceed prepaidGas)
}

Quiz

Answer the questions to check your understanding.

This lesson includes a short quiz.

Previous
Next

Lesson discussion

Swap insights and ask questions about “NEAR Developer Course”.

Enroll to participate
Start the course to unlock the discussion. Enrolling helps us keep conversations relevant to learners.
Cohorts
WebsiteDiscoverBlogPatika.devRise In
CoursesCircleRustSoliditySolanaWeb3 FundamentalsBlockchain Basics
CompanyAbout UsTerms of UsePrivacy PolicyGDPR NoticeCookies
Don't miss any update!

Disclaimer: The information, programs, and events provided on https://cohorts.patika.dev is strictly for upskilling and networking purposes related to the technical infrastructure of blockchain platforms. We do not provide financial or investment advice, nor do we make any representations regarding the value, profitability, or future price of any blockchain or cryptocurrency. Users are encouraged to conduct their own research and consult with licensed financial professionals before engaging in any investment activities. https://cohorts.patika.dev disclaims any responsibility for financial decisions made by users based on the information provided here.

© 2026 Cohorts, All rights reserved