starknet_call

This is one of the most commonly used API calls. It is used to read from the blockchain which includes executing smart contracts but does not publish anything to the blockchain.

Parameters

  • OBJECT - The transaction call object
KeyRequiredTypeDetail
contract_address✅StringAddress the transaction is sent from.
entry_point_selector✅Array of stringSmart contract entry points
call_data✅StringHash of method signature and encoded parameters.
  • BLOCK PARAMETER
Object NameRequiredTypeDetail
BLOCK PARAMETER✅String"block_hash", "block_number", "latest"
"params": [
    {
        "contract_address": "0x049E0cCb70e1F1684F43116e9E42e60D0f64d3D254Be8D8A1143dba43dEad733",
        "calldata": [
            "0xbfc2ea1a458d7cac752a4a688dbb8e0cff399e1b"
        ],
        "entry_point_selector": "0x12ead94ae9d3f9d2bdb6b847cf255f1f398193a1f88884a0ae8e18f24a037b6"
    },
    {
        "block_hash": "0x1dd8896092bf4f28052a3301598e8ced247593ff5c95b6b48891411bfe0605"
    }
]

Result

The return value of the executed contract method.

Example

Request

curl <your-endpoint> \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{
    "method": "starknet_call",
    "params": [
        {
            "contract_address": "0x049E0cCb70e1F1684F43116e9E42e60D0f64d3D254Be8D8A1143dba43dEad733",
            "calldata": [
                "0xbfc2ea1a458d7cac752a4a688dbb8e0cff399e1b"
            ],
            "entry_point_selector": "0x12ead94ae9d3f9d2bdb6b847cf255f1f398193a1f88884a0ae8e18f24a037b6"
        },
        {
            "block_hash": "0x1dd8896092bf4f28052a3301598e8ced247593ff5c95b6b48891411bfe0605"
        }
    ],
    "id": 1,
    "jsonrpc": "2.0"
}'

Return

{
    "jsonrpc": "2.0",
    "result": [],
    "id": 1
}