Solana

UR registry types used by Solana offline signing.

Data types

  • Request UR: sol-sign-request (transaction/message bytes + BIP‑44 path)

  • Response UR: sol-signature

Flow

  1. Prepare Solana transaction or message bytes and derive path.

  2. Build sol-sign-request and show as animated QR.

  3. Scan device response → decode sol-signature → attach to transaction.

  4. Submit to the Solana network.

Examples

Build Solana sign request (UR)

import { SolSignRequest, SignType } from '@keystonehq/bc-ur-registry-sol';
import { CryptoKeypath, PathComponent } from '@keystonehq/bc-ur-registry';
import { airGapUrUtils } from '@keystonehq/keystone-sdk';

// BIP44: m/44'/501'/0'
const keypath = new CryptoKeypath([
  new PathComponent({ index: 44, hardened: true }),
  new PathComponent({ index: 501, hardened: true }),
  new PathComponent({ index: 0, hardened: true }),
]);

const req = new SolSignRequest({
  signData: Buffer.from(rawTxBytes), // transaction or message bytes
  derivationPath: keypath,
  signType: SignType.Transaction,    // or SignType.Message
});

const ur = req.toUR();
const frames = airGapUrUtils.urToQrcode(ur);

Decode Solana signature (UR)

import { URDecoder } from '@ngraveio/bc-ur';
import { SolSignature } from '@keystonehq/bc-ur-registry-sol';

const dec = new URDecoder();
// dec.receivePart(frameString) for each scanned frame
if (dec.isComplete()) {
  const ur = dec.resultUR();           // 'sol-signature'
  const sig = SolSignature.fromCBOR(ur.cbor);
  const signature = sig.getSignature();
  // Attach signature to the transaction and submit
}

Last updated

Was this helpful?