Response Error Reference

1 HTTP Status Codes

Code
Description
403
Forbidden -- Your request was rejected by your project's security settings. Learn more at API Security.
429
Too Many Requests -- You've exceeded your concurrent request rate limit or request cost limit per day. Learn more at Broken link.
500
Internal Server Error -- We're unable to process your request right now. Please contact us at <ask product team>

Example

Request
curl
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

Code
Return message
Description
-2011
Invalid project id or project secret
Invalid project id or project secret.
-2012
Invalid JWT Token
JWT Token in the request fails to pass the authentication.
-2013
JWT header missing kid field
No kid field found in the header of the JWT Token.
-2014
Invalid kid
Value of kid in the payload of JWT Token does not match any kid imported into the InfStones platform.

2.2 Allowed IP Addresses Error Codes

Code
Return message
Description
-2021
IP Address Not Allowed
IP Address Not included in the IP whitelist. Learn more at API Security.

2.3 Allowed Methods Error Codes

Code
Return message
Description
-2031
[method1, method2, ...] Not Allowed
API request methods are not included in the Method allow list of project. Learn more at API Security.

2.4 Request Cost Error Codes

Code
Return message
Description
-2041
Exceed daily request cost limit of <chain_name>
Daily request cost exceeds the request cost limit of the service plan. Learn more at Broken link.
-2042
Exceed daily request cost limit of project <project_id> in <chain_name>
Request cost exceeds defined project request cost limit. Learn more at API Security.
-2043
Exceed rate limit
Request rate exceeds maximum allowed rate limit.

2.5 Others

Code
Return message
Description
-2101
Server Error
Internal server error.
-2102
<chain_name> temporarily unavailable, contact us for details
Chain once released but now unavailable for some reason, please contact us for details.
-2103
Query returned more than 10,000 results in response
The 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

Code
Possible Return message
Description
-32700
Parse error
Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text.
-32600
Invalid Request
The JSON sent is not a valid request object.
-32601
Method not found
The method does not exist / is not available.
-32602
Invalid params
Invalid method parameter(s).
-32063
Internal error
Internal JSON-RPC error.
-32000
Server error
Reserved for implementation-defined server-errors. See hint below.
NOTE: -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
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}'
Return
{
"error": {
"code": -32601,
"message": "the method eth_blockumber does not exist/is not available"
},
"id": 0,
"jsonrpc": "2.0"
}

3.2 Custom Error Codes

Code
Possible Return message
Description
1
Unauthorized
Should be used when some action is not authorized, e.g. sending from a locked account.
2
Action not allowed
Should be used when some action is not allowed, e.g. preventing an action, while another depending action is processing on, like sending again when a confirmation popup is shown to the user.
3
Execution error
Will 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'
}]
}
Code
Possible Return message
Description
100
X doesn't exist
Should be used when something which should be there is not found. (Doesn’t apply to eth_getTransactionBy_ and eth_getBlock_. They return a success with value null)
101
Requires ether
Should be used for actions which require something else, e.g. gas or a value.
102
Gas too low
Should be used when a too low value of gas was given.
103
Rejected
Should 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).
105
Ether too low
Should be used when the value of Ether given is too low.