Skip to main content
EID

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

NetworkRPC URLChain ID
Mainnethttps://api.elastos.io/eid22
Testnethttps://api-testnet.elastos.io/eid23

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

FieldDescription
method"resolvedid"
paramsObject with did (string: full DID or method-specific identifier) and all (boolean: false = latest state only, true = full history)
idRequest identifier (string)

Wrap the body in a standard JSON-RPC 2.0 envelope with jsonrpc: "2.0".

Response result object

FieldDescription
didThe target DID
statusInteger status code (see table below)
transactionArray of objects: each has txid, timestamp (RFC3339 UTC), and operation (structure with header, payload, and proof)

Status codes

StatusMeaning
0DID document is valid
1DID document is expired
2DID document is deactivated
3DID 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

FieldDescription
method"query"
paramsObject with optional filters (see below)
idRequest identifier (string)

Parameters (inside params):

FieldTypeDescription
servicestring (optional)Filter by service type
credentialstring (optional)Filter by credential type
querystring (optional)MongoDB-style find filter (JSON string)
skipinteger (optional)Offset; default 0
limitinteger (optional)Maximum documents to return

Provide exactly one of service, credential, or query.

Response result object

FieldDescription
totalTotal number of matching documents
startStart position of this page
countNumber of documents in document
documentArray 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

CodeMessageMeaning
-32700Parse errorInvalid JSON received
-32600Invalid RequestNot a valid Request object
-32601Method not foundMethod unavailable
-32602Invalid paramsInvalid parameters
-32603Internal errorInternal JSON-RPC error
-32000 to -32099Server errorImplementation-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

NetworkExplorer
Mainneteid.elastos.io
Testneteid-testnet.elastos.io

Faucet

EID Testnet Faucet: https://eid-faucet.elastos.io

Resources