Help Center/
Web3 Node Engine Service/
Developer Guide/
Ethereum Node Engine/
Application Development/
Using Ethers.js to Send JSON-RPC API Requests
Updated on 2023-08-04 GMT+08:00
Using Ethers.js to Send JSON-RPC API Requests
Request example:
const ethers = require('ethers'); const url = 'https://your-http-endpoint/your-credential' const provider = new ethers.providers.JsonRpcProvider(url) provider.getBlockNumber((error, blockNumber) => { if(!error) { console.log(blockNumber); } else { console.log(error); } });
Response example:
{ "jsonrpc": "2.0", "id": 1, "result": "00f3c34b" }
Parent topic: Application Development
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot