Hyper Code IDE Guide
  • Introduction to Hyper Code IDE
  • Lesson 1: Get Started
    • Smart Contract Project Files
    • Project Files
    • CRC_Contract
    • Contract Method
  • Lesson 2: Smart Contracts
    • Introduction to Smart Contracts
    • Creating your first smart contract
    • Debugging
    • Deployment
    • Smart Contract Interaction
  • Lesson 3: Wallet Access
    • Introduction to Wallet Access
    • Circular Wallet Architecture
    • Native CRC Wallet
    • Custom Wallet Data
  • Lesson 4: Your First Token
    • Introduction
    • Simple Token Balance
    • GetBalance Function
    • Drop Function
    • Transfer Function
Powered by GitBook
On this page
  • Public:
  • Private:
  • Single Node Call (SNC):
  • Examples
  • Transaction (Modfiying State)
  • SNC (querying balance)
  1. Lesson 1: Get Started

Contract Method

In the following code snippet, methods and properties are grouped into three categories:

Public:

These are the primary methods users interact with through transactions. They are named normally.

Private:

Intended for internal use only and accessible for testing. They start with an underscore (”_”).

Single Node Call (SNC):

Executed only on a single node, without creating a blockchain transaction. They start with a double underscore (”__”).

Similarly, properties follow the same naming conventions. However, most interactions happen through methods (endpoints) rather than properties.

var CRC_Contract = {
  method1: function(param1, param2){ ... },   // Public method
  _method2: function(param1, param2){ ... },  // Private method
  __method3: function(param1, param2){ ... }  // SNC method
};

Single Node Call (SNC) methods are key in retrieving data (e.g., wallet balance) without altering the blockchain state. SNCs should never modify contract state, ensuring consistency and reliability. While Hyper Code enforces this, adhering to best practices prevents potential inconsistencies.

Examples

Transaction (Modfiying State)

CRC_Contract.TransferFunds("0x00023...40e20asd", 100);

SNC (querying balance)

CRC_Contract.__BalanceOf("0x00023...40e20asd");
PreviousCRC_ContractNextIntroduction to Smart Contracts

Last updated 7 months ago

SNCs incur gas fees but are cheaper than transactions. In the next tutorial, we’ll create and deploy your first smart contract, with debugging tips along the way.