EID API
Introduction
EID is an EVM-compatible sidechain dedicated to decentralized identity. It supports all standard Ethereum JSON-RPC methods (eth_*) plus two DID-specific RPC methods unique to EID: resolvedid and query.
Connection
| Network | RPC URL | Chain ID |
|---|---|---|
| Mainnet | https://api.elastos.io/eid | 22 |
| Testnet | https://api-testnet.elastos.io/eid | 23 |
Self-hosted nodes typically expose JSON-RPC on port 20646 (see your node configuration).
Standard Ethereum RPC
All standard eth_* methods work on EID, including eth_blockNumber, eth_getBalance, eth_sendRawTransaction, eth_call, eth_getTransactionReceipt, eth_getLogs, and net_version. Same as ESC but on the EID chain: use the EID RPC URL and chain IDs 22 (mainnet) / 23 (testnet).
ethers.js example
import { ethers } from "ethers";
const provider = new ethers.JsonRpcProvider("https://api.elastos.io/eid");
const network = await provider.getNetwork();
console.log("Chain ID:", network.chainId);
const blockNumber = await provider.getBlockNumber();
console.log("Current block:", blockNumber);
DID Operations via Standard Transactions
DID create, update, and deactivate operations are submitted as standard EVM transactions via eth_sendRawTransaction. No custom RPC methods are required for writes. Use the DID SDK integration guide for document construction, signing, and broadcasting.
DID Resolve (resolvedid)
resolvedid is the primary DID-specific RPC method on EID. It returns the resolved DID document state and, when requested, the transaction history that established it.
Request
| Field | Description |
|---|---|
method | "resolvedid" |
params | Object with did (string: full DID or method-specific identifier) and all (boolean: false = latest state only, true = full history) |
id | Request identifier (string) |
Wrap the body in a standard JSON-RPC 2.0 envelope with jsonrpc: "2.0".
Response result object
| Field | Description |
|---|---|
did | The target DID |
status | Integer status code (see table below) |
transaction | Array of objects: each has txid, timestamp (RFC3339 UTC), and operation (structure with header, payload, and proof) |
Status codes
| Status | Meaning |
|---|---|
| 0 | DID document is valid |
| 1 | DID document is expired |
| 2 | DID document is deactivated |
| 3 | DID does not exist |
Examples
Example DID used below: did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4.
1. Resolve valid DID (status 0)
Request:
{
"jsonrpc": "2.0",
"method": "resolvedid",
"params": {
"did": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",
"all": false
},
"id": "1"
}
Response:
{
"jsonrpc": "2.0",
"id": "1",
"result": {
"did": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",
"status": 0,
"transaction": [
{
"txid": "0x8a3f2c1d9e4b7a6051324f8e0d9c2b1a4f5e6d7c8b9a0e1f2d3c4b5a69788796",
"timestamp": "2025-11-10T14:22:31Z",
"operation": {
"header": {
"specification": "elastos/did/1.0",
"operation": "update"
},
"payload": {
"id": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",
"verificationMethod": [
{
"id": "#primary",
"type": "EcdsaSecp256r1VerificationKey2019",
"controller": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",
"publicKeyBase58": "zFqMm..."
}
]
},
"proof": {
"type": "EcdsaSecp256r1Signature2019",
"created": "2025-11-10T14:22:30Z",
"verificationMethod": "#primary",
"signature": "MEUCIQDx9K2v...truncated..."
}
}
}
]
}
}
2. Resolve expired DID (status 1)
Request:
{
"jsonrpc": "2.0",
"method": "resolvedid",
"params": {
"did": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",
"all": false
},
"id": "2"
}
Response:
{
"jsonrpc": "2.0",
"id": "2",
"result": {
"did": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",
"status": 1,
"transaction": [
{
"txid": "0xb1c2d3e4f5061728394a5b6c7d8e9f0a1b2c3d4e5f60718293a4b5c6d7e8f90a",
"timestamp": "2024-06-01T00:00:00Z",
"operation": {
"header": { "specification": "elastos/did/1.0", "operation": "update" },
"payload": { "id": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4" },
"proof": { "signature": "MEYCIQ...truncated..." }
}
}
]
}
}
3. Resolve deactivated DID (status 2)
Request:
{
"jsonrpc": "2.0",
"method": "resolvedid",
"params": {
"did": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",
"all": false
},
"id": "3"
}
Response:
{
"jsonrpc": "2.0",
"id": "3",
"result": {
"did": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",
"status": 2,
"transaction": [
{
"txid": "0xc0ffee1234567890abcdef1234567890abcdef1234567890abcdef12345678",
"timestamp": "2025-01-15T09:00:00Z",
"operation": {
"header": { "specification": "elastos/did/1.0", "operation": "deactivate" },
"payload": { "id": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4" },
"proof": { "signature": "MEUCIQD...truncated..." }
}
}
]
}
}
4. Resolve non-existent DID (status 3)
Request:
{
"jsonrpc": "2.0",
"method": "resolvedid",
"params": {
"did": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",
"all": false
},
"id": "4"
}
Response:
{
"jsonrpc": "2.0",
"id": "4",
"result": {
"did": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",
"status": 3,
"transaction": []
}
}
5. Resolve full history (all: true)
Transactions are returned in descending order (newest first).
Request:
{
"jsonrpc": "2.0",
"method": "resolvedid",
"params": {
"did": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",
"all": true
},
"id": "5"
}
Response:
{
"jsonrpc": "2.0",
"id": "5",
"result": {
"did": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",
"status": 0,
"transaction": [
{
"txid": "0xaaa111222333444555666777888999000aaabbbcccdddeeefff000111222333",
"timestamp": "2025-11-10T14:22:31Z",
"operation": {
"header": { "specification": "elastos/did/1.0", "operation": "update" },
"payload": { "id": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4" },
"proof": { "signature": "MEUCIQ...truncated..." }
}
},
{
"txid": "0xbbb222333444555666777888999000aaabbbcccdddeeefff000111222333444",
"timestamp": "2025-03-02T10:00:00Z",
"operation": {
"header": { "specification": "elastos/did/1.0", "operation": "update" },
"payload": { "id": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4" },
"proof": { "signature": "MEYCIQ...truncated..." }
}
},
{
"txid": "0xccc333444555666777888999000aaabbbcccdddeeefff000111222333444555",
"timestamp": "2024-08-20T08:15:00Z",
"operation": {
"header": { "specification": "elastos/did/1.0", "operation": "create" },
"payload": { "id": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4" },
"proof": { "signature": "MEQCIF...truncated..." }
}
}
]
}
}
DID Query (query)
The query method searches DID documents on EID. Scope: all latest non-deactivated DIDs, including those whose documents are expired.
Request
| Field | Description |
|---|---|
method | "query" |
params | Object with optional filters (see below) |
id | Request identifier (string) |
Parameters (inside params):
| Field | Type | Description |
|---|---|---|
service | string (optional) | Filter by service type |
credential | string (optional) | Filter by credential type |
query | string (optional) | MongoDB-style find filter (JSON string) |
skip | integer (optional) | Offset; default 0 |
limit | integer (optional) | Maximum documents to return |
Provide exactly one of service, credential, or query.
Response result object
| Field | Description |
|---|---|
total | Total number of matching documents |
start | Start position of this page |
count | Number of documents in document |
document | Array of DID documents |
Examples
1. Query by service type with pagination
Request:
{
"jsonrpc": "2.0",
"method": "query",
"params": {
"service": "LinkedDomains",
"skip": 0,
"limit": 10
},
"id": "10"
}
Response:
{
"jsonrpc": "2.0",
"id": "10",
"result": {
"total": 42,
"start": 0,
"count": 10,
"document": [
{
"id": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",
"service": [
{
"id": "#linked-domains",
"type": "LinkedDomains",
"serviceEndpoint": "https://example.org"
}
]
}
]
}
}
2. Query by credential type
Request:
{
"jsonrpc": "2.0",
"method": "query",
"params": {
"credential": "EmailCredential"
},
"id": "11"
}
Response:
{
"jsonrpc": "2.0",
"id": "11",
"result": {
"total": 3,
"start": 0,
"count": 3,
"document": [
{
"id": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",
"verifiableCredential": [
{
"type": ["VerifiableCredential", "EmailCredential"],
"credentialSubject": { "id": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4" }
}
]
}
]
}
}
3. Custom MongoDB query (credential with email present)
The query parameter is a JSON string using MongoDB find syntax.
Request:
{
"jsonrpc": "2.0",
"method": "query",
"params": {
// MongoDB find: verifiableCredential array has an element with email in credentialSubject
"query": "{\"verifiableCredential.credentialSubject.email\": {\"$exists\": true}}",
"skip": 0,
"limit": 5
},
"id": "12"
}
Response:
{
"jsonrpc": "2.0",
"id": "12",
"result": {
"total": 8,
"start": 0,
"count": 2,
"document": [
{
"id": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",
"verifiableCredential": [
{
"type": ["VerifiableCredential", "EmailCredential"],
"credentialSubject": {
"id": "did:elastos:iVPadJq56wSRDvtD5HKvCPNryHMk3qVSU4",
"email": "[email protected]"
}
}
]
},
{
"id": "did:elastos:iAbCdEfGhIjKlMnOpQrStUvWxYz123456789",
"verifiableCredential": [
{
"type": ["VerifiableCredential", "EmailCredential"],
"credentialSubject": {
"id": "did:elastos:iAbCdEfGhIjKlMnOpQrStUvWxYz123456789",
"email": "[email protected]"
}
}
]
}
]
}
}
4. Empty result
Request:
{
"jsonrpc": "2.0",
"method": "query",
"params": {
"service": "NonExistentServiceType"
},
"id": "13"
}
Response:
{
"jsonrpc": "2.0",
"id": "13",
"result": {
"total": 0,
"start": 0,
"count": 0,
"document": []
}
}
Error codes
| Code | Message | Meaning |
|---|---|---|
| -32700 | Parse error | Invalid JSON received |
| -32600 | Invalid Request | Not a valid Request object |
| -32601 | Method not found | Method unavailable |
| -32602 | Invalid params | Invalid parameters |
| -32603 | Internal error | Internal JSON-RPC error |
| -32000 to -32099 | Server error | Implementation-defined |
Error response example
{
"jsonrpc": "2.0",
"id": "99",
"error": {
"code": -32602,
"message": "Invalid params",
"data": "exactly one of service, credential, or query is required"
}
}
Block explorers
| Network | Explorer |
|---|---|
| Mainnet | eid.elastos.io |
| Testnet | eid-testnet.elastos.io |
Faucet
EID Testnet Faucet: https://eid-faucet.elastos.io