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
Crear una cuenta en Quicknode
Regístrate aquí si aún no lo has hecho.
Ve a tu panel de control
Abre el panel de control de Endpoints desde el menú de la barra lateral izquierda para gestionar todos tus puntos de conexión de la cadena de bloques
Crear un nuevo punto final
Click Create an Endpoint in the top-right corner, select Sui as your blockchain, then select your preferred network
Copia las URL de tus proveedores
Ten a mano la URL HTTP. La vas a utilizar en las solicitudes que vas a realizar a continuación.
Si quieres ver una explicación detallada del panel de control de Quicknode, echa un vistazo a nuestra guía
Envía tu primera solicitud
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
Comprobar la instalación de cURL
La mayoría de los sistemas basados en *nix son compatibles con cURL de serie. Abre el terminal y comprueba la versión de cURL ejecutando el siguiente comando:
curl --versión
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}'
Ejemplo de respuesta
{
"jsonrpc": "2.0",
"id": 1,
"result": "35834a8a"
}
Configura tu proyecto
Create a directory and initialize a Node.js project:
mkdir sui-js-quickstart
cd sui-js-quickstart
npm init -y
Create 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 your script:
nodo app.js
Configura tu proyecto
Crea un nuevo directorio para tu proyecto de Python:
mkdir sui-python-quickstart
cd sui-python-quickstart
Crear y activar un entorno virtual
Crear un entorno virtual para gestionar las dependencias:
python3 -m venv venv
source venv/bin/activate
Solicitudes de instalación
Instala la biblioteca «requests» para realizar solicitudes HTTP:
pip instalar requests
Crea un script en Python (app.py)
Crea un archivo de Python con el siguiente código:
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"))
Ejecuta el script
Ejecuta tu script de Python:
python app.py
Si quieres seguir aprendiendo a realizar solicitudes a la API, echa un vistazo a nuestras guías y aplicaciones de ejemplo.
¡Nos encanta recibir comentarios!
Si tienes algún comentario o pregunta sobre esta documentación, háznoslo saber. ¡Nos encantaría saber tu opinión!