Help Center/
Web3 Node Engine Service/
Developer Guide/
Ethereum Node Engine/
Application Development/
Using Web3.js to Send JSON-RPC API Requests
Updated on 2023-08-04 GMT+08:00
Using Web3.js to Send JSON-RPC API Requests
Request example:
const Web3 = require('web3'); const url = 'https://your-http-endpoint/your-credential' const web3 = new Web3(new Web3.providers.HttpProvider(url)); web3.eth.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