starknet_getClassAt
curl --request POST \
--url https://starknet-mainnet.core.chainstack.com/mt_c524ad9781ae5dccd9ac6f5b0370e \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "starknet_getClassAt",
"params": [
{
"block_number": 385940
},
"0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82"
]
}
'import requests
url = "https://starknet-mainnet.core.chainstack.com/mt_c524ad9781ae5dccd9ac6f5b0370e"
payload = {
"id": 1,
"jsonrpc": "2.0",
"method": "starknet_getClassAt",
"params": [{ "block_number": 385940 }, "0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82"]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
id: 1,
jsonrpc: '2.0',
method: 'starknet_getClassAt',
params: [
{block_number: 385940},
'0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82'
]
})
};
fetch('https://starknet-mainnet.core.chainstack.com/mt_c524ad9781ae5dccd9ac6f5b0370e', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://starknet-mainnet.core.chainstack.com/mt_c524ad9781ae5dccd9ac6f5b0370e",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => 1,
'jsonrpc' => '2.0',
'method' => 'starknet_getClassAt',
'params' => [
[
'block_number' => 385940
],
'0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://starknet-mainnet.core.chainstack.com/mt_c524ad9781ae5dccd9ac6f5b0370e"
payload := strings.NewReader("{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"starknet_getClassAt\",\n \"params\": [\n {\n \"block_number\": 385940\n },\n \"0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://starknet-mainnet.core.chainstack.com/mt_c524ad9781ae5dccd9ac6f5b0370e")
.header("Content-Type", "application/json")
.body("{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"starknet_getClassAt\",\n \"params\": [\n {\n \"block_number\": 385940\n },\n \"0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://starknet-mainnet.core.chainstack.com/mt_c524ad9781ae5dccd9ac6f5b0370e")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"starknet_getClassAt\",\n \"params\": [\n {\n \"block_number\": 385940\n },\n \"0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82\"\n ]\n}"
response = http.request(request)
puts response.read_bodyStarknet node API
starknet_getClassAt | Starknet
Starknet API method that returns the class of a contract at a given address. It provides the class of a contract at a specific address.
POST
/
mt_c524ad9781ae5dccd9ac6f5b0370e
starknet_getClassAt
curl --request POST \
--url https://starknet-mainnet.core.chainstack.com/mt_c524ad9781ae5dccd9ac6f5b0370e \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "starknet_getClassAt",
"params": [
{
"block_number": 385940
},
"0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82"
]
}
'import requests
url = "https://starknet-mainnet.core.chainstack.com/mt_c524ad9781ae5dccd9ac6f5b0370e"
payload = {
"id": 1,
"jsonrpc": "2.0",
"method": "starknet_getClassAt",
"params": [{ "block_number": 385940 }, "0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82"]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
id: 1,
jsonrpc: '2.0',
method: 'starknet_getClassAt',
params: [
{block_number: 385940},
'0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82'
]
})
};
fetch('https://starknet-mainnet.core.chainstack.com/mt_c524ad9781ae5dccd9ac6f5b0370e', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://starknet-mainnet.core.chainstack.com/mt_c524ad9781ae5dccd9ac6f5b0370e",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => 1,
'jsonrpc' => '2.0',
'method' => 'starknet_getClassAt',
'params' => [
[
'block_number' => 385940
],
'0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://starknet-mainnet.core.chainstack.com/mt_c524ad9781ae5dccd9ac6f5b0370e"
payload := strings.NewReader("{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"starknet_getClassAt\",\n \"params\": [\n {\n \"block_number\": 385940\n },\n \"0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://starknet-mainnet.core.chainstack.com/mt_c524ad9781ae5dccd9ac6f5b0370e")
.header("Content-Type", "application/json")
.body("{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"starknet_getClassAt\",\n \"params\": [\n {\n \"block_number\": 385940\n },\n \"0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://starknet-mainnet.core.chainstack.com/mt_c524ad9781ae5dccd9ac6f5b0370e")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"starknet_getClassAt\",\n \"params\": [\n {\n \"block_number\": 385940\n },\n \"0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82\"\n ]\n}"
response = http.request(request)
puts response.read_bodyStarknet OpenRPC specFor the latest version of the publicly maintained OpenRPC spec, see the Starknet specs GitHub repo.
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
address— the string of the address of the contract.
Response
class— the class of the contract at the given address.
Use case
A practical use case forstarknet_getClassAt is to retrieve the class of a specific contract. For example, a wallet may use this method to display the class of a contract to a user, or a client may use it to verify the class of a contract before interacting with it.Last modified on November 9, 2026
Was this page helpful?