diff --git a/.github/workflows/rusk_ci.yml b/.github/workflows/rusk_ci.yml index e8b20b8330..ac2ed31cc9 100644 --- a/.github/workflows/rusk_ci.yml +++ b/.github/workflows/rusk_ci.yml @@ -28,7 +28,8 @@ jobs: run-ci: - '!(web-wallet/**/*|.github/workflows/webwallet_ci.yml)' - '!(explorer/**/*|.github/workflows/explorer_ci.yml)' - predicate-quantifier: 'every' + - '!(rusk-wallet/**/*|.github/workflows/ruskwallet_ci.yml)' + predicate-quantifier: "every" analyze: needs: changes if: needs.changes.outputs.run-ci == 'true' diff --git a/.github/workflows/ruskwallet_build.yml b/.github/workflows/ruskwallet_build.yml new file mode 100644 index 0000000000..b1f892fc63 --- /dev/null +++ b/.github/workflows/ruskwallet_build.yml @@ -0,0 +1,86 @@ +name: Compile CLI wallet binaries + +on: + workflow_dispatch: + inputs: + dusk_blockchain_ref: + description: "GIT branch, ref, or SHA to checkout" + required: true + default: "main" + +defaults: + run: + shell: bash + +jobs: + build_and_publish: + name: Build rusk-wallet binaries for ${{ matrix.os }} with ${{ matrix.compiler }}. + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04, ubuntu-22.04, macos-latest, macos-11, windows-latest] + compiler: [cargo] + include: + - os: ubuntu-20.04 + compiler: cargo + target: linux-x64 + + - os: ubuntu-22.04 + compiler: cargo + target: linux-x64-libssl3 + + - os: macos-latest + compiler: cargo + target: macos-intel + + - os: macos-11 + compiler: cargo + target: macos-arm64 + flags: --target=aarch64-apple-darwin + platform: aarch64-apple-darwin + + - os: windows-latest + compiler: cargo + target: windows-x64 + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.dusk_blockchain_ref }} + + - name: Install dependencies + uses: dsherret/rust-toolchain-file@v1 + + - name: Add arm target for Apple Silicon build + run: rustup target add aarch64-apple-darwin + if: ${{ matrix.os == 'macos-11' }} + + - name: Build Wallet + shell: bash + working-directory: ./ + run: ${{matrix.compiler}} b --release --verbose ${{matrix.flags}} + + - name: Get semver from wallet binary + run: | + ls -la target/release + export SEMVER=$(cargo pkgid | perl -lpe 's/.*\@(.*)/$1/') + echo "SEMVER=$SEMVER" >> $GITHUB_ENV + + - name: "Pack binaries" + run: | + mkdir rusk-wallet${{env.SEMVER}}-${{matrix.target}} + echo "Fetching changelog and readme files..." + mv target/${{matrix.platform}}/release/rusk-wallet rusk-wallet${{env.SEMVER}}-${{matrix.target}} + cp CHANGELOG.md rusk-wallet${{env.SEMVER}}-${{matrix.target}} + cp README.md rusk-wallet${{env.SEMVER}}-${{matrix.target}} + tar -czvf ruskwallet${{env.SEMVER}}-${{matrix.target}}.tar.gz rusk-wallet${{env.SEMVER}}-${{matrix.target}} + ls -la *.gz + + - name: "Upload Wallet Artifacts" + uses: actions/upload-artifact@v3 + with: + name: wallet-binaries-${{env.SEMVER}} + path: | + ./*.gz + retention-days: 5 diff --git a/.github/workflows/ruskwallet_ci.yml b/.github/workflows/ruskwallet_ci.yml new file mode 100644 index 0000000000..da41cb9144 --- /dev/null +++ b/.github/workflows/ruskwallet_ci.yml @@ -0,0 +1,96 @@ +name: rusk-wallet CI + +on: + pull_request: + types: + - opened + - synchronize + - reopened + - ready_for_review + +jobs: + # JOB to run change detection + changes: + runs-on: ubuntu-latest + # Required permissions + permissions: + pull-requests: read + # Set job outputs to values from filter step + outputs: + run-ci: ${{ steps.filter.outputs.run-ci }} + steps: + # For pull requests it's not necessary to checkout the code + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + run-ci: + - 'rusk-wallet/**' + - '.github/workflows/ruskwallet_ci.yml' + fmt: + name: Rustfmt + runs-on: core + steps: + - uses: actions/checkout@v4 + - uses: dsherret/rust-toolchain-file@v1 + - run: cargo fmt --all -- --check + + analyze: + name: Dusk Analyzer + runs-on: core + steps: + - uses: actions/checkout@v4 + - uses: dsherret/rust-toolchain-file@v1 + - run: cargo install --git https://github.com/dusk-network/cargo-dusk-analyzer + - run: cargo dusk-analyzer + + test_nightly-linux: + name: "[Linux] Nightly tests" + runs-on: core + + steps: + - uses: actions/checkout@v4 + - uses: dsherret/rust-toolchain-file@v1 + - run: cargo test --release + working-directory: ./rusk-wallet + - run: cargo clippy --all-features --release -- -D warnings + working-directory: ./rusk-wallet + + test_nightly-macintel: + name: "[Mac Intel] Nightly tests" + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + - uses: dsherret/rust-toolchain-file@v1 + + - name: Add arm target for Apple Silicon build + run: rustup target add aarch64-apple-darwin + + - run: cargo test --release + working-directory: ./rusk-wallet + + test_nightly-macm1: + name: "[Mac arm64] Nightly checks" + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + - uses: dsherret/rust-toolchain-file@v1 + + - name: Add arm target for Apple Silicon build + run: rustup target add aarch64-apple-darwin + + - run: cargo check --target=aarch64-apple-darwin --release + working-directory: ./rusk-wallet + + test_nightly-win: + name: "[Windows] Nightly tests" + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + - uses: dsherret/rust-toolchain-file@v1 + + - run: cargo test --release + working-directory: ./rusk-wallet diff --git a/Cargo.toml b/Cargo.toml index cdd1f29631..6188b50808 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,6 +29,7 @@ members = [ # Test utils "test-wallet", ] +exclude = ["rusk-wallet"] resolver = "2" [profile.dev.build-override] diff --git a/rusk-wallet/CHANGELOG.md b/rusk-wallet/CHANGELOG.md new file mode 100644 index 0000000000..78ab3438f6 --- /dev/null +++ b/rusk-wallet/CHANGELOG.md @@ -0,0 +1,641 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Fixed + +- Fix tx history to show tx created with "MAX" amount [#248] + +## [0.22.1] - 2024-3-27 + +### Added + +- Add support for `WALLET_MAX_ADDR` lower than `6` [#244] + +### Changed + +- Change rusk-wallet to wait for tx to be included + +### Fixed + +- Fix tx history to avoid useless calls [#243] + +## [0.22.0] - 2024-2-28 + +### Changed + +- Change `REQUIRED_RUSK_VERSION` to `0.7.0` +- Update unclear error message [#235] +- Change provisioner key password prompt message [#238] + +### Removed + +- Remove `stake_allow` command + +## [0.21.0] - 2023-12-30 + +### Added + +- Add `seed-file` to `create` command [#226] +- Add `name` to `export` command + +### Fixed + +- Fix `stake_allow` command [#222] + +### Changed + +- Change `dusk-wallet-core` to `0.24.0-plonk.0.16-rc.2` +- Change `DEFAULT_MAX_ADDRESSES` from 255 to 25 +- Update `requestty` from `0.4.1` to `0.5.0` [#231] + +## [0.20.1] - 2023-11-22 + +### Added + +- Add `spending_keys` to wallet impl [#218] + +## [0.20.0] - 2023-11-01 + +### Changed + +- Change `REQUIRED_RUSK_VERSION` to `0.7.0-rc` +- Change the Staking Address generation. [#214] +- Change `dusk-wallet-core` to `0.22.0-plonk.0.16` [#214] + +## [0.19.1] - 2023-10-11 + +### Added +- Add interactive stake allow [#98] +- Add optional `WALLET_MAX_ADDR` compile time env [#210] + +### Fixed + +- Fix staking address display [#204] +- Fix status overlap [#179] + +## [0.19.0] - 2023-09-20 + +### Added + +- Add balance display when offline +- Add `Wallet::sync` method for sync cache update +- Add `Wallet::register_sync` method for async cache update + +### Changed + +- Change wallet to not sync automatically +- Change spent notes to be in a different ColumnFamily +- Change `StateClient::fetch_existing_nullifiers` to return empty data. +- Change `fetch_notes` to use note's position instead of height [#190] + +### Removed + +- Remove cache sync from `StateClient::fetch_notes` +- Remove `RuskClient` struct + +### Fixed + +- Fix bug where we return early when there's no wallet file in interactive [#182] +- Fix bug where wallet file got corrupted when loading a old version and creating a new address [#198] + +## [0.18.2] - 2023-09-05 + +## [0.18.1] - 2023-09-01 + +### Fixed + +- Fix fetch_notes buffer [#176] + +## [0.18.0] - 2023-08-09 + +### Added + +- Add support for rusk HTTP request [#173] +- Add `local` network to default.config.toml [#173] + +### Changed + +- Change `config.toml` to use `http` instead of `grpc` endpoints [#173] +- Save the wallet.dat file with the new Rusk Binary Format [#165] +- Change blake3 with sha256 for password hashing for new Rusk Binary Format, + keep using blake3 for old dat file formats [#162] + +### Removed + +- Remove `grpc` support [#173] +- Remove `gql` support [#173] + +## [0.17.0] - 2023-07-19 + +### Added + +- Add `rkyv` dependency [#151] +- Add `dusk-merkle` dependency [#151] +- Add `Error::Utf8` variant [#151] +- Add `devnet` network to default config [#151] + +### Changed + +- Change `rust-toolchain` to `nightly-2023-05-22` [#151] +- Change `REQUIRED_RUSK_VERSION` to `0.6.0` [#151] +- Change `Error::Canon` variant to `Error::Rkyv` [#151] +- Populate cache database with psk(s) on state init [#158] +- Change `dusk-plonk` to `0.14.0` [#169] + +### Fixed +- Fix cache resolution for alternative networks [#151] +- Fix cache error detection [#163] + +### Removed + +- Remove `canonical` dependency [#151] + +## [0.16.0] - 2023-06-28 + +### Changed + +- Change cached Note's key to be the nullifier instead of hash [#144] +- Update cache for all the possible addresses at the same time [#144] + +## [0.15.0] - 2023-06-07 + +### Changed + +- Cache implementation now uses rocksdb instead of microkelvin [#56] + +### Fixed + +- Throw an error there when specifying a network that does not exist [#143] + +## [0.14.1] - 2023-05-17 + +### Fixed + +- Add overflow-checks to release mode [#132] + +## [0.14.0] - 2023-01-12 + +### Added + +- Add `execute` to create transaction for generic contract calls [#133] +- Add transaction history [#12] +- Add stake maturity epoch [#128] +- Add staking address display [#105] +- Add stake eligibility info [#124] + +### Fixed + +- Fix headless balance display [#123] + +## [0.13.0] - 2022-11-30 + +### Changed + +- Changed fn signature in `gas::new` to include the gas limit [#116] +- Change `request_gas_limit` fn signature to accept a gas limit option [#116] +- Change (un)stake, allow stake and withdraw default gas limits to sane defaults [#116] +- Change exported consensus keys extension to `.keys` [#114] + +## [0.12.0] - 2022-10-19 + +### Added + +- Add `default.config.toml` for the default configuration settings [#57] +- Add `settings` subcommand to show the current settings [#57] +- Add `--password` as global argument [#57] +- Add `--skip-recovery` to `create` subcommand [#57] +- Add `--file` to `restore` subcommand [#57] +- Add `Settings` type to merge `Config` (from toml) and `WalletArgs` (from CLI) [#57] +- Add `address` module +- Add `gas` module +- Add `settings` module [#57] +- Add `is_enough` method to `Gas` +- Add `Create`, `Restore` and `Settings` for both `Command` and `RunResult` enums [#72] +- Add `LogFormat` and `LogLevel` enums to enforce the set of value from args [#57] +- Add `From block` and `Last block` during fetching +- Add missing documentations +- Add `Seed` type in `store` module +- Add `stake-allow` command [#83] + +### Changed + +- Change program behavior to quit if wrong seed phrase is given [#49] +- Change program behavior to have three attempts for entering a password [#46] +- Change error handling to use the `anyhow` crate in `bin`[#87] +- Change error handling to use the `thiserror` crate in `lib`[#87] +- Change `config.toml` format [#57] +- Change from multiple wallets to one wallet for a single profile dir [#72] +- Rename `dusk` module to `currency` module +- Rename `address` subcommand to `addresses` +- Change `set_price` and `set_limit` for `Gas` to works with `Option` +- Change part of the functions to either receive the `password` or the `settings` [#57] +- Move `config` module outside `io` [#57] +- Change few UI strings +- Update rust-toolchain from `nightly-2022-02-19` to `nightly-2022-08-28` + +### Removed + +- Rename `--data-dir` argument option to `--profile` [#57] +- Remove `--wallet-name` argument option [#72] +- Remove `--network` argument option to choose the network to connect with [#57] +- Remove `interactive` subcommand [#57] +- Remove `--skip-recovery` as global argument [#57] +- Remove `--wait-for-tx` (now all the transaction wait by default) [#57] +- Remove `merge` method from `Config` in favour of `Settings` type [#57] +- Remove `Command::NotSupported` [#57] +- Rename `DEFAULT_GAS_LIMIT`, `DEFAULT_GAS_PRICE`, `MIN_GAS_LIMIT` +- Remove `Addresses` type in favour of `Vec
` +- Remove `refund-addr` arg in `withdraw` command [#86] + +### Fixed + +- Fix wrong condition involved `gas.is_enough()`[#91] +- Fix `balance` subcommand: it didn't work because the address given wasn't claimed +- Fix BLS keys exported with wrong extensions [#84] + +## [0.11.1] - 2022-08-24 + +### Added + +- Add prompt confirm_recovery_phrase to display the recovery phrase [#70] +- Add Windows terminal compatibility [#68] + +### Changed + +- Change `LoggingConfig` to be optional [#73] +- Replace `error!` macro with `eprintln!` macro [#73] +- Change `Return` to `Back` in the menu + +## [0.11.0] - 2022-08-17 + +### Added + +- New public `Wallet` struct exposing all wallet operations as library [#54] +- New `Address` type to identify and work with addresses [#54] +- Logging capabilities with customizable `log_level` and `log_type` [#11] + +### Changed + +- Project is now a public facing library [#54] +- Our reference implementation is included under `src/bin` [#54] +- UX flow is now address-based to match that of the web wallet [#59] +- Anything that's not strictly program output is redirected to stderr [#11] + +## [0.10.0] - 2022-07-06 + +### Added + +- Add `src/bin` to gather the module related to the I/O ops [#51] +- Add `autobins` to Cargo.toml to prevent bins auto discovery [#51] +- Add `[lib]` and `[[bin]]` sections to Cargo.toml to decouple bin and lib [#51] +- Add `src/bin/io` to gather all modules related to I/O [#51] +- Add `status` mod as temp workaround to make the lib compile [#51] +- Add `actions` mod with all the actions previously in `main` [#51] + +### Changed + +- Rename `src/mod.rs` to `src/lib.rs` to be compliant with 2018 edition [#51] +- Refactor `main` to be more readable [#51] +- Update imports in the code to reflect the new files structure [#51] + +## [0.9.0] - 2022-05-25 + +### Added + +- Flag `--spendable` to `Balance` command [#40] +- Flag `--reward` to `StakeInfo` command [#40] + +### Changed + +- Commands run in headless mode do not provide dynamic status updates [#40] + +## [0.8.0] - 2022-05-04 + +### Added + +- Block trait for easier blocking on futures [#32] +- Withdraw reward command [#26] + +### Changed + +- Upgraded cache implementation to use `microkelvin` instead of `rusqlite` [#32] +- Use streaming `GetNotes` call instead of `GetNotesOwnedBy` [#32] +- Enhance address validity checks on interactive mode [#28] +- Prevent exit on prepare command errors [#27] +- Adapt balance to the new State [#24] +- Rename `withdraw-stake` to `unstake` [#26] +- Introduce Dusk type for currency management [#4] + +### Fixed + +- Fix cache bug preventing adding all notes to it [#35] +- Fix address validation by parsing address first [#35] + +## [0.7.0] - 2022-04-13 + +### Added + +- Notes cache [#650] +- Settings can be loaded from a config file [#637] +- Create config file if not exists [#647] +- Notify user when defaulting configuration [#655] +- Implementation for `State`'s `fetch_block_height` [#651] +- Option to wait for transaction confirmation [#680] +- Default to TCP/IP on Windows [#6] + +### Changed + +- Export consensus public key as binary +- Interactive mode allows for directory and wallet file overriding [#630] +- Client errors implemented, Rusk error messages displayed without metadata [#629] +- Transactions from wallets with no balance are halted immediately [#631] +- Rusk and prover connections decoupled [#659] +- Use upper-case DUSK for units of measure [#672] +- Use DUSK as unit for stake and transfer [#668] + +### Fixed + +- `data_dir` can be properly overriden [#656] +- Invalid configuration should not fallback into default [#670] +- Prevent interactive process from quitting on wallet execution errors [#18] + +## [0.5.2] - 2022-03-01 + +### Added + +- Optional configuration item to specify the prover URL [#612] +- Get Stake information subcommand [#619] + +## [0.5.1] - 2022-02-26 + +### Added + +- Display progress info about transaction preparation [#600] +- Display confirmation before sending a transaction [#602] + +### Changed + +- Use hex-encoded tx hashes on user-facing messages [#597] +- Open or display explorer URL on succesful transactions [#598] + +## [0.5.0] - 2022-02-26 + +### Changed + +- Update `canonical` across the entire Rusk stack [#606] + +## [0.4.0] - 2022-02-17 + +### Changed + +- Use the Dusk denomination from `rusk-abi` [#582] + +## [0.3.1] - 2022-02-17 + +### Changed + +- Default to current wallet directory for exported keys [#574] +- Add an additional plain text file with the base58-encoded public key [#574] + +## [0.3.0] - 2022-02-17 + +### Removed + +- Stake expiration [#566] + +## [0.2.4] - 2022-02-15 + +### Added + +- Allow for headless wallet creation [#569] + +### Changed + +- TX output in wallet instead of within client impl + +## [0.2.3] - 2022-02-10 + +### Added + +- Pretty print wallet-core errors [#554] + +## [0.2.2] - 2022-02-10 + +### Changed + +- Interactive mode prevents sending txs with insufficient balance [#547] + +### Fixed + +- Panic when UDS socket is not available + +## [0.2.1] - 2022-02-09 + +### Changed + +- Default `gas_price` from 0 to 0.001 Dusk [#539] + +## [0.2.0] - 2022-02-04 + +### Added + +- Wallet file encoding version [#524] + +### Changed + +- Default to UDS transport [#520] + +## [0.1.3] - 2022-02-01 + +### Added + +- Offline mode [#499] [#507] +- Live validation to user interactive input +- Improved navigation through interactive menus +- "Pause" after command outputs for better readability + +### Fixed + +- Bad UX when creating an already existing wallet with default name + +## [0.1.2] - 2022-01-31 + +### Added + +- Enable headless mode [#495] +- Introduce interactive mode by default [#492] +- Add Export command for BLS PubKeys [#505] + +## [0.1.1] - 2022-01-27 + +### Added + +- Wallet file encryption using AES [#482] + +### Changed + +- Common `Error` struct for this crate [#479] +- Password hashing using blake3 + +### Removed + +- Recovery password + +## [0.1.0] - 2022-01-25 + +### Added + +- `rusk-wallet` crate to workspace +- Argument and command parsing, with help output +- Interactive prompts for authentication +- BIP39 mnemonic support for recovery phrase +- Implementation of `Store` trait from `wallet-core` +- Implementation of `State` and `Prover` traits from `wallet-core` + +[#248]: https://github.com/dusk-network/wallet-cli/issues/248 +[#244]: https://github.com/dusk-network/wallet-cli/issues/244 +[#243]: https://github.com/dusk-network/wallet-cli/issues/243 +[#238]: https://github.com/dusk-network/wallet-cli/issues/238 +[#235]: https://github.com/dusk-network/wallet-cli/issues/235 +[#231]: https://github.com/dusk-network/wallet-cli/issues/231 +[#226]: https://github.com/dusk-network/wallet-cli/issues/226 +[#222]: https://github.com/dusk-network/wallet-cli/issues/222 +[#218]: https://github.com/dusk-network/wallet-cli/issues/218 +[#214]: https://github.com/dusk-network/wallet-cli/issues/214 +[#210]: https://github.com/dusk-network/wallet-cli/issues/210 +[#98]: https://github.com/dusk-network/wallet-cli/issues/98 +[#179]: https://github.com/dusk-network/wallet-cli/issues/179 +[#204]: https://github.com/dusk-network/wallet-cli/issues/204 +[#182]: https://github.com/dusk-network/wallet-cli/issues/182 +[#198]: https://github.com/dusk-network/wallet-cli/issues/198 +[#176]: https://github.com/dusk-network/wallet-cli/issues/176 +[#162]: https://github.com/dusk-network/wallet-cli/issues/162 +[#163]: https://github.com/dusk-network/wallet-cli/issues/163 +[#151]: https://github.com/dusk-network/wallet-cli/issues/151 +[#144]: https://github.com/dusk-network/wallet-cli/issues/144 +[#133]: https://github.com/dusk-network/wallet-cli/issues/133 +[#132]: https://github.com/dusk-network/wallet-cli/issues/132 +[#128]: https://github.com/dusk-network/wallet-cli/issues/128 +[#105]: https://github.com/dusk-network/wallet-cli/issues/105 +[#124]: https://github.com/dusk-network/wallet-cli/issues/124 +[#123]: https://github.com/dusk-network/wallet-cli/issues/123 +[#116]: https://github.com/dusk-network/wallet-cli/issues/116 +[#114]: https://github.com/dusk-network/wallet-cli/issues/114 +[#165]: https://github.com/dusk-network/wallet-cli/issues/165 +[#49]: https://github.com/dusk-network/wallet-cli/issues/49 +[#46]: https://github.com/dusk-network/wallet-cli/issues/46 +[#87]: https://github.com/dusk-network/wallet-cli/issues/87 +[#86]: https://github.com/dusk-network/wallet-cli/issues/86 +[#83]: https://github.com/dusk-network/wallet-cli/issues/83 +[#84]: https://github.com/dusk-network/wallet-cli/issues/84 +[#72]: https://github.com/dusk-network/wallet-cli/issues/72 +[#57]: https://github.com/dusk-network/wallet-cli/issues/57 +[#70]: https://github.com/dusk-network/wallet-cli/issues/70 +[#73]: https://github.com/dusk-network/wallet-cli/issues/73 +[#68]: https://github.com/dusk-network/wallet-cli/issues/68 +[#11]: https://github.com/dusk-network/wallet-cli/issues/11 +[#59]: https://github.com/dusk-network/wallet-cli/issues/59 +[#54]: https://github.com/dusk-network/wallet-cli/issues/54 +[#51]: https://github.com/dusk-network/wallet-cli/issues/51 +[#40]: https://github.com/dusk-network/wallet-cli/issues/40 +[#35]: https://github.com/dusk-network/wallet-cli/issues/35 +[#32]: https://github.com/dusk-network/wallet-cli/issues/32 +[#28]: https://github.com/dusk-network/wallet-cli/issues/28 +[#27]: https://github.com/dusk-network/wallet-cli/issues/27 +[#26]: https://github.com/dusk-network/wallet-cli/issues/26 +[#24]: https://github.com/dusk-network/wallet-cli/issues/24 +[#18]: https://github.com/dusk-network/wallet-cli/issues/18 +[#12]: https://github.com/dusk-network/wallet-cli/issues/12 +[#6]: https://github.com/dusk-network/wallet-cli/issues/6 +[#56]: https://github.com/dusk-network/wallet-cli/issues/56 +[#143]: https://github.com/dusk-network/wallet-cli/issues/143 +[#4]: https://github.com/dusk-network/wallet-cli/issues/4 +[#680]: https://github.com/dusk-network/rusk/issues/680 +[#672]: https://github.com/dusk-network/rusk/issues/672 +[#670]: https://github.com/dusk-network/rusk/issues/670 +[#668]: https://github.com/dusk-network/rusk/issues/668 +[#659]: https://github.com/dusk-network/rusk/issues/659 +[#656]: https://github.com/dusk-network/rusk/issues/656 +[#655]: https://github.com/dusk-network/rusk/issues/655 +[#651]: https://github.com/dusk-network/rusk/issues/651 +[#650]: https://github.com/dusk-network/rusk/issues/650 +[#647]: https://github.com/dusk-network/rusk/issues/647 +[#637]: https://github.com/dusk-network/rusk/issues/637 +[#631]: https://github.com/dusk-network/rusk/issues/631 +[#630]: https://github.com/dusk-network/rusk/issues/630 +[#629]: https://github.com/dusk-network/rusk/issues/629 +[#619]: https://github.com/dusk-network/rusk/issues/619 +[#612]: https://github.com/dusk-network/rusk/issues/612 +[#606]: https://github.com/dusk-network/rusk/issues/606 +[#602]: https://github.com/dusk-network/rusk/issues/602 +[#600]: https://github.com/dusk-network/rusk/issues/600 +[#598]: https://github.com/dusk-network/rusk/issues/598 +[#597]: https://github.com/dusk-network/rusk/issues/597 +[#582]: https://github.com/dusk-network/rusk/issues/582 +[#574]: https://github.com/dusk-network/rusk/issues/574 +[#569]: https://github.com/dusk-network/rusk/issues/569 +[#566]: https://github.com/dusk-network/rusk/issues/566 +[#554]: https://github.com/dusk-network/rusk/issues/554 +[#547]: https://github.com/dusk-network/rusk/issues/547 +[#539]: https://github.com/dusk-network/rusk/issues/539 +[#520]: https://github.com/dusk-network/rusk/issues/520 +[#507]: https://github.com/dusk-network/rusk/issues/507 +[#505]: https://github.com/dusk-network/rusk/issues/505 +[#499]: https://github.com/dusk-network/rusk/issues/499 +[#495]: https://github.com/dusk-network/rusk/issues/495 +[#492]: https://github.com/dusk-network/rusk/issues/492 +[#482]: https://github.com/dusk-network/rusk/issues/482 +[#479]: https://github.com/dusk-network/rusk/issues/479 +[#158]: https://github.com/dusk-network/wallet-cli/pull/158 +[#169]: https://github.com/dusk-network/wallet-cli/pull/169 +[#173]: https://github.com/dusk-network/wallet-cli/pull/173 +[#173]: https://github.com/dusk-network/wallet-cli/pull/190 + + + +[unreleased]: https://github.com/dusk-network/wallet-cli/compare/v0.22.1...HEAD +[0.22.1]: https://github.com/dusk-network/wallet-cli/compare/v0.22.0...v0.22.1 +[0.22.0]: https://github.com/dusk-network/wallet-cli/compare/v0.21.0...v0.22.0 +[0.21.0]: https://github.com/dusk-network/wallet-cli/compare/v0.20.1...v0.21.0 +[0.20.1]: https://github.com/dusk-network/wallet-cli/compare/v0.20.0...v0.20.1 +[0.20.0]: https://github.com/dusk-network/wallet-cli/compare/v0.19.1...v0.20.0 +[0.19.1]: https://github.com/dusk-network/wallet-cli/compare/v0.19.0...v0.19.1 +[0.19.0]: https://github.com/dusk-network/wallet-cli/compare/v0.18.2...v0.19.0 +[0.18.2]: https://github.com/dusk-network/wallet-cli/compare/v0.18.1...v0.18.2 +[0.18.1]: https://github.com/dusk-network/wallet-cli/compare/v0.18.0...v0.18.1 +[0.18.0]: https://github.com/dusk-network/wallet-cli/compare/v0.17.0...v0.18.0 +[0.17.0]: https://github.com/dusk-network/wallet-cli/compare/v0.16.0...v0.17.0 +[0.16.0]: https://github.com/dusk-network/wallet-cli/compare/v0.15.0...v0.16.0 +[0.15.0]: https://github.com/dusk-network/wallet-cli/compare/v0.14.1...v0.15.0 +[0.14.1]: https://github.com/dusk-network/wallet-cli/compare/v0.14.0...v0.14.1 +[0.14.0]: https://github.com/dusk-network/wallet-cli/compare/v0.13.0...v0.14.0 +[0.13.0]: https://github.com/dusk-network/wallet-cli/compare/v0.12.0...v0.13.0 +[0.12.0]: https://github.com/dusk-network/wallet-cli/compare/v0.11.1...v0.12.0 +[0.11.1]: https://github.com/dusk-network/wallet-cli/compare/v0.11.0...v0.11.1 +[0.11.0]: https://github.com/dusk-network/wallet-cli/compare/v0.10.0...v0.11.0 +[0.10.0]: https://github.com/dusk-network/wallet-cli/compare/v0.9.0...v0.10.0 +[0.9.0]: https://github.com/dusk-network/wallet-cli/compare/v0.8.0...v0.9.0 +[0.8.0]: https://github.com/dusk-network/wallet-cli/compare/v0.7.0...v0.8.0 +[0.7.0]: https://github.com/dusk-network/wallet-cli/compare/v0.5.2...v0.7.0 +[0.5.2]: https://github.com/dusk-network/wallet-cli/compare/v0.5.1...v0.5.2 +[0.5.1]: https://github.com/dusk-network/wallet-cli/compare/v0.5.0...v0.5.1 +[0.5.0]: https://github.com/dusk-network/wallet-cli/compare/v0.4.0...v0.5.0 +[0.4.0]: https://github.com/dusk-network/wallet-cli/compare/v0.3.1...v0.4.0 +[0.3.1]: https://github.com/dusk-network/wallet-cli/compare/v0.3.0...v0.3.1 +[0.3.0]: https://github.com/dusk-network/wallet-cli/compare/v0.2.5...v0.3.0 +[0.2.5]: https://github.com/dusk-network/wallet-cli/compare/v0.2.4...v0.2.5 +[0.2.4]: https://github.com/dusk-network/wallet-cli/compare/v0.2.3...v0.2.4 +[0.2.3]: https://github.com/dusk-network/wallet-cli/compare/v0.2.2...v0.2.3 +[0.2.2]: https://github.com/dusk-network/wallet-cli/compare/v0.2.1...v0.2.2 +[0.2.1]: https://github.com/dusk-network/wallet-cli/compare/v0.2.0...v0.2.1 +[0.2.0]: https://github.com/dusk-network/wallet-cli/compare/v0.1.3...v0.2.0 +[0.1.3]: https://github.com/dusk-network/wallet-cli/compare/v0.1.2...v0.1.3 +[0.1.2]: https://github.com/dusk-network/wallet-cli/compare/v0.1.1...v0.1.2 +[0.1.1]: https://github.com/dusk-network/wallet-cli/compare/v0.1.0...v0.1.1 +[0.1.0]: https://github.com/dusk-network/wallet-cli/releases/tag/v0.1.0 diff --git a/rusk-wallet/Cargo.toml b/rusk-wallet/Cargo.toml new file mode 100644 index 0000000000..0bb2c41335 --- /dev/null +++ b/rusk-wallet/Cargo.toml @@ -0,0 +1,75 @@ +[package] +name = "dusk-wallet" +version = "0.22.1" +edition = "2021" +autobins = false +description = "A library providing functionalities to create wallets compatible with Dusk Network" +categories = ["cryptography", "cryptography::cryptocurrencies"] +keywords = ["wallet", "dusk", "cryptocurrency", "blockchain"] +repository = "https://github.com/dusk-network/wallet-cli" +license = "MPL-2.0" +exclude = [".github/*", ".gitignore"] + +[[bin]] +name = "rusk-wallet" +path = "src/bin/main.rs" + +[dependencies] +clap = { version = "3.1", features = ["derive", "env"] } +thiserror = "1.0" +anyhow = "1.0" +tokio = { version = "1.15", features = ["full"] } +serde = { version = "1.0", features = ["derive"] } +url = { version = "2", features = ["serde"] } +async-trait = "0.1" +block-modes = "0.8" +serde_json = "1.0" +hex = "0.4" +tiny-bip39 = "0.8" +crossterm = "0.23" +rand_core = "0.6" +requestty = "0.5.0" +futures = "0.3" +base64 = "0.13" +crypto = "0.3" +whoami = "1.2" +blake3 = "1.3" +sha2 = "0.10.7" +toml = "0.5" +open = "2.1" +dirs = "4.0" +bs58 = "0.4" +rand = "0.8" +aes = "0.7" +rocksdb = "0.22" +flume = "0.10.14" +reqwest = { version = "0.11", features = ["stream"] } + +dusk-wallet-core = "0.24.0-plonk.0.16-rc.2" +dusk-bytes = "0.1" +dusk-pki = "0.13" +rusk-abi = { version = "0.12.0-rc", default-features = false } +phoenix-core = { version = "0.21", features = ["alloc"] } +dusk-schnorr = { version = "0.14", default-features = false } +dusk-poseidon = "0.31" +dusk-plonk = "0.16" +dusk-bls12_381-sign = { version = "0.5", default-features = false } +ff = { version = "0.13", default-features = false } +poseidon-merkle = "0.3" + +tracing = "0.1" +tracing-subscriber = { version = "0.3.0", features = [ + "fmt", + "env-filter", + "json", +] } + +rkyv = { version = "=0.7.39", default-features = false } + +konst = "0.3" + +[dev-dependencies] +tempfile = "3.2" + +[profile.release] +overflow-checks = true diff --git a/rusk-wallet/LICENSE b/rusk-wallet/LICENSE new file mode 100644 index 0000000000..a612ad9813 --- /dev/null +++ b/rusk-wallet/LICENSE @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/rusk-wallet/Makefile b/rusk-wallet/Makefile new file mode 100644 index 0000000000..9e15f7268d --- /dev/null +++ b/rusk-wallet/Makefile @@ -0,0 +1,13 @@ +help: ## Display this help screen + @grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' + +build: ## Build the wallet + cargo b --release + +install: build + cargo install --path . + +test: build ## Run wallet tests + cargo test --release + +.PHONY: build test help diff --git a/rusk-wallet/README.md b/rusk-wallet/README.md new file mode 100644 index 0000000000..2faa9661e3 --- /dev/null +++ b/rusk-wallet/README.md @@ -0,0 +1,9 @@ +[![Repository](https://img.shields.io/badge/github-dusk--wallet-purple?logo=github)](https://github.com/dusk-network/wallet-cli) +![Build Status](https://github.com/dusk-network/wallet-cli/workflows/Continuous%20integration/badge.svg) +[![Documentation](https://img.shields.io/badge/docs-dusk--wallet-orange?logo=rust)](https://docs.rs/dusk-wallet/) + +# Dusk Wallet + +Library providing functionalities to create wallets compatible with Dusk Network + +This library is used to implement the official [Dusk CLI wallet](https://github.com/dusk-network/wallet-cli/blob/main/src/bin/README.md). diff --git a/rusk-wallet/default.config.toml b/rusk-wallet/default.config.toml new file mode 100644 index 0000000000..f2a9cd95d1 --- /dev/null +++ b/rusk-wallet/default.config.toml @@ -0,0 +1,12 @@ +state = "https://nodes.dusk.network" +prover = "https://provers.dusk.network" +explorer = "https://explorer.dusk.network/transactions/transaction/?id=" + +[network.devnet] +state = "https://devnet.nodes.dusk.network" +prover = "https://devnet.provers.dusk.network" +explorer = "https://explorer.dusk.network/transactions/transaction/?id=" + +[network.local] +state = "http://127.0.0.1:8080" +prover = "http://127.0.0.1:8080" diff --git a/rusk-wallet/src/bin/README.md b/rusk-wallet/src/bin/README.md new file mode 100644 index 0000000000..3a567dc20b --- /dev/null +++ b/rusk-wallet/src/bin/README.md @@ -0,0 +1,112 @@ +# Dusk Wallet CLI + +A user-friendly, reliable command line interface to the Dusk wallet! + +``` +USAGE: + rusk-wallet [OPTIONS] [SUBCOMMAND] + +OPTIONS: + -p, --profile