Skip to content

Latest commit

 

History

History
111 lines (72 loc) · 6.32 KB

CONTRIBUTING.md

File metadata and controls

111 lines (72 loc) · 6.32 KB

🔨 Development

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.

Packages

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:

Prerequisites

Development Tools

Development Setup

  1. Obtain a hard key recovery ZIP, RSA private key (with passphrase), and Fireblocks mobile app passphrase.

  2. After installing the prerequisite software, install Node.js and Python dependencies:

    yarn install
  3. 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 the FIREBLOCKS_API_KEY and FIREBLOCKS_API_PRIVATE_KEY environment variables. These should also be set in CI/CD.

Development Scripts

Develop

Run all dev scripts. This starts Recovery Utility and Recovery Relay in development mode.

yarn dev

Test

Run all test scripts. Currently this only runs unit tests for @fireblocks/wallet-derivation.

yarn test

Lint

Run ESLint and PyLint to check for code formatting errors.

yarn lint

Build

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

Remote Caching

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