# Intro
The users and developers mainly interact with jsonrpc and nodes on chain. This file shows json-rpc specification and fault info.
# jsonrpc specification
CUN node support http request under json-rpc 2.0 (opens new window) standard.
A typical json-rpc request is as follows:
curl --location --request POST 'https://http-mainnet.coopuinon.net' \
--header 'Content-Type: application/json' \
--data-raw '{"jsonrpc":"2.0","id":3,"method":"web3_clientVersion","params":[]}
'
A typical correct returned value:
{
"jsonrpc": "2.0",
"id": 3,
"result": "Geth/v1.0.1-stable-d094dd75/linux-amd64/go1.13.4"
}
A typical fault returned value:
{
"jsonrpc": "2.0",
"id": 3,
"error": {
"code": -32601,
"message": "the method web3_clientVersio does not exist/is not available"
}
}
Therein “error” returned when a fault occur, with fields code
and message
.
# json-rpc is error of protocol level.
Reference: protocol file (opens new window)
code | message | meaning |
---|---|---|
-32700 | Parse error | invalid json received by server. Error occurs when resolving json text. |
-32600 | Invalid Request | json sent not valid request. |
-32601 | Method not found | method not exist or invalid |
-32602 | Invalid params | Invalid params |
-32603 | Internal error | JSON-RPC internal error |
-32000 to -32099 | Server error |
# CUN json-rpc error
Reference: docs (opens new window);
Added part based on json-rpc:
Code | Message | Meaning | Category |
---|---|---|---|
-32000 | Invalid input | fault params | non-standard |
-32001 | Resource not found | Resource not found | non-standard |
-32002 | Resource unavailable | inaccessible to defined resource | non-standard |
-32003 | Transaction rejected | create transaction failed | non-standard |
-32004 | Method not supported | unsupported method | non-standard |
-32005 | Limit exceeded | request exceed limit | non-standard |
-32006 | JSON-RPC version not supported JSON-RPC | version error | non-standard |
# web3 sdk json-rpc error
Reference: docs (opens new window)
Status code | Name | Description |
---|---|---|
4001 | User Rejected Request | User Rejected Request |
4100 | Unauthorized | Unauthorized request or account |
4200 | Unsupported Method | Unsupported Method Unsupported method by service provider |
4900 | Disconnected | Disconnected by service provider |
4901 | Chain Disconnected | Service provider not linked with corresponding chain |