Skip to content

Shielded: expose fresh diversified Orchard payment addresses in the wallet API #5869

Closed

Description

@romchornyi

Problem

The wallet API exposes only the default Orchard payment address (diversifier index 0): PlatformWallet::shielded_default_address, FFI platform_wallet_manager_shielded_default_address, SwiftDashSDK PlatformWalletManager.shieldedDefaultAddress(walletId:account:). A wallet that shows that address on its Receive screen hands the same address to every payer, so payers can be linked to each other.

Orchard addresses are diversified: one incoming viewing key detects notes sent to any address of the account's external scope. The building blocks already exist:

  • wallet/shielded/keys.rs address_at(index) derives the external-scope address at a diversifier index.
  • Note detection is IVK trial decryption, so no scan change is needed to receive on a diversified address.
  • resolve_shield_recipient already rejects an own diversified address as a third-party recipient (own_diversified_address_as_recipient_is_rejected).

Proposal

Expose a fresh external-scope address per account through the wallet, FFI and SwiftDashSDK, next to shielded_default_address. For example shielded_fresh_address(account) -> Option<[u8; 43]>, with the same "not bound → None" contract.

How to pick the index (to decide here):

  • Random diversifier index (88-bit): stateless and unlinkable, with no persistence and nothing to restore, since the IVK finds every note.
  • Persisted counter: indices stay enumerable, which needs a stored next index per account and restore handling.

Tests: the returned address differs between calls, round-trips through the existing raw-43 encoding, and a note sent to it is found by the existing sync and counted in the account's balance and activity.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions