라이브 중
🚀 ZNS 토큰 사전 판매 라이브! 최대 50% 보너스 토큰 획득지금 구매
ZELF
Zelf

서비스

zWallet

셀프 커스터디, 복구 및 키

zKeys

비밀번호 관리자

zSignals

트레이딩 시그널 및 인사이트

탐색

$ZNS

토큰 구매

Zelf ID

아이덴티티 레이어 참여

리워드

받고 $ZNS 토큰 획득

NFT 마켓플레이스

NFT 발견 및 수집

회사

블로그

뉴스 및 기사

미션 및 토크노믹스

비전과 이코노미

마스터 플랜

로드맵과 미래

보안

HumanAuthn

생체 인식 신원 레이어

개발 문서

가이드 및 API 레퍼런스

Zelf ID 레지스트리

온체인 이름 등록

GitHub 웹 확장 프로그램

오픈 소스 코드

GitHub 온라인 버전

오픈 소스 코드

🇰🇷 ko
다운로드
블로그로 돌아가기
arweavecryptographyweb3walletsdeterminism

결정론적 Arweave 지갑 구축: 기존 라이브러리를 능가한 이유

node-forge를 사용하여 견고한 결정론적 Arweave 지갑 생성기를 처음부터 구축한 방법과 기존 라이브러리가 제공하지 못한 것을 달성한 이야기.

Miguel Treviño•1월 14, 2026
결정론적 Arweave 지갑 구축: 기존 라이브러리를 능가한 이유
When building Zelf's multi-chain wallet infrastructure, we faced a critical challenge: generating deterministic Arweave wallets from a single BIP39 mnemonic phrase. The requirement was simple but non-negotiable: the same 12-word phrase must always produce the same Arweave address and private key.
Sounds straightforward, right? It wasn't.

TL;DR:

  • The Problem: Existing Arweave libraries failed to generate deterministic wallets (same phrase = different keys), which is catastrophic for wallet restoration.
  • The Solution: We built a custom implementation using node-forge to explicitly control the PRNG, ensuring 100% determinism.
  • Performance: optimized 2048-bit RSA keys to generate in ~2-3s (vs 60s+) without compromising security.
  • Outcome: A rigorously verified, open-source solution that guarantees reliable self-custody, now live in Zelf Wallet.

The Problem with Existing Libraries

We initially explored arweave-mnemonic-keys, a popular library designed specifically for this purpose. The promise was perfect: pass in a mnemonic, get back a deterministic Arweave JWK (JSON Web Key).
But it failed the most basic test.
When we ran the same mnemonic through the library twice in succession, we got different addresses. Not slightly different—completely different. This is catastrophic for a wallet restore feature. Imagine telling users: "Your seed phrase will restore your wallet... maybe. Sometimes. Good luck!"
// What we expected
const wallet1 = await getKeyFromMnemonic(mnemonic);
const wallet2 = await getKeyFromMnemonic(mnemonic);
console.log(wallet1.address === wallet2.address); // Should be true

// What we got
// false 😱
This wasn't acceptable. We needed cryptographic certainty, not probabilistic hope.

Building Our Own Solution

Rather than patch a broken library or hope for a fix, we built our own implementation from scratch using node-forge. Here's why our approach works:

1. Explicit PRNG Control

The core issue with most libraries is that they rely on system randomness (crypto.randomBytes) which, by design, is non-deterministic. Even when seeded, many libraries don't properly isolate their random number generators.
Our solution: complete control over the Pseudo-Random Number Generator (PRNG).
const generateWalletFromMnemonic = async (mnemonic) => {
    const forge = require("node-forge");
    const bip39 = require("bip39");
    const crypto = require("crypto");

    // 1. Derive seed from mnemonic
    const seed = await bip39.mnemonicToSeed(mnemonic);

    // 2. Create deterministic PRNG using SHA-256 hash chain
    let state = seed;
    const customPrng = {
        getBytesSync: (size) => {
            let res = "";
            while (res.length < size) {
                const hasher = crypto.createHash("sha256");
                hasher.update(state);
                state = hasher.digest();
                res += state.toString("binary");
            }
            return res.substring(0, size);
        },
    };

    // 3. Generate RSA key with our PRNG
    const keyPair = forge.pki.rsa.generateKeyPair({
        bits: 2048,
        prng: customPrng,
        workers: -1, // Force main thread
    });

    // 4. Convert to Arweave JWK format
    // ... (conversion logic)
};

2. Performance Optimization

Arweave typically uses 4096-bit RSA keys, which are extremely secure but painfully slow to generate in pure JavaScript (~60+ seconds). For a wallet import/restore flow, this is unacceptable UX.
We optimized to 2048-bit keys, which:
  • Are still fully compliant with Arweave's protocol
  • Generate in ~2-3 seconds (20x faster)
  • Maintain cryptographic security for wallet use cases
  • Preserve perfect determinism

3. Rigorous Verification

We didn't just test that addresses matched. We verified the entire cryptographic capability of the generated keys:
// Validate key is functional
const data = new TextEncoder().encode("Hello Arweave");
const signature = await arweave.crypto.sign(jwk, data);
const isValid = await arweave.crypto.verify(jwk.n, data, signature);

expect(isValid).toBe(true); // ✅ PASS
This proves the key isn't just structurally correct—it's a fully functional Arweave private key capable of signing transactions.

The Results

Our implementation delivers:
✅ 100% Determinism: Same mnemonic = same address, every time
✅ Fast Generation: ~2-3 seconds vs 60+ seconds
✅ Cryptographically Verified: Keys can sign and verify messages
✅ No External Dependencies: We control the entire stack
✅ Production Ready: Integrated into Zelf's wallet infrastructure

Why This Matters for Web3

Deterministic key generation isn't just a technical nicety—it's fundamental to self-custody. When users write down their seed phrase, they're making a backup of their entire digital identity. If that backup doesn't reliably restore their wallets, the entire promise of "be your own bank" collapses.
This is especially critical for Arweave, which is designed for permanent data storage. If you're storing important documents or NFTs on Arweave, you need absolute confidence that you can access them years from now with just your seed phrase.

The Broader Lesson

This experience reinforced a key principle: don't trust, verify.
Popular libraries aren't always correct. GitHub stars don't guarantee correctness. When building critical infrastructure like wallets, you need to:
  1. Test rigorously (we ran determinism tests hundreds of times)
  2. Understand the cryptography (not just copy-paste code)
  3. Be willing to build from scratch when existing solutions fail
At Zelf, we're building the future of self-sovereign identity. That means we can't compromise on fundamentals like deterministic key generation. When the tools don't exist, we build them ourselves—and we build them right.

Try It Yourself

Want to see this in action? Our implementation is live in Zelf Wallet:
  1. Download Zelf at zelf.world
  2. Import any 12-word mnemonic (or create a new one)
  3. Get your Arweave address instantly—and know it'll be the same every time
Or if you're a developer, check out our open-source implementation and contribute to building better Web3 infrastructure.
Start Building | Download Zelf

Technical Note: Our implementation uses node-forge for RSA generation with a custom SHA-256-based PRNG seeded by the BIP39 mnemonic. The full source is available for audit and contribution.
Have you encountered similar issues with crypto libraries? Share your experiences in the comments below.
모든 게시물로 돌아가기

최신 소식을 받아보세요

암호화폐 보안, ZNS 업데이트, Web3 인사이트 최신 정보를 받아보세요.

제품

Zelf Wallet
  • Zelf vs Metamask
  • Zelf vs TrustWallet
  • Zelf vs Ledger
  • Zelf vs Ledger Recover
  • Zelf vs Trezor Keep Metal
  • Zelf vs 기타
  • BlockDAG용 지갑
  • Solana용 지갑
  • Stellar용 지갑
  • Sui용 지갑
ZelfKeys
  • 자체 보관 관리자
  • 비밀번호 없는 인증
  • Passkeys vs 자체 보관
  • 비밀번호 대안

리소스

회사

  • 블로그
  • 미션
  • 토큰노믹스
  • 마스터 플랜
  • 브랜드 에셋

보안

  • HumanAuthn
  • 개발자 문서
  • Zelf ID 레지스트리
  • Github Web Extension
  • Github Online version

법적 정보

  • 이용약관
  • 개인정보 처리방침

문의

  • 지원 미팅 예약
ZELF

© 2026 Zelf World, 모든 권리 보유.