SatoshiQaziMuhammed 8549501a62 Embedded PezkuwiChain light client with RPC fallback (Zagros) (#30)
* Add pezkuwi-light: embedded PezkuwiChain light client binding

A JNI binding around the PezkuwiChain fork of smoldot (pezkuwichain/smoldot),
which verifies PezkuwiChain blocks under the chain's sovereign constants.
Upstream smoldot cannot.

The wallet reaches its chains through JSON-RPC WebSockets, so the light
client is served the same way: a WebSocket server bound to 127.0.0.1 on a
random port. Every path carries a random per-process token:
ws://127.0.0.1:<port>/<token>/<chain key>.
- A wrong token, a missing token or an unregistered chain is refused during
  the handshake with 404.
- Each connection adds its own smoldot chain instance. smoldot shares the
  sync between instances of the same chain.
- Each registered chain's finalized state is written to disk every minute,
  through a temporary file and a rename. The next start resumes from it.

Kotlin surface: PezkuwiLight.start(dir), addChain(key, spec, relayKey),
chainUrl(base, key). The module is not yet a dependency of the app.

Tested against the live Zagros testnet, with the relay chain and People
specs:
- dks.kurd resolves through NavnisanApi_resolve to the same bytes the full
  node returns.
- An unregistered name returns 0x00.
- The saved state lets a new client resolve.
- Reverting the token check turns the routing test red.

The library builds for arm, arm64, x86 and x86_64 with 16 KB aligned LOAD
segments (0x4000).

* pezkuwi-light: secure WebSockets and the app's resolver for peers

smoldot's DefaultPlatform cannot open wss connections and resolves names
through the system resolver. Where our domains are blocked, both fail: a
poisoned DNS answer decides where the client connects, and plain libp2p
TCP is recognisable on the wire.

PezkuwiPlatform replaces it:
- Opens /dns/<host>/tcp/<port>/wss over TLS, using rustls with the ring
  provider and the Mozilla roots, so a connection looks like any HTTPS
  WebSocket.
- Resolves every name through a Resolve trait. On Android this is the
  app's HostResolver, called over JNI, so the light client follows the
  same DNS policy as the rest of the app (EncryptedFirstDns: DoH first,
  system resolver last).
- Tries IPv4 before IPv6, and gives up on an address after 10 s.
- With setSecureOnly(true) it opens nothing but secure WebSockets. Peers
  found through the DHT advertise plain TCP too, and none of them is used.

The peer's identity is still checked end to end by libp2p Noise.

Tested against live Zagros with only the /wss boot nodes in the specs and
secure-only on: relay and People sync and dks.kurd resolves to the full
node's bytes. Nail: with secure-only on and the specs' plain TCP boot
nodes, nothing syncs and the test times out red.

* pezkuwi-light: measure a start from the saved database in its own process

An app launch resumes from the database in a fresh process. The in-process
warm measurement ran beside a client that was still syncing, so it did not
show that case.

The new ignored test resolves dks.kurd after a start from the database in
PEZKUWI_LIGHT_DB_DIR. On the first run, when no database exists yet, it
syncs and waits for a save.

The tests also log through env_logger, so RUST_LOG shows smoldot's own
timeline when a measurement needs explaining.

* Fall back to the embedded light client when every Zagros RPC node fails

ChainConnection stays on RPC first. A light client loads the peer-to-peer
nodes, and those nodes have a fixed number of light client slots, so RPC
is the default.

When every RPC node of a supported chain has failed in a row, the
connection moves to the light client, served at
ws://127.0.0.1:<port>/<token>/<genesis>. RPC is retried after one minute.
The wait doubles up to 15 minutes while RPC keeps failing. The connection
returns to RPC as soon as a retry connects. If the light client cannot
start, or its own connection fails, the connection stays on RPC.

LightFallbackPolicy holds these rules. Its tests cover each one, and five
mutations of the policy each turn a test red. ChainConnection handles RPC
node changes, socket states and a 15 s tick as one event stream, one event
at a time, so a node change and a fallback cannot race.

LightClients starts the client on first use. A wallet whose RPC answers
never runs it. LightClients registers Zagros and Zagros People, the
chains the fork can verify, from specifications bundled at build time
from pezkuwi-wallet-utils light-client/: the genesis state root, the /wss
boot nodes on 443 first, and the relay checkpoint. Peer names resolve
through EncryptedFirstDns, which CommonApi now exposes to the runtime
module.

* pezkuwi-light: strip in the cargo profile

The Android Gradle plugin packages a native library it cannot strip as it
is. With debug info, libpezkuwi_light.so is 147 MB per ABI. Stripped it is
8.6 MB.

The first CI build of this library ran out of disk: four targets with
debug info filled the runner. Stripping in the release profile, with debug
info off, fixes both:
- The library is 8.6 MB for arm64 and keeps its three JNI symbols.
- The build directory is 389 MB per target.

* Log the light client fallback's decisions

Each RPC failure the fallback sees, the light client URL it got, and each
RPC retry are logged under LightFallback. The first device run on a
blocked Zagros RPC showed no fallback and no trace of where it stopped.
2026-11-03 03:30:15 +04:00
2026-02-12 05:19:41 +03:00
2026-02-12 05:19:41 +03:00
2026-02-12 05:19:41 +03:00

Pezkuwi Wallet Android

Next generation mobile wallet for Pezkuwichain and the Polkadot ecosystem.

About

Pezkuwi Wallet is a next-generation mobile application for the Pezkuwichain and Polkadot ecosystem. It provides a transparent, community-oriented wallet experience with convenient UX/UI, fast performance, and strong security.

Key Features:

  • Full Pezkuwichain support (HEZ & PEZ tokens)
  • Full Polkadot ecosystem compatibility
  • Staking, Governance, DeFi
  • NFT support
  • Cross-chain transfers (XCM)
  • Hardware wallet support (Ledger, Polkadot Vault)
  • WalletConnect v2
  • Push notifications

Native Tokens

Token Network Description
HEZ Relay Chain Native token for fees and staking
PEZ Asset Hub Governance token

Build Instructions

Clone Repository

git clone git@github.com:pezkuwichain/pezkuwi-wallet-android.git

Install NDK

Install NDK version 26.1.10909125 from SDK Manager: Tools -> SDK Manager -> SDK Tools -> NDK (Side by Side)

Install Rust

Install Rust by following official instructions.

Add Android build targets:

rustup target add armv7-linux-androideabi
rustup target add i686-linux-android
rustup target add x86_64-linux-android
rustup target add aarch64-linux-android

Update local.properties

Add the following lines to your local.properties:

ACALA_PROD_AUTH_TOKEN=mock
ACALA_TEST_AUTH_TOKEN=mock
CI_KEYSTORE_KEY_ALIAS=mock
CI_KEYSTORE_KEY_PASS=mock
CI_KEYSTORE_PASS=mock
DEBUG_GOOGLE_OAUTH_ID=mock
RELEASE_GOOGLE_OAUTH_ID=mock
DWELLIR_API_KEY=mock
EHTERSCAN_API_KEY_ETHEREUM=mock
EHTERSCAN_API_KEY_MOONBEAM=mock
EHTERSCAN_API_KEY_MOONRIVER=mock
INFURA_API_KEY=mock
MERCURYO_PRODUCTION_SECRET=mock
MERCURYO_TEST_SECRET=mock
MOONBEAM_PROD_AUTH_TOKEN=mock
MOONBEAM_TEST_AUTH_TOKEN=mock
MOONPAY_PRODUCTION_SECRET=mock
MOONPAY_TEST_SECRET=mock
WALLET_CONNECT_PROJECT_ID=mock

Note: Firebase and Google-related features (Notifications, Cloud Backups) require proper configuration.

Build Types

  • debug: Uses fixed keystore for Google services
  • debugLocal: Uses your local debug keystore
  • release: Production build

Supported Languages

  • English
  • Turkish (Türkçe)
  • Kurdish Kurmanji (Kurmancî)
  • Spanish (Español)
  • French (Français)
  • German (Deutsch)
  • Russian (Русский)
  • Japanese (日本語)
  • Chinese (中文)
  • Korean (한국어)
  • Portuguese (Português)
  • Vietnamese (Tiếng Việt)
  • And more...

Resources

License

Pezkuwi Wallet Android is available under the Apache 2.0 license. See the LICENSE file for more info.

Based on Nova Wallet (https://novawallet.io) - © Novasama Technologies GmbH

© Dijital Kurdistan Tech Institute 2026

S
Description
No description provided
Readme
200 MiB
1 Watchers 0 Forks
Languages
Kotlin 99.2%
Rust 0.6%
Java 0.1%