Node RPC Service
How to issue the API Key for accessing the Node RPC endpoint
- Go to the RPC endpoints page
- Click the Create new RPC endpoint button.
- Configure the settings for the endpoint you want to create:
- First, select a Chain from the Select a Chain dropdown.
- Next, choose the desired Network.
- Add a name for the endpoint and an optional description to describe its purpose.
- Click the Create new RPC endpoint button to finalize the setup. Your new RPC endpoint has now been successfully created!
How to test the API Endpoints
- First, Check your API Key.
The API Key can be accessed from both the RPC endpoints page and the Detail page.
Checking from the RPC endpoints page
- On the RPC endpoints page, click the API Key button to view the API Key.
Checking from the Detail Page
- From the RPC endpoints page, click the Detail button to navigate to the Detail page.
- On the Detail page, click the Your endpoint button, highlighted by the red frame in the image.
- The API Key will be displayed for confirmation.
Executing the Node RPC Endpoint with TypeScript
- As an example, execute the Soneium Minato Node RPC endpoint:
index.ts
const API_URL = "https://soneium-minato.rpc.scs.startale.com"; // If Astar or AstarZK is used, this should also be changed.
const API_KEY = "YOUR_API_KEY"; // // Replace with your Node RPC API Key.
// RPC request payload
const payload = {
id: 1,
jsonrpc: "2.0",
method: "eth_blockNumber",
};
async function getBlockNumber() {
const response = await fetch(`${API_URL}?apikey=${API_KEY}`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
console.log(`Latest block number: ${parseInt(data.result, 16)}`);
}
// Execute the function
getBlockNumber();
- Run it using Node.js.
npx tsc index.ts
node index.ts
- The console should display the latest block number.
Latest block number: 4745445
- Congratulations!
You have successfully sent your first request to the SCS Node RPC API Endpoint.
How to check the status
- On the RPC endpoints page, click the Detail button for the desired endpoint to navigate to the Detail page.
- You can view the endpoint's current status on this page.
How to find out more about the API?
Updated 15 days ago