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. |
500 | Internal 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
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 header 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. |
2.3 Request Cost Error Codes
Code | Return Message | Description |
---|---|---|
-2041 | Exceed request cost limit | Request cost exceeds the request cost limit. |
-2043 | Exceed rate limit | Request rate exceeds maximum allowed rate limit. |
2.4 Others
Code | Return Message | Description |
---|---|---|
-2101 | Server Error | Internal server error. |
-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 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
Code | Possible Returen 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, 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 success with value null ) |
101 | Requires ether | Should be used for actions that 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. |
Updated about 1 year ago