Skip to main content
ESC

Quick Start: Run an ESC RPC Node

This gives you a local EVM-compatible RPC endpoint for Elastos Smart Contract chain (Chain ID 20). Use this for dApp development, running your own block explorer, or reducing dependency on public RPCs.

Initialize ESC

ESC does not depend on ELA for RPC-only operation. You only need the ESC binary itself.

node.sh esc init

This downloads the ESC binary (a modified geth), creates a keystore, and saves the keystore password to ~/.config/elastos/esc.txt.

Force Light-Serve Mode

node.sh esc init creates a keystore password file at ~/.config/elastos/esc.txt. When that file exists, node.sh esc start launches ESC in mining mode, which requires ELA's keystore for PBFT consensus. Since an RPC node does not participate in consensus, remove the password file to force light-serve mode:

rm ~/.config/elastos/esc.txt

Start ESC

node.sh esc start

Without esc.txt, ESC starts in light-serve mode:

./esc --datadir data --lightserv 10 \
--rpc --rpcaddr '0.0.0.0' \
--rpcapi 'admin,eth,net,txpool,web3' \
--ws --wsaddr '0.0.0.0'

This exposes:

  • HTTP RPC on port 20636
  • WebSocket on port 20632
Why not ELA?

Full supernodes and validators run ESC in mining mode, which uses ELA's keystore for PBFT cross-chain signing. An RPC node only serves queries — it does not produce blocks or participate in cross-chain operations, so ELA is not needed.

Connect Your dApp

Configure your dApp or wallet to use:

HTTP:  http://YOUR_SERVER_IP:20636
WS: ws://YOUR_SERVER_IP:20632

Chain ID: 20

Example with ethers.js:

const provider = new ethers.JsonRpcProvider('http://YOUR_SERVER_IP:20636');
const blockNumber = await provider.getBlockNumber();

Example with Hardhat (hardhat.config.js):

module.exports = {
networks: {
esc: {
url: "http://YOUR_SERVER_IP:20636",
chainId: 20,
}
}
};
tip

For production deployments, put a reverse proxy (nginx/caddy) in front of the RPC port with rate limiting and TLS.

server {
listen 443 ssl;
server_name rpc.yourdomain.com;

ssl_certificate /etc/letsencrypt/live/rpc.yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/rpc.yourdomain.com/privkey.pem;

location / {
proxy_pass http://127.0.0.1:20636;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;

# Rate limiting
limit_req zone=rpc burst=50 nodelay;
}

location /ws {
proxy_pass http://127.0.0.1:20632;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}