-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
129 additions
and
112 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Firma [![Build Status]][travis] | ||
|
||
[Build Status]: https://travis-ci.com/RCasatta/firma.svg?branch=master | ||
[travis]: https://travis-ci.com/github/RCasatta/firma | ||
|
||
**WARNING - Early stage software, do not use with real bitcoins.** | ||
|
||
Firma is a tool to create bitcoin multisig wallet with private keys stored on offline machines. | ||
The offline machine could be [CLI](bin) terminal or a spare [android](android) phone. | ||
Informations are transferred between devices through QR codes, since PSBT could become large some kB, more than 1 qr code could be needed, those QRs are chained with qr [structured append](https://segno.readthedocs.io/en/stable/structured-append.html) | ||
|
||
It is based on: | ||
* [bitcoin core](https://bitcoincore.org/) | ||
* [psbt](https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki) (Partially Signed Bitcoin Transaction) | ||
* [rust-bitcoin](https://github.com/rust-bitcoin/rust-bitcoin) | ||
|
||
## High level process: | ||
|
||
``` | ||
+---------------------+ | ||
+---------------------+ |+---------------------+ | ||
| | xpubs || | | ||
| online machine | <------------ || offline machines | | ||
| | || | | ||
| * firma-online | PSBT || * firma-offline | | ||
| * bitcoin node | ------------> || * xprv | | ||
| * xpubs | <------------ || | | ||
| | +| | | ||
+---------------------+ +---------------------+ | ||
``` | ||
|
||
#### Setup | ||
|
||
* Create one ore more extended private keys `xprv` on one or more offline devices. | ||
* Group together corresponding extended public keys `xpub` and import these on a (on-line) Bitcoin core node in watch-only mode. | ||
* Bring back the wallet descriptor with `xpubs` on offline machines. While not strictly necessary for signing, wallet on offline machine act as a backup and as added information (eg check if a change is owned by the wallet) | ||
|
||
#### Usage | ||
|
||
##### Receiving | ||
|
||
* `firma-online` tool could create addresses to receive bitcoins. | ||
|
||
##### Spending | ||
|
||
* Create the transaction from the `firma-online` tool and export it in PSBT format. | ||
* Bring PSBT to offline devices, check the transaction, if everything looks correct, sign the PSBT with the private key present on the device. | ||
* Bring all the PSBT back to the node which can combine and finalize these as complete transaction (this operation could occur in parallel or serially). | ||
|
||
## Requirements | ||
|
||
You need [Bitcoin core 0.19.1](https://bitcoincore.org/) | ||
|
||
To build executables you need [rust](https://www.rust-lang.org/). | ||
|
||
``` | ||
git clone https://github.com/RCasatta/firma/ | ||
cd firma | ||
cargo build --release | ||
export PATH=$PATH:$PWD/target/release/ | ||
``` | ||
|
||
## Tests | ||
|
||
Integration tests require an env var pointing to bitcoin core executable (`bitcoind`). | ||
|
||
For example: | ||
|
||
``` | ||
BITCOIN_EXE_DIR=./bitcoin-0.19.1/bin cargo test | ||
``` | ||
|
||
## Example | ||
|
||
Check the bin [readme](bin/README.md) for an example with CLI | ||
|
||
## Donations | ||
|
||
I am the maintainer of one of the OpenTimestamps calendar, you can donate [there](https://finney.calendar.eternitywall.com/) (onchain or lightning) if you want to support this work. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Android | ||
|
||
|
||
|
||
## Building | ||
|
||
To build the android app you need the rust lib built with the android [ndk](https://developer.android.com/ndk). | ||
|
||
For the emulator, modify the `build-android.sh` file to fit your system. Then launch the build. | ||
|
||
``` | ||
cd lib | ||
./build-android.sh | ||
``` | ||
|
||
The script copy the file in the directory `android/app/src/main/jniLibs/x86/` | ||
|
||
At this point you should be able to launch the android app in the emulator, for using the app in the android phone you will need to launch also `build-android-release.sh`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "firma-bin" | ||
version = "0.1.0" | ||
version = "0.2.0" | ||
authors = ["Riccardo Casatta <[email protected]>"] | ||
edition = "2018" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "firma" | ||
version = "0.1.0" | ||
version = "0.2.0" | ||
authors = ["Riccardo Casatta <[email protected]>"] | ||
edition = "2018" | ||
#rust = "1.42" | ||
|
@@ -11,7 +11,7 @@ bitcoin = "0.23.0" | |
bitcoincore-rpc = "0.10.0" | ||
base64 = "0.12.0" | ||
num-bigint = "0.2.6" | ||
#qrcode = "0.12.0" | ||
#qrcode = "0.12.0" # https://github.com/kennytm/qrcode-rust/pull/44 | ||
qrcode = { git = "https://github.com/RCasatta/qrcode-rust/", branch="append" } | ||
structopt = "0.3.12" | ||
log = "0.4.8" | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,17 @@ | ||
export NDK_HOME=$HOME/android-ndk-r21 | ||
export PATH=$PATH:$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin | ||
export CC_aarch64_linux_android=aarch64-linux-android21-clang | ||
# configure this according to you system and your target | ||
export NDK=$HOME/android-ndk-r21 | ||
export TARGET=i686-linux-android | ||
export API=16 | ||
export HOST=darwin-x86_64 | ||
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/$HOST | ||
##### end configure | ||
|
||
export CC=$TOOLCHAIN/bin/$TARGET$API-clang | ||
export LD=$TOOLCHAIN/bin/$TARGET-ld | ||
export RANLIB=$TOOLCHAIN/bin/$TARGET-ranlib | ||
export STRIP=$TOOLCHAIN/bin/$TARGET-strip | ||
export AR=$TOOLCHAIN/bin/$TARGET-ar | ||
export AS=$TOOLCHAIN/bin/$TARGET-as | ||
|
||
cargo build --release --target aarch64-linux-android | ||
cp ../target/aarch64-linux-android/release/libfirma.so ../android/app/src/main/jniLibs/arm64-v8a/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters