This document describes the cross-chain bridge feature added as part of Issue #152: Implement Cross-Chain Compatibility.
The platform previously supported only the Stellar network for DID operations.
This update adds a bridge layer that allows DIDs and Verifiable Credentials anchored on Stellar to be mirrored on Ethereum and any EVM-compatible chain (Polygon, BSC, Sepolia testnet, etc.).
Stellar Network EVM Network (Ethereum, Polygon, etc.)
────────────────────── ────────────────────────────────────────
DIDContract.js (Stellar) ───► EthereumDIDRegistry.sol (EVM contract)
▲
CrossChainService.js (backend bridge service)
│
/api/v1/bridge/* (REST API endpoints)
| File | Description |
|---|---|
contracts/ethereum/EthereumDIDRegistry.sol |
Solidity contract deployed on EVM chains |
backend/src/services/crossChainService.js |
Bridge service using ethers.js |
backend/src/routes/bridge.js |
REST API endpoints for bridging |
backend/src/__tests__/bridge.test.js |
Route-level tests |
backend/src/__tests__/crossChainService.test.js |
Service unit tests |
Add the following to your .env (see .env.example):
EVM_RPC_URL=https://rpc2.sepolia.org
EVM_PRIVATE_KEY=0xYOUR_PRIVATE_KEY_HERE
EVM_DID_REGISTRY_ADDRESS=0xYOUR_CONTRACT_ADDRESS_HERE
EVM_CHAIN_ID=11155111POST /api/v1/bridge/did
Authorization: Bearer <JWT>
Content-Type: application/json
{
"did": "did:stellar:GABC123...",
"ownerAddress": "0xYourEthereumAddress"
}
Response:
{
"success": true,
"message": "DID bridged successfully",
"transactionHash": "0x..."
}POST /api/v1/bridge/credential
Authorization: Bearer <JWT>
Content-Type: application/json
{
"credentialId": "cred-001",
"dataHash": "0xSHA256HashOfCredential"
}
Response:
{
"success": true,
"message": "Credential bridged successfully",
"transactionHash": "0x..."
}GET /api/v1/bridge/status/:did
Authorization: Bearer <JWT>
Response:
{
"success": true,
"status": {
"did": "did:stellar:GABC123...",
"stellar": true,
"ethereum": true,
"synced": true
}
}- Install Hardhat or Foundry in a local toolchain.
- Deploy
contracts/ethereum/EthereumDIDRegistry.solto your target EVM network. - Grant
ADMIN_ROLEto the bridge wallet (EVM_PRIVATE_KEY). - Set
EVM_DID_REGISTRY_ADDRESSin your.envto the deployed contract address.
| Network | Chain ID | RPC |
|---|---|---|
| Ethereum Mainnet | 1 | https://mainnet.infura.io/v3/<KEY> |
| Sepolia Testnet | 11155111 | https://rpc2.sepolia.org |
| Polygon Mainnet | 137 | https://polygon-rpc.com |
| Polygon Mumbai | 80001 | https://rpc-mumbai.maticvigil.com |