starknet_getClass

Get the contract class definition associated with the given hash

The starknet_getClass command is used to obtain the contract class definition associated with an imputed hash.

By taking inspiration from object-oriented programming, StarkNet distinguishes between a contract and its implementation, separating contracts into classes and instances:

  • A contract class is the definition of the contract: Cairo byte code, hint information, entry point names, and everything that defines its semantics unambiguously. Each class is identified by its class hash, which is analogous to a class name in an object-oriented programming language.

  • A contract instance is a deployed contract corresponding to some class. Notice that only contract instances behave as contracts in that they have their own storage and can be called by transactions or other contracts.

A contract class does not necessarily have a deployed instance in StarkNet.

Parameters

  1. CLASS_HASH - The hash of the requested contract class

Returns

The contract class, if found.

Last updated