Go to file
Lukas Korba 31a5848013
Merge pull request #1419 from LukasKorba/1418-Release-2-1-5
[#1418] Release 2.1.5
2024-04-18 15:43:58 +02:00
.github [#1332] Enable Swiftlint workflow 2023-12-12 15:51:15 -03:00
Example/ZcashLightClientSample Update to zcash-light-client-ffi version 0.8.0. 2024-04-17 17:21:37 -06:00
Sources/ZcashLightClientKit Update to zcash-light-client-ffi version 0.8.0. 2024-04-17 17:21:37 -06:00
Tests Update to zcash-light-client-ffi version 0.8.0. 2024-04-17 17:21:37 -06:00
Tools [#1108] Instrument rust backend tracing (#1109) 2023-05-23 13:31:30 -03:00
docs Rewind action continues to the processScanRanges 2023-09-13 16:28:42 +02:00
.gitignore [#888] Make actor from ZcashRustBackendWelding 2023-04-11 17:51:28 +02:00
.swiftlint.yml Update to zcash-light-client-ffi version 0.5.0 2024-01-30 08:44:47 -08:00
.swiftlint_tests.yml [#888] Make actor from ZcashRustBackendWelding 2023-04-11 17:51:28 +02:00
CHANGELOG.md [#1418] Release 2.1.5 2024-04-18 15:29:52 +02:00
CODE_REVIEW_GUIDELINES.md Fix typos 2022-12-31 12:50:16 +02:00
CONTRIBUTING.md Fix typos 2022-12-31 12:50:16 +02:00
LICENSE Update LICENSE 2020-06-09 16:15:31 -03:00
MIGRATING.md [#1001] Remove PendingDb in favor of `v_transactions` and `v_tx_output` Views (#1001) 2023-05-05 14:30:47 -03:00
Package.resolved Update to zcash-light-client-ffi version 0.8.0. 2024-04-17 17:21:37 -06:00
Package.swift Update to zcash-light-client-ffi version 0.8.0. 2024-04-17 17:21:37 -06:00
README.md [#1230] Remove linear sync from the SDK 2023-09-08 07:40:08 +02:00
SWIFTLINT.md PR review changes on MD files 2021-09-15 08:53:37 -03:00
responsible_disclosure.md Added responsible_disclosure.md 2021-01-26 14:10:52 -08:00
zcash.swiftformat Swiftlint (#5) 2019-10-18 17:09:13 -03:00

README.md

Zcash iOS Framework

Build Status

A Zcash Lightweight Client SDK for iOS This is an alpha build and is currently under active development. Please be advised of the following:

  • This code currently is not audited by an external security auditor, use it at your own risk
  • The code has not been subjected to thorough review by engineers at the Electric Coin Company
  • We are actively changing the codebase and adding features where/when needed

🔒 Security Warnings

  • The Zcash iOS Wallet SDK is experimental and a work in progress. Use it at your own risk.
  • Developers using this SDK must familiarize themselves with the current threat model, especially the known weaknesses described there.

Installation

Swift Package Manager

Add a package with the source "https://github.com/zcash/ZcashLightClientKit.git" and from version 0.14.0-beta onwards in either Xcode's GUI or in your Package.swift file.

Beta version support for Xcode projects

If you want to include a beta version of ZCashLightClientKit in an Xcode project e.g 0.14.0-beta you will need to specify it with the commit sha instead as it does not appear that Xcode supports 'meta data' from semantic version strings for swift packages (at the time of writing).

Testing

The best way to run tests is to open "Package.swift" in Xcode and use the Test panel and target an iOS device. Tests will build and run for a Mac target but are not currently working as expected.

There are three test targets grouped by external requirements:

  1. OfflineTests
    • No external requirements.
  2. NetworkTests
    • Require an active internet connection.
  3. DarksideTests
    • Require an instance of lightwalletd to be running while the tests are being run, see below for some information on how to set up. (Darkside refers to a mode in lightwalletd that allows it to be updated to represent/mock different states of the underlying blockchain.)

lightwalletd

The DarksideTests test target depend on a lightwalletd server instance running locally (or remotely). For convenience, we have added a universal (Mac) lightwalletd binary (in `Tests/lightwalletd/lightwalletd) and it can be run locally for use by the tests with the following command:

Tests/lightwalletd/lightwalletd --no-tls-very-insecure --data-dir /tmp --darkside-very-insecure --log-file /dev/stdout

You can find out more about running lightwalletd, from the main repo https://github.com/zcash/lightwalletd.

Integrating with CD/CI

The LIGHTWALLETD_ADDRESS environment variable can also be added to your shell of choice and xcodebuild will pick it up accordingly.

We advise setting this value as a secret variable on your CD/CI environment when possible.

Integrating with logging tools

There are a lots of good logging tools for iOS. So we'll leave that choice to you. ZcashLightClientKit relies on a simple protocol to bubble up logs to client applications, which is called Logger (kudos for the naming originality...)

public protocol Logger {
    
    func debug(_ message: String, file: String, function: String, line: Int)
    
    func info(_ message: String, file: String, function: String, line: Int)
    
    func event(_ message: String, file: String, function: String, line: Int)
    
    func warn(_ message: String, file: String, function: String, line: Int)
    
    func error(_ message: String, file: String, function: String, line: Int)
    
}

You have a few different options when it comes to logging:

  1. Leave it to the SDK. It will use its own Logger with sensible defaults. For this option, simply omit the loggingPolicy parameter when creating the Initializer

  2. Provide a custom logger. For this option, do the following: a). have one class conform to the Logger protocol b). inject that logger when creating the Initializer by passing a loggingPolicy of .custom(yourLogger)

  3. No logging. The SDK will not log any events. For this option, pass a loggingPolicy of .noLogging when creating the Initializer

For more details look the Sample App's AppDelegate code.

Swiftlint

We don't like reinventing the wheel, so we gently borrowed swift lint rules from AirBnB which we find pretty cool and reasonable.

Unstable features

Spend before Sync synchronization algorithm

The CompactBlockProcessor is responsible for downloading and processing blocks from the lightwalletd. Since the inception of the SDK the blocks were processed in a linear order up to the chain tip. Latests SDK has introduced brand new algorithm for syncing of the blocks. It's called Spend before Sync and processes blocks in non-linear order so the spendable funds are discovered as soon as possible - allowing users to create a transaction while still syncing.

Versioning

This project follows semantic versioning with pre-release versions. An example of a valid version number is 1.0.4-alpha11 denoting the 11th iteration of the alpha pre-release of version 1.0.4. Stable releases, such as 1.0.4 will not contain any pre-release identifiers. Pre-releases include the following, in order of stability: alpha, beta, rc. Version codes offer a numeric representation of the build name that always increases. The first six significant digits represent the major, minor and patch number (two digits each) and the last 3 significant digits represent the pre-release identifier. The first digit of the identifier signals the build type. Lastly, each new build has a higher version code than all previous builds. The following table breaks this down:

Build Types

Type Purpose Stability Audience Identifier Example Version
alpha Sandbox. For developers to verify behavior and try features. Things seen here might never go to production. Most bugs here can be ignored. Unstable: Expect bugs Internal developers 0XX 1.2.3-alpha04 (10203004)
beta Hand-off. For developers to present finished features. Bugs found here should be reported and immediately addressed, if they relate to recent changes. Unstable: Report bugs Internal stakeholders 2XX 1.2.3-beta04 (10203204)
release candidate Hardening. Final testing for an app release that we believe is ready to go live. The focus here is regression testing to ensure that new changes have not introduced instability in areas that were previously working. Stable: Hunt for bugs External testers 4XX 1.2.3-rc04 (10203404)
production Delivery. Deliver new features to end users. Any bugs found here need to be prioritized. Some will require immediate attention but most can be worked into a future release. Stable: Prioritize bugs Public 8XX 1.2.3 (10203800)

Examples

This repo contains demos of isolated functionality that this SDK provides. They can be found in the examples folder.

Examples can be found in the Demo App.

License

MIT