PoCs

솔라나

EVM-vs-솔라나 비교 연구 + devnet 위 샘플 Anchor 프로그램.

아직 만들지 않았습니다

이 페이지는 카드에 적힌 내용을 펼쳐 보여줄 뿐입니다 — 돌아가는 코드도, 열어볼 데모도 아직 없습니다. 무엇을 왜 만들려는지가 아래에 있습니다.

어떻게 보나

아직 범위 미정.

기술 노트

각 항목이 실제로 무엇을 보여주고 어떻게 동작하는지 — 위 카드보다 자세한 기술 설명입니다.

솔라나준비 중

목적: 의도적으로 넣은 non-EVM 비교 대상입니다 — 여기 있는 다른 온체인 데모는 전부 이더리움 계열(Hyperliquid, Sepolia AA, PBS)이고, Solana는 실행 모델 자체가 다른 가장 큰 생태계라 EVM 개념이 그대로 통한다고 가정하지 않고 별도로 이해할 가치가 있습니다.

동작 방식: 계획: Solana devnet에 배포하는 Anchor(Rust) 프로그램 — PDA 기반 카운터로 시작해서, Solana의 계정 모델(컨트랙트 저장소가 아니라 모든 상태를 명시적으로 전달)과 cross-program invocation을 연습할 수 있는 소규모 SPL 토큰 에스크로로 이어집니다. 페이지는 Phantom/wallet-adapter로 연결하고, Anchor가 생성한 TypeScript 클라이언트로 프로그램을 호출할 예정입니다. 아직 미구현.

관련 코드:
# Solana's account model — unlike EVM contract storage, all state lives in accounts
# that are passed into every instruction explicitly. Simulates a PDA-based counter
# program: the "program" has no storage of its own, only the accounts it's handed.

import hashlib
from dataclasses import dataclass, field


@dataclass
class Account:
    pubkey: str
    owner_program: str
    data: dict = field(default_factory=dict)


def find_program_address(seeds: list, program_id: str) -> str:
    """Mimic Solana's deterministic PDA derivation (real PDAs also walk bump seeds
    off the ed25519 curve; this stdlib version just needs to be deterministic)."""
    joined = b"".join(seed.encode() for seed in seeds) + program_id.encode()
    return "PDA_" + hashlib.sha256(joined).hexdigest()[:16]


COUNTER_PROGRAM_ID = "Counter1111111111111111111111111111111111"


def initialize_counter(owner_pubkey: str) -> Account:
    """Every account a Solana program touches must be passed in explicitly — there
    is no implicit contract storage the way EVM `SSTORE` provides."""
    pda = find_program_address(["counter", owner_pubkey], COUNTER_PROGRAM_ID)
    return Account(pubkey=pda, owner_program=COUNTER_PROGRAM_ID, data={"count": 0})


def increment(counter_account: Account, signer_pubkey: str) -> None:
    """The 'instruction': operates only on the account object it's handed, never on
    hidden global state — this is the account model the card's howItWorks names."""
    if counter_account.owner_program != COUNTER_PROGRAM_ID:
        raise PermissionError("account not owned by this program")
    counter_account.data["count"] += 1
    print(f"  signer={signer_pubkey[:8]}... incremented {counter_account.pubkey[:12]}... "
          f"-> count={counter_account.data['count']}")


if __name__ == "__main__":
    print("Solana account model — PDA-based counter (state passed in, not stored implicitly)\n")

    owner = "User11111111111111111111111111111111111111"
    counter = initialize_counter(owner)
    print(f"Derived PDA for owner: {counter.pubkey}")
    print(f"Owned by program:      {counter.owner_program}\n")

    print("Calling increment three times, passing the account explicitly each time:")
    for _ in range(3):
        increment(counter, owner)

    print(f"\nFinal on-chain state (lives in the account, not the program): {counter.data}")

docs/code/pocs/solana.py