21 unstable releases (4 breaking)

0.5.0 Feb 10, 2023
0.5.0-rc.2 Dec 31, 2022
0.4.1 Nov 23, 2022
0.3.1 Jul 6, 2022
0.1.2 Mar 17, 2022

#5 in #utxo

MIT license

140KB
3.5K SLoC

BitMask Core

Core functionality for the BitMask wallet - https://bitmask.app

BitMask is a bitcoin wallet and a browser extension for accessing decentralized web applications on the Bitcoin blokchain. It is designed to support UTXO based smart contracting protocols such as RGB, with planned support for Omni layer, TARO and many others.

Build status Crates.io npm: bitmask-core License: MIT+APACHE Telegram

Uses

Build

This should work with either wasm-pack, trunk, or x86-64.

Some environment variables may be needed in order to compile on macos-aarch64, for more, see this.

If there are issues compiling, be sure to check you're compiling with the latest Rust version.

To build this as a NodeJS module, use: wasm-pack build --release --target bundler

Test

  1. Lint against wasm32: cargo clippy --target wasm32-unknown-unknown
  2. Run tests in browser: TEST_WALLET_SEED="replace with a 12 word mnemonic for a wallet containing testnet sats" wasm-pack test --headless --chrome

Run

To run the bitmaskd node with REST server, either for testing the web wallet, or simply for increased privacy:

cargo install --features=server --path .

Then run bitmaskd.

Development

Parts of this application are built with conditional compilation statements for wasm32 support. This is a helpful command for checking linting and correctness while also developing on desktop platforms:

cargo clippy --target wasm32-unknown-unknown --no-default-features --release

Release

Upon a new release, follow these steps:

  1. Run cargo update to update to latest deps.
  2. Run cargo +nightly udeps to see if there are any unused dependencies.

Docker

For running bitmask-core tests in regtest, please follow the steps bellow:

  1. Build bitcoin node + electrum: docker compose build
  2. Up and running containers: docker compose up -d node1
  3. Load the command line: source .commands
  4. Send some coins to main wallet address: node1 sendtoaddress {ADDRESS} 10
  5. Mine a block: node1 -generate
  6. Running the tests: TEST_WALLET_SEED="replace with a 12 word mnemonic for a wallet containing testnet sats" cargo test allow_transfer -- --test-threads 1

Troubleshooting

1. After restarting the container

A.The bitcoin node does not work?

Check if your wallet is loaded. For that, run the command node1 loadwallet default.

B.The electrs node does not work?

To stop the electrs freeze, run node1 -generate.

Dependencies

~32–55MB
~839K SLoC