curl -X POST
which is used to initiate a POST request to the specified URL, a Chainstack node in this case; CHAINSTACK_NODE_URL
.-H 'Content-Type: application/json'
specifies that the request’s content type is in JSON format.--data '{"method":"eth_blockNumber", "jsonrpc":"2.0", "params":[],"id":1}'
is the request’s payload, which contains the JSON-RPC request data.method
— defines the method that is being called, in this case, eth_blockNumber.jsonrpc
— defines the version of the JSON-RPC protocol in use; it is set to 2.0
.params
— is used to pass any additional parameters required by the method; in this case, it is empty.id
— is used to identify the request. It is set to 1
in this case, and you can use id
to identify the request the response belongs to.eth_blockNumber
will return the number of the most recent block in the chain.
Response example:
https://ethereum-mainnet.core.chainstack.com
wss://ethereum-mainnet.core.chainstack.com/ws
YOUR_USER_NAME
YOUR_PASSWORD
curl
command like so:
-u YOUR_USER_NAME:YOUR_PASSWORD
includes your username and password for basic authentication. Please replace YOUR_PASSWORD
with your actual password.