The quickest way to start building on Solana with Quicknode is by sending a JSON-RPC request to your endpoint. In this quickstart, you’ll create an endpoint, copy its provider URL, and make your first request. Code samples are available in cURL as well as popular SDKs and programming languages.
Get Your Solana 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 Solana 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 Solana blockchain. We’ll use the getSlot method, which returns the slot number. Selecciona tu idioma o SDK preferido y sigue los pasos que se indican a continuación para enviar tu primera solicitud.
- cURL
- Solana Kit (@solana/kit)
- Solana-Web3.js
Solana.py
- CLI de Solana
Get Slot
To run the cURL request, open a terminal window and paste the following code to retrieve the current slot.
curl 'YOUR_QUICKNODE_ENDPOINT_URL/' \
-X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","id":1, "method":"getSlot"}'
Configura tu proyecto
Crea un nuevo directorio e inicializa un proyecto de Node.js (se da por hecho que Node.js ya está instalado):
mkdir solana-quickstart
cd solana-quickstart
npm init -y
Install Solana Kit
Install the Solana Kit SDK for blockchain interaction:
npm install --save @solana/kit
Crea tu archivo principal
Create an index.ts file with the following code:
import { createSolanaRpc } from "@solana/kit";
(async () => {
const solanaRpc = createSolanaRpc("YOUR_QUICKNODE_ENDPOINT_URL/");
try {
const slot = await solanaRpc.getSlot().send();
console.log(slot);
} catch (error) {
console.error("Error fetching slot:", error);
}
})();
Ejecuta tu proyecto
Execute your script to see the current slot:
npx tsx index.ts
Configura tu proyecto
Crea un nuevo directorio e inicializa un proyecto de Node.js (se da por hecho que Node.js ya está instalado):
mkdir solana-quickstart
cd solana-quickstart
npm init -y
Install Solana Web3.js SDK
Install the Solana JavaScript SDK for blockchain interaction:
npm install --save @solana/web3.js
Crea tu archivo principal
Crea un archivo index.js con el siguiente código:
const web3 = require("@solana/web3.js");
(async () => {
const solana = new web3.Connection("YOUR_QUICKNODE_ENDPOINT_URL/");
const slot = await solana.getSlot();
console.log('Current slot:', slot);
})();
Ejecuta tu proyecto
Execute your script to see the current slot number:
nodo index.js
Configura tu proyecto
Create a new directory for your Solana Python project:
mkdir solana-python-quickstart
cd solana-python-quickstart
Install Solana.py (if not already installed)
Check if solana is installed with `pip list | grep solana`. If not found, install it:
pip install solana cachetools
Create and run Python script
Create an app.py file with the following code, then execute it with `python app.py` to retrieve the current slot number:
from solana.rpc.api import Client
solana_client = Client("YOUR_QUICKNODE_ENDPOINT_URL/")
slot_response = solana_client.get_slot()
print(f"Current slot: {slot_response.value}")
Get current slot
solana slot --url YOUR_QUICKNODE_ENDPOINT_URL/
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!