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.
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)
SNC (querying balance)
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.
Last updated