STRK (Starknet)

starknet_specVersion

Returns the version of the Starknet JSON-RPC specification being used

Example body:

curl --location 'https://starknet.nownodes.io' \
--header 'Content-Type: application/json' \
--header 'api-key: "API_KEY"' \
--data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "starknet_specVersion",
  "params": []
}'

Example response:

{
    "jsonrpc": "2.0",
    "result": "0.7.1",
    "id": 1
}

starknet_getBlockWithTxHashes

Get block information with transaction hashes given the block id

Example body:

curl --location 'https://starknet.nownodes.io' \
--header 'Content-Type: application/json' \
--header 'api-key: "API_KEY"' \
--data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "starknet_getBlockWithTxHashes",
  "params": [{"block_hash":"0x01da266b45a8950153584dd333778d450220164627318624dfd7b933176e4457"}]
}'

Example response:

{
    "jsonrpc": "2.0",
    "result": {
        "status": "ACCEPTED_ON_L2",
        "block_hash": "0x1da266b45a8950153584dd333778d450220164627318624dfd7b933176e4457",
        "parent_hash": "0x25924599f0f11617302f66604eb314ab2edc45221e199cfff2606c609ed004f",
        "block_number": 638358,
        "new_root": "0x4cba2e296652489fdad9afa6a21baed41cbf7a49b83cd9084606d3b0cd93eae",
        "timestamp": 1714988247,
        "sequencer_address": "0x1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8",
        "l1_gas_price": {
            "price_in_fri": "0x12ea537e9448",
            "price_in_wei": "0x21f956748"
        }
...

starknet_getBlockWithTxs

Get block information with full transactions given the block id

Example body:

curl --location 'https://starknet.nownodes.io' \
--header 'Content-Type: application/json' \
--header 'api-key: "API_KEY"' \
--data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "starknet_getBlockWithTxs",
  "params": [{"block_hash":"0x01da266b45a8950153584dd333778d450220164627318624dfd7b933176e4457"}]
}'

Example response:

{
    "jsonrpc": "2.0",
    "result": {
        "status": "ACCEPTED_ON_L2",
        "block_hash": "0x1da266b45a8950153584dd333778d450220164627318624dfd7b933176e4457",
        "parent_hash": "0x25924599f0f11617302f66604eb314ab2edc45221e199cfff2606c609ed004f",
        "block_number": 638358,
        "new_root": "0x4cba2e296652489fdad9afa6a21baed41cbf7a49b83cd9084606d3b0cd93eae",
        "timestamp": 1714988247,
        "sequencer_address": "0x1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8",
        "l1_gas_price": {
            "price_in_fri": "0x12ea537e9448",
            "price_in_wei": "0x21f956748"
        }
...

starknet_getStateUpdate

Get the information about the result of executing the requested block

Example body:

curl --location 'https://starknet.nownodes.io' \
--header 'Content-Type: application/json' \
--header 'api-key: "API_KEY"' \
--data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "starknet_getStateUpdate",
  "params": [{"block_hash":"0x01da266b45a8950153584dd333778d450220164627318624dfd7b933176e4457"}]
}'

Example response:


    "jsonrpc": "2.0",
    "result": {
        "block_hash": "0x1da266b45a8950153584dd333778d450220164627318624dfd7b933176e4457",
        "new_root": "0x4cba2e296652489fdad9afa6a21baed41cbf7a49b83cd9084606d3b0cd93eae",
        "old_root": "0x13dd2450f1e8af823a135dba7b939b8e3d1b078da16f297e6d01e062461c171",
        "state_diff": {
            "storage_diffs": [
                {
                    "address": "0x67a34ff63ec38d0ccb2817c6d3f01e8b0c4792c77845feb43571092dcf5ebb5",
                    "storage_entries": [
                        {
                            "key": "0x110e2f729c9c2b988559994a3daccd838cf52faf88e18101373e67dd061455a",
                            "value": "0x525cbad6184a9a4fd1c6c"
                        },
...

starknet_getStorageAt

Get the value of the storage at the given address and key

Example body:

curl --location 'https://starknet.nownodes.io' \
--header 'Content-Type: application/json' \
--header 'api-key: "API_KEY"' \
--data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "starknet_getStorageAt",
  "params": [{"contract_address":"0x03060CD462eD305Aec2f8b8A5B9102bE79b0A1Cc18031A03c18c4c76FB9EFa0a"}]
}'

Example response:

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32602,
        "message": "Invalid Params",
        "data": "missing/unexpected params in list"
    },
    "id": 1
}

starknet_getTransactionStatus

Gets the transaction status (possibly reflecting that the tx is still in the mempool, or dropped from it)

Example body:

curl --location 'https://starknet.nownodes.io' \
--header 'Content-Type: application/json' \
--header 'api-key: "API_KEY"' \
--data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "starknet_getTransactionStatus",
  "params": {"transaction_hash":"0x3c6447dd7c65f38589b6b791dfe18cee3aca2a89d9eedb8b60632be622ea99d"}
}'

Example response:

{
    "jsonrpc": "2.0",
    "result": {
        "finality_status": "ACCEPTED_ON_L2",
        "execution_status": "SUCCEEDED"
    },
    "id": 1
}

starknet_getTransactionByHash

Gets the transaction status (possibly reflecting that the tx is still in the mempool, or dropped from it)

Example body:

curl --location 'https://starknet.nownodes.io' \
--header 'Content-Type: application/json' \
--header 'api-key: "API_KEY"' \
--data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "starknet_getTransactionByHash",
  "params": {"transaction_hash":"0x3c6447dd7c65f38589b6b791dfe18cee3aca2a89d9eedb8b60632be622ea99d"}
}'

Example response:

{
    "jsonrpc": "2.0",
    "result": {
        "transaction_hash": "0x3c6447dd7c65f38589b6b791dfe18cee3aca2a89d9eedb8b60632be622ea99d",
        "type": "INVOKE",
        "version": "0x1",
        "nonce": "0x599",
        "max_fee": "0x2023b3cbaaef",
        "sender_address": "0x5758b6124c7df831483d3c1c7a2bd96367bf51e751d4ccdd0a326871e878f23",
        "signature": [
            "0x117954dc14d529b116087296d75ff5a27e7a783b6296d375ace69425824c8d",
            "0x3cf8be2808cd9f0d731dc8d59c3862ab08df527cc817fd9b6a3fca6301b157d"
        ],
        "calldata": [
            "0x1",
            "0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
            "0x83afd3f4caedc6eebf44246fe54e38c95e3179a5ec9ea81740eca5b482d12e",
            "0x3",
            "0xadb6045ff59ce470f3f535dc43ad4f9bf2aff4cabb02bd322ced69ea3ddf2d",
            "0x2540be400",
            "0x0"
        ]
    },
    "id": 1
}

starknet_getTransactionReceipt

Get the transaction receipt by the transaction hash

Example body:

curl --location 'https://starknet.nownodes.io' \
--header 'Content-Type: application/json' \
--header 'api-key: "API_KEY"' \
--data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "starknet_getTransactionReceipt",
  "params": {"transaction_hash":"0x3c6447dd7c65f38589b6b791dfe18cee3aca2a89d9eedb8b60632be622ea99d"}
}'

Example response:

{
    "jsonrpc": "2.0",
    "result": {
        "type": "INVOKE",
        "transaction_hash": "0x3c6447dd7c65f38589b6b791dfe18cee3aca2a89d9eedb8b60632be622ea99d",
        "actual_fee": {
            "amount": "0x3158314f8e",
            "unit": "WEI"
        },
        "execution_status": "SUCCEEDED",
        "finality_status": "ACCEPTED_ON_L2",
        "block_hash": "0x7a38fd74f65b4ba8233d3d7a025b19f081867b3cf47c8594ccdcd0209322f9d",
        "block_number": 638361,
        "messages_sent": [],
        "events": [
            {
                "from_address": "0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
                "keys": [
                    "0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9"
                ],
                "data": [
                    "0x5758b6124c7df831483d3c1c7a2bd96367bf51e751d4ccdd0a326871e878f23",
                    "0xadb6045ff59ce470f3f535dc43ad4f9bf2aff4cabb02bd322ced69ea3ddf2d",
                    "0x2540be400",
                    "0x0"
                ]
            },
            {
                "from_address": "0x5758b6124c7df831483d3c1c7a2bd96367bf51e751d4ccdd0a326871e878f23",
                "keys": [
                    "0x1dcde06aabdbca2f80aa51392b345d7549d7757aa855f7e37f5d335ac8243b1",
                    "0x3c6447dd7c65f38589b6b791dfe18cee3aca2a89d9eedb8b60632be622ea99d"
                ],
                "data": [
                    "0x1",
                    "0x1",
                    "0x1"
                ]
            },
            {
                "from_address": "0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
                "keys": [
                    "0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9"
                ],
                "data": [
                    "0x5758b6124c7df831483d3c1c7a2bd96367bf51e751d4ccdd0a326871e878f23",
                    "0x1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8",
                    "0x3158314f8e",
                    "0x0"
                ]
            }
        ],
        "execution_resources": {
            "steps": 9072,
            "pedersen_builtin_applications": 25,
            "range_check_builtin_applications": 186,
            "ec_op_builtin_applications": 3,
            "data_availability": {
                "l1_gas": 0,
                "l1_data_gas": 192
            }
        }
    },
    "id": 1
}

starknet_getClass

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

Example body:

curl --location 'https://starknet.nownodes.io' \
--header 'Content-Type: application/json' \
--header 'api-key: "API_KEY"' \
--data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "starknet_getClass",
  "params": {"block_id":"0x3c6447dd7c65f38589b6b791dfe18cee3aca2a89d9eedb8b60632be622ea99d"}
}'

Example response:

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32602,
        "message": "Invalid Params",
        "data": "json: cannot unmarshal string into Go value of type map[string]json.RawMessage"
    },
    "id": 1
}

starknet_getClassHashAt

Get the contract class hash in the given block for the contract deployed at the given address

Example body:

curl --location 'https://starknet.nownodes.io' \
--header 'Content-Type: application/json' \
--header 'api-key: "API_KEY"' \
--data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "starknet_getClassHashAt",
  "params": {"block_id":"0x3c6447dd7c65f38589b6b791dfe18cee3aca2a89d9eedb8b60632be622ea99d"}
}'

Example response:

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32602,
        "message": "Invalid Params",
        "data": "json: cannot unmarshal string into Go value of type map[string]json.RawMessage"
    },
    "id": 1
}

starknet_getClassAt

Get the contract class definition in the given block at the given address

Example body:

curl --location 'https://starknet.nownodes.io' \
--header 'Content-Type: application/json' \
--header 'api-key: "API_KEY"' \
--data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "starknet_getClassAt",
  "params": {"block_id":"0x3c6447dd7c65f38589b6b791dfe18cee3aca2a89d9eedb8b60632be622ea99d"}
}'

Example response:

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32602,
        "message": "Invalid Params",
        "data": "json: cannot unmarshal string into Go value of type map[string]json.RawMessage"
    },
    "id": 1
}

starknet_getBlockTransactionCount

Get the number of transactions in a block given a block id"

Example body:

curl --location 'https://starknet.nownodes.io' \
--header 'Content-Type: application/json' \
--header 'api-key: "API_KEY"' \
--data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "starknet_getBlockTransactionCount",
  "params": {"block_id":"0x3c6447dd7c65f38589b6b791dfe18cee3aca2a89d9eedb8b60632be622ea99d"}
}'

Example response:

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32602,
        "message": "Invalid Params",
        "data": "json: cannot unmarshal string into Go value of type map[string]json.RawMessage"
    },
    "id": 1
}

starknet_call

call a starknet function without creating a StarkNet transaction

curl --location 'https://starknet.nownodes.io' \
--header 'Content-Type: application/json' \
--header 'api-key: "API_KEY"' \
--data '{{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "starknet_call",
  "params": {"request":"12313","block_id":"0x2"}
}'

Example response:

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32602,
        "message": "Invalid Params",
        "data": "json: cannot unmarshal string into Go value of type rpc.FunctionCall"
    },
    "id": 1
}

starknet_estimateFee

estimate the fee for of StarkNet transactions

curl --location 'https://starknet.nownodes.io' \
--header 'Content-Type: application/json' \
--header 'api-key: "API_KEY"' \
--data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "starknet_estimateFee",
  "params": {"request":"0x6c75406d4f6a5e11f8094450915d027519c03aaa1adfe8aa20fb19e773442d3"}
}'

Example response:

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32602,
        "message": "Invalid Params",
        "data": "json: cannot unmarshal string into Go value of type []rpc.BroadcastedTransaction"
    },
    "id": 1
}

starknet_blockNumber

Get the most recent accepted block number

curl --location 'https://starknet.nownodes.io' \
--header 'Content-Type: application/json' \
--header 'api-key: "API_KEY"' \
--data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "starknet_blockNumber",
  "params": []
}'

Example response:

{
    "jsonrpc": "2.0",
    "result": 638367,
    "id": 1
}

starknet_blockHashAndNumber

Get the most recent accepted block hash and number

curl --location 'https://starknet.nownodes.io' \
--header 'Content-Type: application/json' \
--header 'api-key: "API_KEY"' \
--data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "starknet_blockHashAndNumber",
  "params": []
}'

Example response:

{
    "jsonrpc": "2.0",
    "result": {
        "block_hash": "0x66cf8f51071d535d39c705106e41c38be907963e4ce00f541c8a7470c9ed472",
        "block_number": 638367
    },
    "id": 1
}

starknet_syncing

Returns an object about the sync status, or false if the node is not synching

curl --location 'https://starknet.nownodes.io' \
--header 'Content-Type: application/json' \
--header 'api-key: "API_KEY"' \
--data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "starknet_syncing",
  "params": []
}'

Example response:

{
    "jsonrpc": "2.0",
    "result": false,
    "id": 1
}

starknet_chainId

Return the currently configured StarkNet chain id

curl --location 'https://starknet.nownodes.io' \
--header 'Content-Type: application/json' \
--header 'api-key: "API_KEY"' \
--data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "starknet_chainId",
  "params": []
}'

Example response:

{
    "jsonrpc": "2.0",
    "result": "0x534e5f4d41494e",
    "id": 1
}

starknet_getEvents

Returns all events matching the given filter

curl --location 'https://starknet.nownodes.io' \
--header 'Content-Type: application/json' \
--header 'api-key: "API_KEY"' \
--data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "starknet_getEvents",
  "params": {"filter":""}
}'

Example response:

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32602,
        "message": "Invalid Params",
        "data": "json: cannot unmarshal string into Go value of type rpc.EventsArg"
    },
    "id": 1
}

starknet_getNonce

Get the nonce associated with the given address in the given block

curl --location 'https://starknet.nownodes.io' \
--header 'Content-Type: application/json' \
--header 'api-key: "API_KEY"' \
--data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "starknet_getNonce",
  "params": {"block_id":"12313"}
}'

Example response:

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32602,
        "message": "Invalid Params",
        "data": "json: cannot unmarshal string into Go value of type map[string]json.RawMessage"
    },
    "id": 1
}

Last updated