Response Error Reference

1 HTTP Status Codes

CodeDescription
403Forbidden -- Your request was rejected by your project's security settings. Learn more at API Security.
429Too Many Requests -- You've exceeded your concurrent request rate limit or request cost limit per day.
500Internal Server Error -- We're unable to process your request right now.

Example

Request

curl -i https://api.infstones.io/ethereum/mainnet/randmon_project_id \
    -X POST \
    -H 'Content-Type: application/json' \
    -d '{
        "jsonrpc":"2.0",
        "method":"eth_blockNumber",
        "params":[],
        "id":0
}'

Return

HTTP/1.1 403 Forbidden
Content-Type: application/json; charset=utf-8
Date: Sun, 03 Apr 2022 16:55:37 GMT
Content-Length: 89

{
    "error":{
        "code":-2011,
        "messgae":"Invalid project id or project secret"
    },
    "jsonrpc":"2.0"
}

2 InfStones API Error Codes

2.1 Authentication Error Codes

CodeReturn MessageDescription
-2011Invalid project id or project secretInvalid project id or project secret.
-2012Invalid JWT TokenJWT Token in the request fails to pass the authentication.
-2013JWT header missing kid fieldNo kid field found in the header of the JWT Token.
-2014Invalid kidValue of kid in the header of JWT Token does not match any kid imported into the InfStones platform.

2.2 Allowed IP Addresses Error Codes

CodeReturn MessageDescription
-2021IP Address Not AllowedIP Address Not included in the IP whitelist.

2.3 Request Cost Error Codes

CodeReturn MessageDescription
-2041Exceed request cost limitRequest cost exceeds the request cost limit.
-2043Exceed rate limitRequest rate exceeds maximum allowed rate limit.

2.4 Others

CodeReturn MessageDescription
-2101Server ErrorInternal server error.
-2103Query returned more than 10,000 results in responseThe response support the maximum of 10,000 items in the result.

3 Ethereum JSON-RPC Error Codes

For JSON-RPC specific errors, InfStones returns a 200 with the JSON-RPC error in the JSON response.

3.1 JSON-RPC Error Codes

CodePossible Return MessageDescription
-32700Parse errorInvalid JSON was received by the server. An error occurred on the server while parsing the JSON text.
-32600Invalid RequestThe JSON sent is not a valid request object.
-32601Method not foundThe method does not exist/is not available.
-32602Invalid paramsInvalid method parameter(s).
-32063Internal errorInternal JSON-RPC error.
-32000Server errorReserved for implementation-defined server errors. See the note below.

πŸ“˜

-32000 is used for many server errors. Here are a few common examples:

"already known"

  • This generally means the transaction already posted and is on the node in a pending state. Sometimes this error occurs when transactions fail at first but are retried when the node already knows of them

"Unspecified origin not on whitelist"

  • This error means whoever is making the request is not on the whitelist for using your API key.

"filter not found"

  • Filters expire after 5 minutes of inactivity so if it's not found the filter likely expired.

"Request timed out. Client should retry."

  • Gateway timeouts (usually from nodes). Clients should retry the request.

"transaction underpriced"

  • Transaction was sent with too low gas. Re-send the transaction with higher gas!

Example

Request

curl https://api.infstones.io/ethereum/mainnet/your_project_id \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_blockumber","params":[],"id":0}'

Response

{
    "error": {
        "code": -32601,
        "message": "the method eth_blockumber does not exist/is not available"
    },
    "id": 0,
    "jsonrpc": "2.0"
}

3.2 Custom Error Codes

CodePossible Returen MessageDescription
1UnauthorizedShould be used when some action is not authorized, e.g. sending from a locked account.
2Action not allowedShould be used when some action is not allowed, e.g. preventing an action, while another depending action is processing, like sending again when a confirmation popup is shown to the user.
3Execution errorWill contain a subset of custom errors in the data field. See below.

Custom error 3 can contain custom error(s) to further explain what went wrong.

They will be contained in the data field of the RPC error message as follows:

{
    code: 3,
    message: 'Execution error',
    data: [{
        code: 102,
        message: 'Innsufficient gas'
    },
    {
        code: 103,
        message: 'Gas limit exceeded'
    }]
}
CodePossible Return MessageDescription
100X doesn't existShould be used when something which should be there is not found. (Doesn’t apply to eth_getTransactionBy_ and eth_getBlock_. They return success with value null)
101Requires etherShould be used for actions that require something else, e.g. gas or a value.
102Gas too lowShould be used when a too low value of gas was given.
103RejectedShould be used when an action was rejected, e.g. because of its content (too long contract code, containing wrong characters, should differ from -32602 - Invalid params).
105Ether too lowShould be used when the value of Ether given is too low.