View-Only Wallets

RAILGUN Wallets (created with mnemonic) have both spending and viewing keys. View-Only wallets lack the spending key, so they cannot create transactions, but they have access to the wallet viewing key that can access balances and transaction history.

View-Only wallets are created using a shareable viewing key. Only the original wallet owner, who has access to the RAILGUN Wallet (and mnemonic) can generate a shareable key.

Example: Generate shareable key and associated View-Only wallet

import { 
} from '@railgun-community/wallet';

const encryptionKey = ...; // See `Encryption Keys` section

const railgunWalletID = ...; // Stored after RAILGUN wallet creation

const shareableViewingKey = await getWalletShareableViewingKey(railgunWalletID);

// Current block numbers for each chain when wallet was first created.
// If unknown, provide undefined.
const creationBlockNumberMap: Optional<MapType<number>> = undefined;

const viewOnlyWalletInfo = await createViewOnlyRailgunWallet(
const id =;

View-Only wallets may be loaded like RAILGUN Wallets, using loadWalletByID.

Example: Load stored RAILGUN Wallet by its ID

import { loadWalletByID } from '@railgun-community/quickstart';

const encryptionKey = ...; // See `Encryption Keys` section
const id = ...; // Previously stored when local RAILGUN wallet was created
const viewOnlyWalletInfo = await loadWalletByID(
  true, // isViewOnlyWallet

Last updated