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
Quicknode 계정 만들기
아직 가입하지 않으셨다면 여기에서 가입해 주세요.
대시보드로 이동하세요
왼쪽 사이드바 메뉴에서 ‘엔드포인트’ 대시보드를 열어 모든 블록체인 엔드포인트를 관리하세요
새 엔드포인트 생성
Click Create an Endpoint in the top-right corner, select Solana as your blockchain, then select your preferred network
서비스 제공업체 URL을 복사하세요
HTTP URL을 잘 챙겨 두세요. 아래에서 요청을 보낼 때 이 URL을 사용하게 될 것입니다.
Quicknode 대시보드에 대한 자세한 사용 방법은 당사의 가이드를 확인해 주세요
첫 요청 보내기
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. 원하는 언어 또는 SDK를 선택한 후, 아래 단계를 따라 첫 번째 요청을 보내보세요..
- cURL
- Solana Kit (@solana/kit)
- Solana-Web3.js
Solana.py
- Solana CLI
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"}'
프로젝트 설정하기
새 디렉터리를 만들고 Node.js 프로젝트를 초기화합니다(Node.js가 이미 설치되어 있다고 가정합니다):
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
메인 파일 만들기
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);
}
})();
프로젝트 실행하기
Execute your script to see the current slot:
npx tsx index.ts
프로젝트 설정하기
새 디렉터리를 만들고 Node.js 프로젝트를 초기화합니다(Node.js가 이미 설치되어 있다고 가정합니다):
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
메인 파일 만들기
다음 코드가 포함된 index.js 파일을 만드세요:
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);
})();
프로젝트 실행하기
Execute your script to see the current slot number:
node index.js
프로젝트 설정하기
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/
API 요청 방법에 대해 더 자세히 알아보고 싶으시다면, 당사의 가이드와 샘플 앱을 확인해 보세요.
여러분의 피드백을 ❤️ 환영합니다!
이 문서에 대한 의견이나 질문이 있으시면 언제든지 알려주세요. 여러분의 의견을 기다리고 있습니다!