Developers Forum for XinFin XDC Network

Phill Menezes
Phill Menezes

Posted on

Ethereum Compatible RPC Endpoint on Apothem rejecting remote calls

Summary: Currently, tools like Truffle Suit and Hardhat don't fully support the official XDC RPC endpoints due to the xdc prefix. An issue has been raised both with Truffle and Hardhat by @gzliudan but in both cases, each team responded that making addresses with the xdc prefix compatible to their tools would imply in breaking changes and suggested working on making XDC RPC endpoints compatible to Ethereum standards.

Fortunately, XDC already provides Ethereum Compatible RPC Endpoints:

https://erpc.xinfin.network - for XDC Mainnet
https://erpc.apothem.network - for Apothem Testnet

Although the Ethereum Compatible Endpoint for XDC Mainnet (https://erpc.xinfin.network) works perfectly with Truffle and Hardhat, the Apothem Testnet endpoint is showing an unwanted behavior.

Rejected Calls on Truffle:

/home/taurinos/xdc_comm/docs/how-to/Pizza/node_modules/eth-block-tracker/src/polling.js:51
        const newErr = new Error(`PollingBlockTracker - encountered an error while attempting to update latest block:\n${err.stack}`)
                       ^
Error: PollingBlockTracker - encountered an error while attempting to update latest block:
undefined
    at PollingBlockTracker._performSync (/home/taurinos/xdc_comm/docs/how-to/Pizza/node_modules/eth-block-tracker/src/polling.js:51:24)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
UnhandledRejections detected
Promise {
  <rejected> {
    code: -32603,
    message: 'Unknown Error: ',
    data: { originalError: {} }
  }
} {
  code: -32603,
  message: 'Unknown Error: ',
  data: { originalError: {} }
}
Enter fullscreen mode Exit fullscreen mode

Same Behavior when trying to access RPC methods via HTTP:

By accessing https://erpc.apothem.network/x/eth_blockNumber, for example, it returns:

Post "http://0.0.0.0:8989": dial tcp 0.0.0.0:8989: connect: connection refused
Enter fullscreen mode Exit fullscreen mode

While, accessing https://rpc.apothem.network/x/eth_blockNumber will return:

This is an example call for eth_blockNumber.

Request
{
  "jsonrpc": "2.0",
  "id": "1",
  "method": "eth_blockNumber",
  "params": [
    "latest"
  ]
}
Response
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": "0x2530daf"
}
Enter fullscreen mode Exit fullscreen mode

Discussion (2)

Collapse
blocksscanio profile image
BlocksScan

Hello,

Indeed it was error in RPC configuration(port already in use) and we have fixed it now, I would request you to test it now.

Collapse
menezesphill profile image
Phill Menezes Author

As of Sept 20th this issue has been resolved! Thank you so much for the fast reply @blocksscanio