This repository contains a collection of TypeScript/Python apps and packages to:
- Generate an RSA private/public keypair for creating a new Recovery Kit
- Recover extended private/public keys from a Recovery Kit ZIP file, an RSA key, and a Fireblocks workspace owner's mobile recovery passphrase
- Derive wallet keys and addresses from extended private/public keys
- Query wallet balances and perform withdrawals from recovered cold wallets without exposing private keys
Recovery Utility is intended to be run on an offline, air-gapped machine. It is a cross-platform Electron app compiled for macOS, Windows, and Linux. Its window UI, along with Recovery Relay, are built with React on the Next.js framework, using Material UI components. It uses a companion web app, Recovery Relay, to check wallet balances and initiate transactions from recovered wallets.
Recovery Utility includes the compiled @fireblocks/extended-key-recovery module in its contents and spawns it as a child process to restore a workspace's extended private/public keys. Both Recovery Utility and Recovery Relay use @fireblocks/wallet-derivation to derive wallets' addresses and their private/public keys.
Recovery Relay can be hosted on any static file server, and Fireblocks maintains an instance hosted on Vercel at relay.fireblocks.solutions. Users can set a custom Recovery Relay URL in Recovery Utility's settings, after recovering their extended private keys.
This project is a monorepo using Yarn workspaces for package and JavaScript dependency management and Turborepo for running development and build scripts.
Check out the README for each package:
apps/recovery-utility/
: Recovery Utility: desktop app (Electron + Next.js)apps/recovery-relay/
: Recovery Relay: browser-based transaction client (Next.js)packages/extended-key-recovery/
: Extended Key Recovery module (Python)packages/wallet-derivation
: Wallet derivation from extended keys (TypeScript)packages/shared/
: Shared frontend components and utilities (TypeScript)
- Node.js version ≥16.15.0: You may use nvm to quickly install the supported version of Node.js by running
nvm use .
within this repository. - Python 3
- Visual Studio Code: This project contains VS Code extension recommendations which assist with code linting and formatting.
- Turborepo for a build system
- TypeScript for static type checking
- ESLint for TypeScript linting
- Prettier for TypeScript/Markdown formatting
- Black for Python formatting
- EditorConfig for IDE standardization
- Commitlint to enforce Conventional Commits
- Changesets for versioning and changelogs
- Husky and lint-staged for Git hooks
-
Obtain a hard key recovery ZIP, RSA private key (with passphrase), and Fireblocks mobile app passphrase.
-
After installing the prerequisite software, install Node.js and Python dependencies:
yarn install
-
To enable the build process, which fetches the latest supported assets from Fireblocks, copy
packages/asset-config/.env.example
to a new.env
file and replace theFIREBLOCKS_API_KEY
andFIREBLOCKS_API_PRIVATE_KEY
environment variables. These should also be set in CI/CD.
Run all dev
scripts. This starts Recovery Utility and Recovery Relay in development mode.
yarn dev
Run all test
scripts. Currently this only runs unit tests for @fireblocks/wallet-derivation.
yarn test
Run ESLint and PyLint to check for code formatting errors.
yarn lint
Run all build
scripts. Build Recovery Utility, the Python Extended Key Recovery module, and Recovery Relay for production. Recovery Utility and the Extended Key Recovery module are compiled only for the current development machine's architecture.
Be sure to set the FIREBLOCKS_API_KEY
and FIREBLOCKS_API_PRIVATE_KEY
environment variables to enable fetching the latest supported assets from Fireblocks.
To code sign and notarize the app, scripts/build.sh
contains a template for filling in required environment variables. Duplicate the file to scripts/build.local.sh
and fill out these variables in this new file, which will be ignored by Git.
yarn build
Turborepo can use a technique known as Remote Caching to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.
By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can create one, then enter the following commands:
yarn turbo login
This will authenticate the Turborepo CLI with your Vercel account.
Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your turborepo:
yarn turbo link