The quickest way to start building on Aleo with Quicknode is by sending a REST API request to your endpoint. In this guide, 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 Aleo Endpoint
Quicknode 계정 만들기
아직 가입하지 않으셨다면 여기에서 가입해 주세요.
대시보드로 이동하세요
왼쪽 사이드바 메뉴에서 ‘엔드포인트’ 대시보드를 열어 모든 블록체인 엔드포인트를 관리하세요
새 엔드포인트 생성
Click Create an Endpoint in the top-right corner, select Aleo 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 Aleo blockchain. We'll use the /block/height/latest endpoint, which returns the latest block height. 원하는 언어 또는 SDK를 선택한 후, 아래 단계를 따라 첫 번째 요청을 보내보세요..
- cURL
- Node.js
파이썬
- 루비
cURL 설치 상태 확인
대부분의 *nix 기반 시스템은 기본적으로 cURL을 지원합니다. 터미널을 열고 아래 명령어를 실행하여 cURL 버전을 확인하세요:
curl --version
Send a REST API request
In your terminal, copy and paste the following cURL command to retrieve the latest block height:
curl -X GET YOUR_QUICKNODE_ENDPOINT_URL/v2/mainnet/block/height/latest \
-H 'Accept: application/json'
답변 예시
17473599
프로젝트 설정하기
먼저, `node --version` 명령어를 실행하여 Node.js가 설치되어 있는지 확인하세요. 설치되어 있지 않다면 https://nodejs.org에서 다운로드하세요. 그런 다음 새 디렉터리를 생성하고 Node.js 프로젝트를 초기화하세요:
mkdir aleo-api-quickstart
cd aleo-api-quickstart
npm init -y
메인 파일 만들기
코드를 담을 index.js 파일을 생성하세요:
touch index.js
이 코드를 index.js 파일에 추가하세요
Copy and paste this code into your index.js file to get the latest block height:
const https = require('https');
const options = {
hostname: '{your-endpoint-name}.quiknode.pro',
path: '/{your-token}/v2/mainnet/block/height/latest',
method: 'GET',
headers: {
'Accept': 'application/json'
}
};
const req = https.request(options, (res) => {
let result = '';
res.on('data', (chunk) => {
result += chunk;
});
res.on('end', () => {
console.log('Latest block height:', result);
});
});
req.on('error', (error) => {
console.error('Error:', error);
});
req.end();
Run your code
Save the file and run it in your terminal:
node index.js
Check Python installation
Verify Python is installed on your system. Open your terminal and run:
python --version
Install required packages
Install the requests library if you haven't already:
pip 설치 requests
Create your Python script
Create a new Python file and add the following code to get the latest block height:
import requests
url = "YOUR_QUICKNODE_ENDPOINT_URL/v2/mainnet/block/height/latest"
headers = {
'Accept': 'application/json'
}
response = requests.request("GET", url, headers=headers)
print("Latest block height:", response.text)
Run your script
Save the file as aleo_block_height.py and run it:
python aleo_block_height.py
Ruby 설치 상태 확인
Verify Ruby is installed on your system. Open your terminal and run:
ruby --version
Create your Ruby script
Create a new Ruby file and add the following code to get the latest block height:
require 'net/http'
require 'json'
uri = URI('YOUR_QUICKNODE_ENDPOINT_URL/v2/mainnet/block/height/latest')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Accept'] = 'application/json'
response = http.request(request)
puts "Latest block height: #{response.body}"
Run your script
Save the file as aleo_block_height.rb and run it:
ruby aleo_block_height.rb
API 요청 방법에 대해 더 자세히 알아보고 싶으시다면, 당사의 가이드와 샘플 앱을 확인해 보세요.
여러분의 피드백을 ❤️ 환영합니다!
이 문서에 대한 의견이나 질문이 있으시면 언제든지 알려주세요. 여러분의 의견을 기다리고 있습니다!