Go to file
Jack Grigg 4948617d6d
Add JNI methods for handling chain validity and reorgs
2019-05-14 17:30:09 +01:00
assets Promote diagrams from draft to final status 2019-03-27 02:09:25 -04:00
docs Update docs 2019-03-30 12:22:20 -04:00
gradle/wrapper Update dependencies 2019-03-29 02:03:11 -04:00
samples/memo Initial memo sample app. 2019-04-24 03:16:15 -04:00
src Add JNI methods for handling chain validity and reorgs 2019-05-14 17:30:09 +01:00
.gitignore Fix bugs 2019-03-27 01:37:46 -04:00
Cargo.lock Add JNI methods for handling chain validity and reorgs 2019-05-14 17:30:09 +01:00
Cargo.toml Add JNI methods for handling chain validity and reorgs 2019-05-14 17:30:09 +01:00
LICENSE initial commit of sample project code 2018-11-20 12:59:08 -05:00
README.md Update docs 2019-03-30 12:22:20 -04:00
build.gradle Migrate build system to Rust Android Gradle plugin 2019-04-19 00:06:30 +01:00
custom-tasks.gradle Migrate build system to Rust Android Gradle plugin 2019-04-19 00:06:30 +01:00
gradle.properties add gradle wrapper 2018-11-21 02:02:31 -05:00
gradlew add gradle wrapper 2018-11-21 02:02:31 -05:00
gradlew.bat add gradle wrapper 2018-11-21 02:02:31 -05:00
proguard-rules.pro initial commit of sample project code 2018-11-20 12:59:08 -05:00
settings.gradle add ability to publish to the local repo 2018-11-21 04:48:26 -05:00
testing.gradle Create synchronizer and add layer of business logic onto the data layer 2019-03-27 01:37:46 -04:00

README.md

Security Disclaimer

⚠️ WARNING: This is an early preview under active development and anything may change at anytime!


In the spirit of transparency, we provide this as a window into what we are actively developing. This is an alpha build, not yet intended for 3rd party use. Please be advised of the following:

  • 🛑 This code currently is not audited 🛑
  • This is a public, active branch with no support
  • The code does not have documentation that is reviewed and approved by our Documentation team
  • The code does not have adequate unit tests, acceptance tests and stress tests
  • The code does not have automated tests that use the officially supported CI system
  • The code has not been subjected to thorough review by engineers at the Electric Coin Company
  • This product does not run compatibly with the latest version of zcashd
  • The product is majorly broken in several ways including:
    • master seed management is left to the 3rd party wallet developer (beacause that's what wallets do best)
    • secure spending key management is left to the 3rd party wallet developer
  • The library only runs on testnet
  • The library does not run on mainnet and cannot run on regtest
  • We are actively changing the codebase and adding features where/when needed
  • We do not undertake appropriate security coverage (threat models, review, response, etc.)
  • ✔️ There is a product manager for this library
  • ✔️ Electric Coin Company maintains the library as we discover bugs and do network upgrades/minor releases
  • ✔️ Users can expect to get a response within a few weeks after submitting an issue
  • The User Support team had not yet been briefed on the features provided to users and the functionality of the associated test-framework
  • The code is unpolished
  • The code is not documented
  • The code is not yet published (to Bintray/Maven Central)
  • Requires external lightwalletd server

🛑 Use of this code may lead to a loss of funds 🛑

Use of this code in its current form or with modifications may lead to loss of funds, loss of "expected" privacy, or denial of service for a large portion of users, or a bug which could leverage any of those kinds of attacks (especially a "0 day" where we suspect few people know about the vulnerability).

👀 At this time, this is for preview purposes only. 👀


Zcash Android SDK

This lightweight SDK connects Android to Zcash. It welds together Rust and Kotlin in a minimal way, allowing third-party Android apps to send and receive shielded transactions easily, securely and privately.

Contents

Structure

From an app developer's perspective, this SDK will encapsulate the most complex aspects of using Zcash, freeing the developer to focus on UI and UX, rather than scanning blockchains and building commitment trees! Internally, the SDK is structured as follows:

SDK Diagram

Thankfully, the only thing an app developer has to be concerned with is the following:

SDK Diagram Developer Perspective

Back to contents

Overview

At a high level, this SDK simply helps native Android codebases connect to Zcash's Rust crypto libraries without needing to know Rust or be a Cryptographer. Think of it as welding. The SDK takes separate things and tightly bonds them together such that each can remain as idiomatic as possible. It's goal is to make it easy for an app to incorporate shielded transactions while remaining a good citizen on mobile devices.

Given all the moving parts, making things easy requires coordination. The Synchronizer provides that layer of abstraction so that the primary steps to make use of this SDK are simply:

  1. Start the Synchronizer
  2. Subscribe to wallet data

The Synchronizer takes care of

- Connecting to the light wallet server
- Downloading the latest compact blocks in a privacy-sensitive way
- Scanning and trial decrypting those blocks for shielded transactions related to the wallet
- Processing those related transactions into useful data for the UI
- Sending payments to a full node through the light wallet server
- Monitoring sent payments for status updates

To accomplish this, these responsibilities of the SDK are divided into separate components. Each component is coordinated by the Synchronizer, which is the thread that ties it all together.

Components

Component Summary Input Output
Downloader Downloads compact blocks Server host:port Stream of compact blocks
Processor Processes compact blocks Stream of compact blocks Decoded wallet data
Repository Source of data derived from processing blocks Decoded wallet data UI Data
Active Transaction Manager Manages the lifecycle of pending transactions Decoded wallet data Transaction state
Wallet Wraps the Zcash rust libraries, insulating SDK users from changes in that layer Configuration Configuration

Back to contents

Quickstart

Add the SDK dependency

implementation "cash.z.android.wallet:zcash-android-testnet:1.7.5-alpha@aar"

Start the Synchronizer

synchronizer.start(this)

Get the wallet's address

synchronizer.getAddress()

Send funds to another address

synchronizer.sendToAddress(zatoshi, address, memo)

Back to contents

Compiling Sources

⚠️ Presently, the latest stable code lives in the preview branch, under active development, and is not yet released.

Importing the dependency should be enough for use but in the event that you want to compile the SDK from sources, including the Kotlin and Rust portions, simply use Gradle.

Compilation requires Cargo and has been tested on Ubuntu, MacOS and Windows. To compile the SDK run:

./gradlew clean assembleZcashtestnetRelease

This creates a testnet build of the SDK that can be used to preview basic functionality for sending and receiving shielded transactions. If you do not have Rust and Cargo installed, the build script will let you know and provide further instructions for installation. Note that merely using the SDK does not require installing Rust or Cargo--that is only required for compilation.

Back to contents