Go to file
Alex 9ee5a4e568
[#765] Store blocks on disk instead of in SQLite
* Switch to FsBlockDb for caching CompactBlocks

* Add RustBackend.getLatestHeight() method

* Raise MSRV to 1.60

* Migrate to latest Rust crate API

* Add RustBackend.findBlockMetadata() method

* Add RustBackend.rewindBlockMetadataToHeight() method

* [#765] implementation of FileCompactBlockRepository

* writing block metadata to database

* split write function into smaller easier to test blocks

* testing for FileCompactBlockRepository

* fixed rewinding

* fixed tests

* fixed FileCompactBlockRepositoryTest and SynchronizerFactoryTest

* code review fixes

* updated proto files

* override all functions in FakeRustBackend

* code review fixes

* Fix function body formatting

* Improve clear function clarity

* Use length of string const

* Delete single file instead of directory

* Improve function clarity

* Refactor outputs counting

- Found a typo in intermediary model class JniBlockMeta parameter change of which does not impact encoding from rust to kotlin according to rust layer implementation.

* Check blocks mkdir result

* Remove unnecessary detekt warning suppression

* Refactor buffer size check

* Improve visibility annotations

* Make file finalise obvious and self documenting

* Remove prevHash logging

* Move instantiation to the object itself

* Enrich fixture with default values

* Extend eror message

* Rename benchmark blocks range fixture

* Fix rebase changes

* Improve FileCompactBlockRepositoryTest

- "De-integrated" the test suite - it now works with fixture blocks
- Created needed fixtures for a clear mocked blocks providing
- Enhanced getting of FileCompactBlockRepository in FileCompactBlockRepositoryTest to clarify that it works with mock components

* Fix ktlintFormat findings

* Bump actions/cache from 3.2.4 to 3.2.5 in /.github/actions/setup (#927)

Bumps [actions/cache](https://github.com/actions/cache) from 3.2.4 to 3.2.5.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](627f0f41f6...6998d139dd)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix incorrect dir checking

* More robust min/max checking

* Rewinding to more robust middle value

* Strengthen blocks counts after rewind

* Add check of temp finalized file

* Refactor DatabaseCoordinatorTest

* Rename cache files root directory

- To have the same unified variable name across our repositories - fsBlockDbRoot

* Refactor FileCompactBlockRepositoryTest

- To have these tests more clear
- Fixed FakeRustBackend instantiation bug

* Revert back JniBlockMeta param name

* Delete legacy Cache db files

- Deleted from both the older and the newer legacy locations
- All related db files deleted - rollback files included
- The deletion is run once we try to access the new store blocks on disk root directory
- The deletion check does not throw any exception in case of failure, we just log it in console and try it on the next time
- Related new test added too

* Test refactoring

- Made few changes to improve clarity of provided tests and fixtures
- Prepared few new "failure path" tests
- Enhanced existing tests

* Manual test case

* Simplify error printing

- As we had some commented out code there

* Reset manual tests steps numbering

* [#924] Remove alias from WalletCoordinator

Also make Compose UI the default.  The old UI is deprecated but is still used by the benchmarking tests

* Bump benchmark version

* Protect JniBlockMetadata agains minification

* Enable debuggable while benchmarking

* Enhance benchmark screen waiting

* Fix cache db files deletion

- With this construct we delete all blocks blob metadata files, as well as their sqlite file

* Add new benchmark results

* Remove benchmark operations receiver fix

- As it's not needed after the latest profiler dependency update

* Bump gradle/wrapper-validation-action from 1.0.5 to 1.0.6 (#928)

Bumps [gradle/wrapper-validation-action](https://github.com/gradle/wrapper-validation-action) from 1.0.5 to 1.0.6.
- [Release notes](https://github.com/gradle/wrapper-validation-action/releases)
- [Commits](55e685c48d...8d49e559aa)

---
updated-dependencies:
- dependency-name: gradle/wrapper-validation-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump actions/cache from 3.2.5 to 3.2.6 in /.github/actions/setup (#929)

Bumps [actions/cache](https://github.com/actions/cache) from 3.2.5 to 3.2.6.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](6998d139dd...69d9d449ac)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update DatabaseCoordinator.kt

Move if/else out from log message body

* Update Switch cache to store blocks on disk.md

Reset documentation bullets numbering

* Hide internal constants from public package

* Update manual test user with new UI requirement

* Comment out cargo.toml test values

* Inline fixture blocks metadata with its creation

* Switch to FsBlockDb for caching CompactBlocks

* Add RustBackend.getLatestHeight() method

* Raise MSRV to 1.60

* Migrate to latest Rust crate API

* Add RustBackend.findBlockMetadata() method

* Add RustBackend.rewindBlockMetadataToHeight() method

* Update cargo.lock

* Switch to FsBlockDb for caching CompactBlocks

* Migrate to latest Rust crate API

* [#765] implementation of FileCompactBlockRepository

* writing block metadata to database

* split write function into smaller easier to test blocks

* testing for FileCompactBlockRepository

* fixed rewinding

* fixed tests

* fixed FileCompactBlockRepositoryTest and SynchronizerFactoryTest

* code review fixes

* updated proto files

* override all functions in FakeRustBackend

* code review fixes

* Fix function body formatting

* Improve clear function clarity

* Use length of string const

* Delete single file instead of directory

* Improve function clarity

* Refactor outputs counting

- Found a typo in intermediary model class JniBlockMeta parameter change of which does not impact encoding from rust to kotlin according to rust layer implementation.

* Check blocks mkdir result

* Remove unnecessary detekt warning suppression

* Refactor buffer size check

* Improve visibility annotations

* Make file finalise obvious and self documenting

* Remove prevHash logging

* Move instantiation to the object itself

* Enrich fixture with default values

* Extend eror message

* Rename benchmark blocks range fixture

* Fix rebase changes

* Improve FileCompactBlockRepositoryTest

- "De-integrated" the test suite - it now works with fixture blocks
- Created needed fixtures for a clear mocked blocks providing
- Enhanced getting of FileCompactBlockRepository in FileCompactBlockRepositoryTest to clarify that it works with mock components

* Fix ktlintFormat findings

* Fix incorrect dir checking

* More robust min/max checking

* Rewinding to more robust middle value

* Strengthen blocks counts after rewind

* Add check of temp finalized file

* Refactor DatabaseCoordinatorTest

* Rename cache files root directory

- To have the same unified variable name across our repositories - fsBlockDbRoot

* Refactor FileCompactBlockRepositoryTest

- To have these tests more clear
- Fixed FakeRustBackend instantiation bug

* Revert back JniBlockMeta param name

* Delete legacy Cache db files

- Deleted from both the older and the newer legacy locations
- All related db files deleted - rollback files included
- The deletion is run once we try to access the new store blocks on disk root directory
- The deletion check does not throw any exception in case of failure, we just log it in console and try it on the next time
- Related new test added too

* Test refactoring

- Made few changes to improve clarity of provided tests and fixtures
- Prepared few new "failure path" tests
- Enhanced existing tests

* Manual test case

* Simplify error printing

- As we had some commented out code there

* Reset manual tests steps numbering

* Bump benchmark version

* Protect JniBlockMetadata agains minification

* Enable debuggable while benchmarking

* Enhance benchmark screen waiting

* Fix cache db files deletion

- With this construct we delete all blocks blob metadata files, as well as their sqlite file

* Add new benchmark results

* Remove benchmark operations receiver fix

- As it's not needed after the latest profiler dependency update

* Update DatabaseCoordinator.kt

Move if/else out from log message body

* Update Switch cache to store blocks on disk.md

Reset documentation bullets numbering

* Hide internal constants from public package

* Update manual test user with new UI requirement

* Comment out cargo.toml test values

* Inline fixture blocks metadata with its creation

* Update cargo.lock

* Update Cargo.lock

* Check and document JniBlockMeta params ranges

* Add assert for gradle property

* Use UInt internally

uint

* Change array API to list

* Fix for using correct SDK Synchronizer alias

- Only the older Demo-app UI was impacted.
- Thus also our benchmarking was impacted.

* Apply documentation suggestions from code review

Co-authored-by: Kris Nuttycombe <kris@electriccoin.co>

* Final manual test instructions update

* Fixture block hash deterministically generated from block height

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Co-authored-by: Jack Grigg <jack@z.cash>
Co-authored-by: Honza <rychnovsky.honza@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Carter Jernigan <git@carterjernigan.com>
Co-authored-by: Kris Nuttycombe <kris@electriccoin.co>
2023-03-08 16:04:04 +01:00
.github Bump actions/cache from 3.2.5 to 3.2.6 in /.github/actions/setup (#929) 2023-02-27 21:47:05 +01:00
.idea [#631] Improve demo app compose UI for testing 2023-01-09 10:42:38 -05:00
.run [#615] Refactor lightwalletd client 2023-02-01 11:14:55 +01:00
build-conventions [#910] Kotlin 1.8.10 2023-02-10 07:18:44 -05:00
darkside-test-lib [#880] Refactor Twig 2023-02-09 15:44:22 -05:00
demo-app [#765] Store blocks on disk instead of in SQLite 2023-03-08 16:04:04 +01:00
demo-app-benchmark-test [#765] Store blocks on disk instead of in SQLite 2023-03-08 16:04:04 +01:00
docs [#765] Store blocks on disk instead of in SQLite 2023-03-08 16:04:04 +01:00
gradle/wrapper [#796] Gradle 7.6 2022-12-15 16:17:28 +01:00
lightwallet-client-lib [#765] Store blocks on disk instead of in SQLite 2023-03-08 16:04:04 +01:00
sdk-incubator-lib [#924] Remove alias from WalletCoordinator 2023-02-17 10:50:13 -05:00
sdk-lib [#765] Store blocks on disk instead of in SQLite 2023-03-08 16:04:04 +01:00
tools [#631] Initial Compose scaffolding for demo app 2022-12-23 11:00:37 +01:00
.gitignore [#880] Create sdk-incubator-lib 2023-02-09 15:44:22 -05:00
CHANGELOG.md [#880] Create sdk-incubator-lib 2023-02-09 15:44:22 -05:00
CONTRIBUTING.md [#495] Update Contributing Guidelines "Commit Messages" (#496) 2022-04-28 14:31:49 -04:00
LICENSE Correct LICENSE file 2021-08-25 06:48:13 -04:00
MIGRATIONS.md [#765] Store blocks on disk instead of in SQLite 2023-03-08 16:04:04 +01:00
README.md Improve readme documentation (#667) 2022-08-12 06:57:27 -04:00
build.gradle.kts [#765] Store blocks on disk instead of in SQLite 2023-03-08 16:04:04 +01:00
gradle.properties [#765] Store blocks on disk instead of in SQLite 2023-03-08 16:04:04 +01:00
gradlew [#796] Gradle 7.6 2022-12-15 16:17:28 +01:00
gradlew.bat [#796] Gradle 7.6 2022-12-15 16:17:28 +01:00
responsible_disclosure.md Added gmale suggestion of hyphentation. 2021-01-26 15:12:53 -08:00
settings.gradle.kts [#880] Create sdk-incubator-lib 2023-02-09 15:44:22 -05:00

README.md

license Maven Central

This is a beta 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 Android 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.

Zcash Android SDK

This lightweight SDK connects Android to Zcash, allowing third-party Android apps to send and receive shielded transactions easily, securely and privately.

Different sections of this repository documentation are oriented to different roles, specifically Consumers (you want to use the SDK) and Maintainers (you want to modify the SDK).

Note: This SDK is designed to work with lightwalletd. As either a consumer of the SDK or developer, you'll need a lightwalletd instance to connect to. These servers are maintained by the Zcash community.

Note: Because we have not deployed a non-beta release of the SDK yet, version numbers currently follow a variation of semantic versioning. Generally a non-breaking change will increment the beta number while a breaking change will increment the minor number. 1.0.0-beta01 -> 1.0.0-beta02 is non-breaking, while 1.0.0-beta01 -> 1.1.0-beta01 is breaking. This is subject to change.

Zcash Networks

"mainnet" (main network) and "testnet" (test network) are terms used in the blockchain ecosystem to describe different blockchain networks. Mainnet is responsible for executing actual transactions within the network and storing them on the blockchain. In contrast, the testnet provides an alternative environment that mimics the mainnet's functionality to allow developers to build and test projects without needing to facilitate live transactions or the use of cryptocurrencies, for example.

The Zcash testnet is an alternative blockchain that attempts to mimic the mainnet (main Zcash network) for testing purposes. Testnet coins are distinct from actual ZEC and do not have value. Developers and users can experiment with the testnet without having to use valuable currency. The testnet is also used to test network upgrades and their activation before committing to the upgrade on the main Zcash network. For more information on how to add testnet funds visit Testnet Guide or go right to the Testnet Faucet.

This SDK supports both mainnet and testnet. Further details on switching networks are covered in the remaining documentation.

Consumers

If you're a developer consuming this SDK in your own app, see Consumers.md for a discussion of setting up your app to consume the SDK and leverage the public APIs.

A primitive example to exercise the SDK exists in this repo, under Demo App.

There are also more comprehensive sample walletes:

  • ECC Sample Wallet — A basic sample application.
  • Secant Sample Wallet — A more modern codebase written in Compose. This repository is a work-in-progress and is not fully functional yet as of August 2022, although it will be our primary sample application in the future.

Maintainers and Contributors

If you're building the SDK from source or modifying the SDK:

  • Setup.md to configure building from source
  • Architecture.md to understand the high level architecture of the code
  • CI.md to understand the Continuous Integration build scripts
  • PUBLISHING.md to understand our deployment process

Note that we aim for the main branch of this repository to be stable and releasable. We continuously deploy snapshot builds after a merge to the main branch, then manually deploy release builds. Our continuous deployment of snapshots implies two things:

  • A pull request containing API changes should also bump the version
  • Each pull request should be stable and ready to be consumed, to the best of your knowledge. Gating unstable functionality behind a flag is perfectly acceptable

Known Issues

  1. Intel-based machines may have trouble building in Android Studio. The workaround is to add the following line to ~/.gradle/gradle.properties: ZCASH_IS_DEPENDENCY_LOCKING_ENABLED=false
  2. During builds, a warning will be printed that says "Unable to detect AGP versions for included builds. All projects in the build should use the same AGP version." This can be safely ignored. The version under build-conventions is the same as the version used elsewhere in the application.
  3. Android Studio will warn about the Gradle checksum. This is a known issue and can be safely ignored.