메인 콘텐츠로 건너뛰기

빠른 접근

기본 랜덤성 예시 보기:

GitHub

주사위 예제 저장소

VRF dApp

온체인에서 주사위 굴리기

위임형 VRF dApp

온체인에서 100ms 이내로 주사위 굴리기

로컬 머신에서 VRF를 엔드투엔드로 실행하고 싶나요? 전체 로컬 스택, Surfpool 대안, 로컬 vrf-oracle 흐름은 Local Validator Setup 가이드를 참고하세요.

단계별 가이드

모든 Solana 프로그램은 MagicBlock VRF SDK를 사용해 몇 초 안에 온체인에서 검증 가능 랜덤니스를 요청하고 사용할 수 있습니다. 이 가이드를 끝내면 검증 가능 랜덤니스로 주사위를 굴리는 동작 예제를 갖게 됩니다.
1

프로그램 작성

평소처럼 Solana 프로그램을 작성합니다.
2

랜덤니스 요청 및 소비 명령 추가.

검증된 오라클의 callback을 통해 랜덤니스를 요청하고 사용하는 CPI 훅을 추가합니다.
3

Solana에 프로그램 배포

Anchor CLI를 사용해 Solana 프로그램을 배포합니다.
4

온체인 랜덤니스용 트랜잭션 실행。

온체인에서 랜덤니스를 생성하고 사용하는 트랜잭션을 전송합니다。

주사위 굴리기 예제

Roll Dice GIF 다음 소프트웨어 패키지가 필요할 수 있으며, 다른 버전도 호환될 수 있습니다.
소프트웨어버전설치 가이드
Solana2.3.13Solana 설치
Rust1.85.0Rust 설치
Anchor0.32.1Anchor 설치
Node24.10.0Node 설치

코드 스니펫

A simple roll dice program where player initialize state account to store, request and consume randomness:
pub const PLAYER: &[u8] = b"playerd";

#[program]
pub mod random_dice {
    use super::*;

    pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
        msg!(
            "Initializing player account: {:?}",
            ctx.accounts.player.key()
        );
        Ok(())
    }

    // ... Additional instructions will be added here
}

/// Context for initializing player
#[derive(Accounts)]
pub struct Initialize<'info> {
    #[account(mut)]
    pub payer: Signer<'info>,
    #[account(init_if_needed, payer = payer, space = 8 + 1, seeds = [PLAYER, payer.key().to_bytes().as_slice()], bump)]
    pub player: Account<'info, Player>,
    pub system_program: Program<'info, System>,
}

/// Player struct
#[account]
pub struct Player {
    pub last_result: u8,
}
⬆️ Back to Top

Solana Explorer

Get insights about your transactions and accounts on Solana:

Solana 익스플로러

공식 Solana 익스플로러

Solscan

Solana 블록체인 살펴보기

Solana RPC Providers

Send transactions and requests through existing RPC providers:

Solana

Free Public Nodes

Helius

Free Shared Nodes

Triton

Dedicated High-Performance Nodes

Solana Validator Dashboard

Find real-time updates on Solana’s validator infrastructure:

Solana Beach

Get Validator Insights

Validators App

Discover Validator Metrics

Server Status Subscriptions

Subscribe to Solana’s and MagicBlock’s server status:

Solana Status

Subscribe to Solana Server Updates

MagicBlock Status

Subscribe to MagicBlock Server Status

MagicBlock Products

에페메럴 롤업(ER)

Solana에서 실시간 무수수료 트랜잭션을 안전하게 실행하세요.

프라이빗 에페메럴 롤업(PER)

프라이버시 보존 연산으로 민감한 데이터를 보호하세요.

프라이빗 결제 API

Solana에서 안전하고 규정을 준수하는 비공개 송금을 구현하세요.

검증 가능한 랜덤 함수(VRF)

증명 가능한 공정한 랜덤성을 온체인에서 직접 생성하세요.

가격 오라클

트레이딩과 DeFi를 위한 저지연 온체인 가격 피드에 접근하세요.