@arkade-os/sdk Documentation - v0.5.0-rc.11
    Preparing search index...

    Class SingleKey

    In-memory single key implementation for Bitcoin transaction signing.

    // Create from hex string
    const key = SingleKey.fromHex('your_private_key_hex');

    // Create from raw bytes
    const key = SingleKey.fromPrivateKey(privateKeyBytes);

    // Create random key
    const randomKey = SingleKey.fromRandomBytes();

    // Sign a transaction
    const signedTx = await key.sign(transaction);

    Implements

    Index

    Methods

    • Sign an arbitrary message using the requested signature type.

      Parameters

      • message: Uint8Array
      • signatureType: "schnorr" | "ecdsa" = "schnorr"

      Returns Promise<Uint8Array<ArrayBufferLike>>

    • BIP-340 sign messageHash with aux_rand = 0, so the signature — and anything derived from it — is reproducible from the key alone.

      What lets a static wallet derive a swap preimage instead of storing one (see wallet/contractSecrets.ts). Deliberately NOT signMessage, whose schnorr branch draws a random aux_rand: a preimage derived from that is unrecoverable, and the loss would only surface at claim time.

      Parameters

      • messageHash: Uint8Array

      Returns Promise<Uint8Array<ArrayBufferLike>>