Skip to main content
For the complete documentation index, see llms.txt

Node endpoints

Midnight 네트워크와 상호작용하려면 자체 노드를 운영하거나, 인프라 서비스 제공업체가 제공하는 public endpoint에 연결할 수 있습니다.

이 가이드는 Midnight blockchain의 public 네트워크 endpoint를 사용하는 방법을 안내합니다.

Quickstart

Preview 네트워크에 첫 요청을 보내봅니다:

curl -X POST https://rpc.preview.midnight.network/ \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"system_chain","params":[],"id":1}'

Public network endpoints

Midnight은 현재 개발 및 테스트를 위해 두 개의 활성 테스트 네트워크를 운영합니다.

코어 엔지니어링 팀이 운영하는 주요 개발 환경입니다.

ServiceURL
RPC endpointhttps://rpc.preview.midnight.network/
WebSocketwss://rpc.preview.midnight.network/
Explorerhttps://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frpc.preview.midnight.network#/explorer
Network support

Midnight은 개발 및 테스트 용도로 public endpoint를 제공합니다. 프로덕션 DApp의 경우, 안정성과 성능을 위해 자체 RPC 노드를 운영하거나 전용 인프라 제공업체를 사용하는 방안을 고려하세요.

Common RPC queries

다음 예시는 Preview 네트워크에서 체인 정보를 조회하고, 사용 가능한 RPC 메서드를 나열하며, 최신 블록을 가져오는 방법을 보여줍니다.

Query chain information

Preview 네트워크의 체인 이름을 가져오는 쿼리 예시입니다:

curl -X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "system_chain",
"params": [],
"id": 1
}' \
https://rpc.preview.midnight.network/

List available RPC methods

Preview 네트워크에서 사용 가능한 모든 RPC 메서드를 조회해 파일로 저장합니다:

curl -X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "rpc_methods",
"params": [],
"id": 1
}' \
https://rpc.preview.midnight.network/ \
| jq '.' > rpc_methods.json

Get latest block

Preview 네트워크의 최신 블록을 가져오는 쿼리 예시입니다:

curl -X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "chain_getBlock",
"params": [],
"id": 1
}' \
https://rpc.preview.midnight.network/

Insomnia API collection

Insomnia 컬렉션은 Midnight RPC endpoint와 상호작용할 수 있도록 사전 구성된 요청을 제공합니다.

1

Download

컬렉션 파일을 다운로드합니다: Midnight Node Insomnia collection

2

Import the collection

Insomnia를 실행하고 Import를 선택합니다.

File 탭을 선택한 뒤 다운로드한 파일을 선택합니다.

Scan을 클릭해 컬렉션을 가져옵니다.

info

Insomnia가 아직 없다면 공식 웹사이트에서 다운로드하세요.

3

Use the collection

워크스페이스에서 Midnight Node 컬렉션을 찾습니다.

필요하면 RPC endpoint를 변경합니다. 예를 들어 Preprod 네트워크를 사용한다면 endpoint를 https://rpc.preprod.midnight.network/로 변경합니다.

요청을 실행해 사용 가능한 메서드를 살펴봅니다.

Insomnia app screenshot

Troubleshoot

자주 발생하는 문제와 해결 방법은 다음과 같습니다.

Request fails with 405

GET이 아니라 POST를 사용하고 있는지 확인하세요.

Invalid JSON response

JSON 형식과 Content-Type 헤더를 확인하세요. 요청 본문은 유효한 JSON 객체여야 합니다.

Empty result

일부 RPC 메서드는 파라미터가 필요합니다. 사용 가능한 메서드와 필요한 파라미터의 전체 목록은 Node OpenRPC specification을 참고하세요.

Next steps