net_version
Returns the current network ID on Moonbase Alpha.
Parameters#
This method accepts no parameters.
Request#
{
"jsonrpc": "2.0",
"method": "net_version",
"params": [],
"id": 1
}
Returns#
| Type | Description |
|---|---|
String | Network ID as a string |
Code Examples#
- cURL
- JavaScript
curl -X POST https://api-moonbase-alpha.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "net_version",
"params": [],
"id": 1
}'
import { JsonRpcProvider } from 'ethers';
const provider = new JsonRpcProvider('https://api-moonbase-alpha.n.dwellir.com/YOUR_API_KEY');
const networkId = await provider.send('net_version', []);
console.log('Network ID:', networkId);
Related Methods#
eth_chainId- Get chain ID