1. Start the RAILGUN Privacy Engine
The RAILGUN Engine SDK is a dependency of Wallet SDK. It contains complex scanning technologies, cryptography, transaction wrappers and contract interfaces.
import {
startRailgunEngine,
} from '@railgun-community/wallet';
import LevelDB from 'level-js';
const initialize = (): void => {
// Name for your wallet implementation.
// Encrypted and viewable in private transaction history.
// Maximum of 16 characters, lowercase.
const walletSource = 'quickstart demo';
// LevelDOWN compatible database for storing encrypted wallets.
const dbPath = 'engine.db';
const db = new LevelDB(dbPath);
// Whether to forward Engine debug logs to Logger.
const shouldDebug = true;
// Persistent store for downloading large artifact files.
// See [Getting Started #2: Build a persistent store] for implementations.
const artifactStore = createArtifactStore('artifacts');
// Whether to download native C++ or web-assembly artifacts.
// True for mobile. False for nodejs and browser.
const useNativeArtifacts = false;
// Whether to skip merkletree syncs and private balance scans.
// Only set to TRUE in shield-only applications that don't
// load private wallets or balances.
const skipMerkletreeScans = false;
return startRailgunEngine(
walletSource,
db,
shouldDebug,
artifactStore,
useNativeArtifacts,
skipMerkletreeScans,
)
}
The response
StartRailgunEngineResponse
is formatted as {error?: string}
.This is a common response type for Quickstart, which catches error messages to ensure that most common functionality will never throw.