• Stars
    star
    758
  • Rank 59,918 (Top 2 %)
  • Language
    TypeScript
  • License
    GNU Affero Genera...
  • Created over 7 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Blockchain.com's open source, non-custodial Wallet

License: AGPL v3 js-standard-style code style: prettier Codechecks

Blockchain.com Wallet

Be Your Own Bank at login.blockchain.com. Please contact support if you have any issues using the wallet.

About

This repo contains the three codebases/packages listed below.

Packages

Local Development

  1. Ensure Node version >= 14.16 is installed. Using NVM is recommended.
  2. From the project root, run the following command to install dependencies: ./setup.sh.
  3. Start the application in development mode: yarn start
  4. The frontend application will now be accessible via browser at localhost:8080

If you require the application to run locally over HTTPS, follow the instructions here. You can disable SSL by setting the DISABLE_SSL env param to true with any start command. (e.g. DISABLE_SSL=true yarn start:staging)

Windows Support

To ensure proper support for Windows, please take the following actions before running the above setup instructions.

  1. Open a Powershell window with rights elevated to an Administrator.
  2. Run npm install -g windows-build-tools. This will install Python 2.7 and Visual C++ Build Tools which are required to compile some native Node modules.
  3. Ensure Python has been added to your environment variables by opening a cmd prompt and typing python. If you get a CommandNotFoundException message, add the folder %USERPROFILE%\.windows-build-tools\python27 to your environment variables.

Tips & Useful Commands

  1. To completely remove all dependencies and artifacts run yarn clean
  2. To add/remove an NPM package run yarn add or yarn remove in the package folder. After installing or uninstalling a NPM package, run yarn in the root folder to re-init the project
  3. All development specific dependencies should be installed as a dev-dependency in the top level package.json via yarn i --save-dev [package-name]
  4. All application specific dependencies should be installed in the specific packages package.json via yarn i --save [package-name]

Running Environments Locally

The frontend application can be ran locally with different build configurations found in config/env. The following commands are available:

  • yarn start Runs the application with the development.js configuration file
  • yarn start:dev Runs the application with the development.js configuration file
  • yarn start:staging Runs the application with the staging.js configuration file
  • yarn start:prod Runs the application with the production.js configuration file
  • yarn run:prod Runs the application mimicking the production environment entirely (i.e. code is bundled and minified, HMR is disabled, Express server is used (./server.js) and the production.js configuration file is loaded)

Notes:

  • Developers will need to manually create the development.js and staging.js files
  • Custom application runtimes are possible by modifying the corresponding environment files found in the config/env folder

Useful Chrome Extensions

Release Process

Prerequisites

To be able to create a release follow these steps starting with "Obtain a personal access token...": https://github.com/release-it/release-it#github-releases

GITHUB_TOKEN should be saved as RELEASE_IT_TOKEN instead in your bash_profile or wherever you keep env variables

You'll need git changelog to generate the history since the last release: npm install -g changelog

Release Steps

  1. From the tip of the development branch, run yarn release
  2. Answer the questions prompted via CLI, accepting the defaults for each
  3. Once completed, this will create a new tag which will trigger a builds
  4. Once builds have finished, deploy the images to desired environments
  5. Test and verify the latest changes in desired environments
  6. Create PR to merge the HEAD of development into master
  7. Merge PR to master so that master always reflects what is currently in production

Code Quality

  • yarn vet Runs Prettier, lint JS, lint CSS and finally all unit tests

Linting

We follow the rules outlined by the Javascript Standard Style as well as a few React specific rules.

Code linting is handled by ESLint. The following commands are available:

These IDE plugins/packages assist with complying with these lint rules while developing:

Prettier

We follow all standard rules that are provided by Prettier. The following commands are available:

It is recommended to setup a Prettier plugin for your IDE plugins/packages that will automatically prettify your files on save.

When installing the plugin for VS Code make sure you are on v3.7.0 or lower

Unit Tests

Testing is done via Jest and Enzyme.

Running Tests

Note: if you see errors that Jest cannot resolve package imports, you may need to run yarn test before testing specific packages (eg, yarn test:frontend)

Running Tests via Watch

Debugging Tests

To enable debugging for unit tests via the Chrome browser, run the following commands:

After running one of the above commands, Node will wait for a debugger to attach before starting the tests. To attach, simply open your browser and go to chrome://inspect and click on "Open Dedicated DevTools for Node", which will give you a list of available node instances you can connect to. Click on the address displayed in the terminal (usually localhost:9229) and you will be able to debug tests using Chrome's DevTools.

Updating Snapshot Tests

We are snapshot testing UI some components. Here are the commands to update them when necessary:

Code Coverage

To generate code coverage reports via Istanbul, the following commands are available:

Depending upon which coverage report was ran, the results can be found in the following directories:

  • coverage/index.html
  • coverage/blockchain-info-components/index.html
  • coverage/blockchain-wallet-v4/index.html
  • coverage/blockchain-wallet-v4-frontend/index.html Simply open the index.html file in your browser to view.

TypeScript

TypeScript is supported and should be used when adding new code. It's also recommended to replace legacy JS with TS when time allows.

TS Coverage

We are using Codechecks and Typecov for coverage reporting. Coverage is automatically analyzed for PRs and the following command is available.

  • yarn codechecks

Code Bundle Analysis/Reports

To visualize and interact with the tree of the production code bundles files:

  • yarn analyze Once completed, a browser will automatically open with the results.

Storybook

Storybook is used by the blockchain-info-components and blockchain-wallet-v4-frontend packages to interactively view, develop and test components. The following commands are available:

  • storybook:build-wallet: Builds the static storybook assets for wallet specific components (if base components is running locally, storybook will put wallet and base components into the same storybook UI)
  • storybook:build-base: Builds the static storybook assets for base shared components
  • storybook:serve-wallet Builds storybook assets and then serves them locally at localhost:6006
  • storybook:serve-base Builds storybook assets and then serves them locally at localhost:6007
  • storybook:deploy-wallet Builds storybook assets and then serves them to github pages. You will probably need to run cd ./packages/blockchain-info-components && git remote add origin [email protected]:blockchain/blockchain-wallet-v4-frontend.git first.
  • storybook:deploy-base Builds storybook assets and then serves them to github pages. You will probably need to run cd ./packages/blockchain-info-components && git remote add origin [email protected]:blockchain/blockchain-wallet-v4-frontend.git first.

If the deploy begins to fail, deleting the static build file before redeploy will likely help.

Contribute

Please review to the Wiki

Security

Security issues can be reported to us in the following venues:

More Repositories

1

service-my-wallet-v3

Blockchain Wallet API Service
JavaScript
887
star
2

My-Wallet-V3-Android

Blockchain Android Wallet
Kotlin
554
star
3

thunder

Off-Chain Bitcoin payments using smart contracts
Java
531
star
4

My-Wallet-V3

Blockchain Web Wallet Library - https://support.blockchain.com
JavaScript
405
star
5

My-Wallet-V3-iOS

Blockchain iOS Wallet
Swift
369
star
6

receive-payments-demos

Blockchain.info Receive Payments API V2 Demos
PHP
271
star
7

My-Wallet-V3-Frontend

Blockchain Web Wallet Frontend
JavaScript
207
star
8

unused-My-Wallet

Legacy Blockchain Web Wallet - current version is at https://github.com/blockchain/My-Wallet-V3-Frontend
JavaScript
207
star
9

unused-My-Wallet-iPhone

For latest source, please see: https://github.com/blockchain/My-Wallet-V3-iOS
Assembly
127
star
10

lib-exchange-client

C#
124
star
11

Blockchain-Known-Pools

Blockchain Known Pools Tracking Info
109
star
12

my-wallet-backup-decryption-tool

JavaScript
49
star
13

unused-My-Wallet-V3-jar

Deprecated. Now lives here: https://github.com/blockchain/My-Wallet-V3-Android/tree/master/wallet
Java
34
star
14

Checksum-Wallet

Wallet checksums
32
star
15

bc-phone-number

An AngularJS international phone input directive
JavaScript
32
star
16

coin-definitions

Python
31
star
17

My-Wallet-Chrome-Extension

Chrome Extension For Blockchain.info Wallets
Shell
25
star
18

components

Components library for the Blockchain.com ecosystem πŸ’ πŸ”₯
JavaScript
24
star
19

bc-countries

A convenient Javascript countries utilities (e.g: dial codes, country codes, names)
JavaScript
18
star
20

wallet-options

JavaScript
17
star
21

bitcoin-exchange-client

JavaScript
16
star
22

bitcoin-coinify-client

JavaScript
14
star
23

constellation

TypeScript
13
star
24

bitcoin-sfox-client

JavaScript
12
star
25

OpenQuestDB

High performance, low latency multi-value SQL database optimised for time series
Java
10
star
26

Checksum-Explorer

Explorer checksums
9
star
27

My-Wallet-V3-Bower

9
star
28

sre-rust-tss-esapi

Rust
9
star
29

bitcoin-unocoin-client

JavaScript
8
star
30

cashaddrj

Java
8
star
31

api-v1-client-java

Blockchain Bitcoin Developer APIs - Java
Java
7
star
32

digits-trie

Fast prefix operations for strings of digits
JavaScript
6
star
33

bc-css-flags

Countries flags styles using only one picture
CSS
5
star
34

android_tech_dependencies

Empty Android project with standard dependencies
Kotlin
2
star