The quickest way to start building on Sui with Quicknode is by sending a JSON-RPC or REST/gRPC request to your endpoint. In this quickstart, you’ll create an endpoint, copy its provider URL, and make your first request. Code samples below use cURL and common languages.
Get Your Sui Endpoint
Criar uma Quicknode
Inscreve-te aqui, se ainda não o fizeste.
Aceda ao seu painel de controlo
Open the Endpoints dashboard from the left sidebar menu to manage all your blockchain endpoints
Criar um novo endpoint
Click Create an Endpoint in the top-right corner, select Sui as your blockchain, then select your preferred network
Copie os URLs do seu fornecedor
Tenha a URL HTTP à mão. Vai precisar dela nas solicitações que se seguem.
Para um guia detalhado do Quicknode do Quicknode , consulte o nosso guia
Envie o seu primeiro pedido
Your endpoint is ready. Now, let's make your first call to the Sui blockchain. We’ll use the sui_getChainIdentifier method, which returns the chain identifier string. Select your preferred language or tool and follow the steps to send your request.
- cURL
- Node.js
Python
Verificar a instalação do cURL
Most *nix based systems have cURL support out of the box. Open your terminal and check the cURL version by running the command below:
curl --versão
Get Sui chain identifier
Send a JSON-RPC request to retrieve the Sui chain identifier:
curl -X POST YOUR_QUICKNODE_ENDPOINT_URL/ \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"sui_getChainIdentifier","params":[],"id":1}'
Sample Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "35834a8a"
}
Configure o seu projeto
Crie um diretório e inicialize um projeto Node.js:
mkdir sui-js-quickstart
cd sui-js-quickstart
npm init -y
Criar o ficheiro app.js
Use native fetch (Node.js 18+):
const url = 'YOUR_QUICKNODE_ENDPOINT_URL/';
const payload = {
jsonrpc: '2.0',
method: 'sui_getChainIdentifier',
params: [],
id: 1,
};
async function main() {
const res = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
});
const data = await res.json();
console.log('Chain Identifier:', data.result);
}
main().catch(console.error);
Correr
Execute o seu script:
node app.js
Configure o seu projeto
Crie um novo diretório para o seu projeto em Python:
mkdir sui-python-quickstart
cd sui-python-quickstart
Criar e ativar um ambiente virtual
Criar um ambiente virtual para gerir dependências:
python3 -m venv venv
source venv/bin/activate
Pedidos de instalação
Instale a biblioteca `requests` para efetuar pedidos HTTP:
pip instalar requests
Crie um script em Python (app.py)
Create a Python file with the following code:
import requests
import json
endpoint_url = "YOUR_QUICKNODE_ENDPOINT_URL/"
payload = {
"jsonrpc": "2.0",
"id": 1,
"method": "sui_getChainIdentifier",
"params": []
}
response = requests.post(endpoint_url, json=payload)
result = response.json()
print("Chain Identifier:", result.get("result"))
Executar o script
Execute your Python script:
python app.py
If you want to continue learning about making API requests, check out our guides and sample apps.