Skip to content

Commit

Permalink
Merge pull request StackmateNetwork#37 from StackmateNetwork/dev
Browse files Browse the repository at this point in the history
Merging Updates to Single Sig wallet only with Tor by Default
  • Loading branch information
i5hi authored May 27, 2022
2 parents f50c1e0 + 73a4a1c commit bf33f3b
Show file tree
Hide file tree
Showing 230 changed files with 8,712 additions and 8,260 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release

/android/key.properties

**/target
# /packages/bitcoin/ios/libstackmate.a
android/src/main/jniLibs/x86_64/libstackmate.so
android/src/main/jniLibs/x86/libstackmate.so
android/src/main/jniLibs/armeabi-v7a/libstackmate.so
android/src/main/jniLibs/arm64-v8a/libstackmate.so
packages/bitcoin/test/libstackmate.dylib
packages/bitcoin/test/libstackmate.dylib

coverage/*
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"integration_test": true,
".gitlab-ci.yml": true,
//
"**/assets": true,
"**/assets": false,
//
//
"**/**.g.dart": true,
Expand Down
83 changes: 83 additions & 0 deletions ABOUT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# stackmate

stackmate is a bitcoin descriptor wallet made by bitcoiners for everyone.

within open source wallet software research & development, stackmate finds its place through a primary focus on simplicity..

simplicity here is for:

- users: through friendly application interface design; users have an intuitive experience with money.
- developers: through use of simple, tried and tested coding patterns and practices; devs find it easy to understand and
contribute to the project.

# features

## Single Signature Wallets

The entry point into bitcoin is the single signature wallet.

stackmate provides the classic interface that we all know and love.

stackmate provides a helpful recovery tool that supports recovery from:

- descriptors
- extended keys
- mnemonics

stackmate supports other handy features such as rbf and batch send.

stackmate also supports watch-only wallets (cold card pair).

## Broadcaster

stackmate supports broadcasting psbt's as a standalone tool (cold card pair).

## Electrum Backend

stackmate requires an electrum backend to interact with the bitcoin network.

stackmate allows users to use their own node or defaults to blockstream.

## Tor

stackmate comes bundled with tor for network level privacy.

This is especially important if you are not using your own node..

## Script Signature Wallets

stackmate supports the creation and complete management of 3 types of bitcoin scripts:

1. Inheritance: 1/2 w/timelocked
2. Escrow: 2/3 multisig
3. Team: n/7 multisig

### Script Recovery

It is also possible to recover arbitraty scripts, as long as they are in the descriptor format. Additionally, to move funds
out of such a wallet all the minimum private keys will need to be present - either within the descriptor or imported in
addition to the descriptor.

## E2EE Comms

script wallets that involve more than one party have always faced a problem with synchronization.

Synchronization is primarily required for two operational processes:

1. Wallet Creation:

All parties must submit their portion of the script, usually their public keys, and agree on the final definition of the
script.

2. Transaction:

To make a transaction, all the required members must present their portion of the script satisfied, usually done by
passing a psbt for successive signatures until it is finalized; after which it can be broadcasted.

stackmate facilitates sync for the above two process by providing an e2ee message posting service (cypherpost) which will
allow parties in a script to easily share wallet data and stay in sync with each other.

For natively created scripts, all script wallets have their own respective cypherpost group chat.



61 changes: 61 additions & 0 deletions PRIVACY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Privacy Policy

Stackmate is designed to maximize self-sovereignty and minimize dependency and trust in third parties.

## Tor By Default

The client comes bundled with Tor, which is a requirement to make network calls from the app.

This protects you from being fingerprinted via IP address by a backend service providers.

## Backend Service Provider Defaults

All backend services can be substituted with your own services or be entirely opted out of.

We use the following services as default:

### Electrum Node

`Blockstream`

This is the core backend service required to sync your wallet public data and also broadcast transactions.

This can be your own server.

### Exchange Rate

Coming soon

### Blockexplorer

`BullBitcoin`

This is used to view transactions on an explorer to study its path in depth.

This can be your own server.

## Telemetry

The app currently uses no telemetry.

## Platform Specific Considerations

Android users must ensure that they disable GBoards analytics or entirely opt-out and try options like OpenBoards.

The moment private data is either copied to a clipboard or typed by GBoard, it will have severely degraded in its integrity.

### Permissions

#### Camera

The app currently requires permission to use your camera ONLY when scanning a Bitcoin address or Public Key.

#### Biometrics

To use native authentication to access the app.

## Bitcoin Specific Considerations

Imported wallets currently estimate your last used address index based on your transaction history.

You have the ability to manually increment your index if you believe the estimations are not accurate.
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
<h1 align="center">STACKMATE</h1>
<div align="center">A multi-purpose Bitcoin Wallet</div>
<br />
<p align="center">
<img style="height:500px" src="demo.png"/>
<p/>
<br />

<h1 align="center">STACKMATE</h1> <div align="center">A multi-purpose Bitcoin Wallet</div> <br /> <p align="center"> <img style="height:500px" src="demo.png"/> <p/> <br />
## Table of Contents
- [Core](#core)
- [Features](#features)
Expand Down
10 changes: 8 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,17 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.sats.stackmate"
applicationId "com.sats.stackmate.wallet"
minSdkVersion 28
// targetSdkVersion 30
// minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
multiDexEnabled true
versionCode flutterVersionCode.toInteger()
versionCode 6
versionName flutterVersionName
ndk {
abiFilters 'arm64-v8a', 'x86_64', 'x86', 'armeabi-v7a'
}
}

signingConfigs {
Expand All @@ -73,6 +76,9 @@ android {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.release
shrinkResources false
zipAlignEnabled false
minifyEnabled false
}
}
}
Expand Down
33 changes: 32 additions & 1 deletion android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,38 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sats.stackmate">
package="com.sats.stackmate.wallet">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>

<application android:label="Stackmate" android:icon="@mipmap/launcher_icon" android:extractNativeLibs="true">
<activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" />
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data android:name="io.flutter.embedding.android.SplashScreenDrawable" android:resource="@drawable/launch_background" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host="satswala.page.link" android:scheme="https"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data android:name="flutterEmbedding" android:value="2" />

</application>
</manifest>
16 changes: 8 additions & 8 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.sats.stackmate">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.sats.stackmate.wallet">
<uses-sdk android:minSdkVersion="28" android:targetSdkVersion="31" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.USE_FINGERPRINT"/>
<queries>
<!-- If your app opens https URLs -->
Expand All @@ -14,8 +13,8 @@
</intent>
</queries>

<application android:label="Stackmate" android:icon="@mipmap/launcher_icon">
<activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
<application android:label="Stackmate" android:icon="@mipmap/launcher_icon" android:extractNativeLibs="true">
<activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize" android:exported="true">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
Expand All @@ -36,11 +35,12 @@
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host="satswala.page.link" android:scheme="https"/>
<data android:host="stackmate.in" android:scheme="https"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data android:name="flutterEmbedding" android:value="2" />

</application>
</manifest>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.sats.stackmate
package com.sats.stackmate.wallet

import io.flutter.embedding.android.FlutterActivity

Expand Down
Binary file removed android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary file not shown.
Binary file modified android/app/src/main/res/mipmap-hdpi/launcher_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary file not shown.
Binary file modified android/app/src/main/res/mipmap-mdpi/launcher_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary file not shown.
Binary file modified android/app/src/main/res/mipmap-xhdpi/launcher_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.bundle.enableUncompressedNativeLibs=false
Binary file added assets/fontawesome-webfont.ttf
Binary file not shown.
Binary file removed assets/icon/icon.png
Binary file not shown.
Binary file added assets/icon/sm92.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 61 additions & 0 deletions external_signers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# External Signers

This example uses bdk-cli as a `signer` and stackmate as a `watcher`.

## Create or restore a seed

```bash
bdk-cli key restore --mnemonic 'transfer spare party divorce screen used pole march warfare another balance find' 01:10:37 AM
{
"fingerprint": "8099ce1e",
"xprv": "tprv8ZgxMBicQKsPctM9UgftwPdDCxMq2c57utsBu5htMG7ySHZzT33jWyiSBQJwvjDEoMHmZGFgezhVTyKmiKfdPtdFtoAAdSzFYdstokvpop1"
}
```

## Derive account keys

```bash
bdk-cli key derive --xprv tprv8ZgxMBicQKsPctM9UgftwPdDCxMq2c57utsBu5htMG7ySHZzT33jWyiSBQJwvjDEoMHmZGFgezhVTyKmiKfdPtdFtoAAdSzFYdstokvpop1 --path "m/84h/1h/0h"
{
"xprv": "[8099ce1e/84'/1'/0']tprv8fVh3n3LQjFrTRXZYeZ9n8tvbEPshXqeRgauvZXXxn7117kDegj92XaHy9kVTH2zN9fXg8Ce4cpX5ihr9CBBAuA7DJSmdU2gVj3Xjd2T41G/*",
"xpub": "[8099ce1e/84'/1'/0']tpubDCBjCC5aZ6wXLtZMSJDkBYZ3AFuors2YzzBhD5ZqP3uPqbzzH5YjD2CA9HDhUYNhrqq67v4XAN93KSbSL4bwa5hEvidkFuj7ycWA7EYzp41/*"
}
```

## Create descriptor

bdk-cli no longer supports the policy command, so we will just build the descriptor by hand.

`wpkh([8099ce1e/84'/1'/0']tprv8fVh3n3LQjFrTRXZYeZ9n8tvbEPshXqeRgauvZXXxn7117kDegj92XaHy9kVTH2zN9fXg8Ce4cpX5ihr9CBBAuA7DJSmdU2gVj3Xjd2T41G/*)`

## Sync bdk-cli wallet

```bash
bdk-cli wallet -d "wpkh([8099ce1e/84'/1'/0']tprv8fVh3n3LQjFrTRXZYeZ9n8tvbEPshXqeRgauvZXXxn7117kDegj92XaHy9kVTH2zN9fXg8Ce4cpX5ihr9CBBAuA7DJSmdU2gVj3Xjd2T41G/0/*)"
-c"wpkh([8099ce1e/84'/1'/0']tprv8fVh3n3LQjFrTRXZYeZ9n8tvbEPshXqeRgauvZXXxn7117kDegj92XaHy9kVTH2zN9fXg8Ce4cpX5ihr9CBBAuA7DJSmdU2gVj3Xjd2T41G/1/*)" sync

bdk-cli wallet -d "wpkh([8099ce1e/84'/1'/0']tprv8fVh3n3LQjFrTRXZYeZ9n8tvbEPshXqeRgauvZXXxn7117kDegj92XaHy9kVTH2zN9fXg8Ce4cpX5ihr9CBBAuA7DJSmdU2gVj3Xjd2T41G/0/*)"
-c"wpkh([8099ce1e/84'/1'/0']tprv8fVh3n3LQjFrTRXZYeZ9n8tvbEPshXqeRgauvZXXxn7117kDegj92XaHy9kVTH2zN9fXg8Ce4cpX5ihr9CBBAuA7DJSmdU2gVj3Xjd2T41G/1/*)" get_balance

```

## Import wallet into stackmate

Create a stackmate watcher wallet by importing the following pubkey:

`[8099ce1e/84'/1'/0']tpubDCBjCC5aZ6wXLtZMSJDkBYZ3AFuors2YzzBhD5ZqP3uPqbzzH5YjD2CA9HDhUYNhrqq67v4XAN93KSbSL4bwa5hEvidkFuj7ycWA7EYzp41`

Confirm that the wallet created is correct based on balance.

## Build and copy transaction on stackmate watcher

## Sign transaction on bdk-cli

Substitute $PSBT for the psbt copied from stackmate.

```bash
bdk-cli wallet -d "wpkh([8099ce1e/84'/1'/0']tprv8fVh3n3LQjFrTRXZYeZ9n8tvbEPshXqeRgauvZXXxn7117kDegj92XaHy9kVTH2zN9fXg8Ce4cpX5ihr9CBBAuA7DJSmdU2gVj3Xjd2T41G/0/*)"
-c"wpkh([8099ce1e/84'/1'/0']tprv8fVh3n3LQjFrTRXZYeZ9n8tvbEPshXqeRgauvZXXxn7117kDegj92XaHy9kVTH2zN9fXg8Ce4cpX5ihr9CBBAuA7DJSmdU2gVj3Xjd2T41G/1/*)" sign --psbt $PSBT
```

## Broadcast transaction on stackmate
Loading

0 comments on commit bf33f3b

Please sign in to comment.