⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

starknet_getClass

Get the contract class definition in the given block associated with the given hash

Parameters

ParameterTypeDescription
block_idstringBlock reference ("latest", "l1_accepted", block hash, or block number)
class_hashfelt252Class hash

Request

{
"jsonrpc": "2.0",
"method": "starknet_getClass",
"params": [
{
"block_hash": "0x05abbad1e5"
},
"0x05abbad1e5"
],
"id": 1
}

Returns

The contract class, if found

Contract class definition with Sierra program, entry points, and ABI

Errors

CodeMessage
24Block not found
28Class hash not found

Examples

curl -X POST https://api-starknet-mainnet.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "starknet_getClass",
"params": [
{
"block_hash": "0x05abbad1e5"
},
"0x05abbad1e5"
],
"id": 1
}'