Skip to content

gRPC Error 14 (UNAVAILABLE) - Cannot Connect to lightwalletd on iOS and Android #64

@CascadiaTech

Description

@CascadiaTech

Description

The synchronizer fails to establish a connection to the lightwalletd server with gRPC error code 14 (UNAVAILABLE) on both iOS (physical device) and Android (emulator). This appears to be a TLS/certificate validation issue affecting the gRPC client in both platforms.

Environment

  • react-native-zcash version: 0.10.2
  • zcash-android-sdk version: 2.4.0 (from package dependencies)
  • React Native version: 0.83.0
  • Platform: Both iOS (physical device) and Android (emulator API 35)
  • Network: testnet
  • Server: lightwalletd.testnet.electriccoin.co:9067

Steps to Reproduce

  1. Initialize synchronizer with testnet configuration:
const config = {
  networkName: "testnet",
  defaultHost: "lightwalletd.testnet.electriccoin.co",
  defaultPort: 9067,
  mnemonicSeed: "<24-word-seed>",
  alias: "test-wallet",
  birthdayHeight: 2800000,
  newWallet: true
};

await RNZcash.initialize(config);
  1. Observe synchronizer status events
  2. Synchronizer immediately transitions to DISCONNECTED state

Expected Behavior

Synchronizer should connect to lightwalletd server and begin syncing blocks.

Actual Behavior

Synchronizer fails with gRPC error 14 (UNAVAILABLE). Status changes:

  • DISCONNECTEDINITIALIZINGDISCONNECTED

Logs (Android)

Key error messages:

W Twig: CompactBlockDownloader.invokeSuspend(): WARNING: reconnecting to server in response to failure (retry #1)
W Twig: cash.z.ecc.android.sdk.exception.LightWalletException$GetServerInfoException: 
  Failed to get data about currently connected lightwalletd server with code: 14 due to: -
Caused by: java.lang.Throwable: Communication failure with details: 14.

Network connectivity verification (from Android emulator):

# Ping test - SUCCESS
PING lightwalletd.testnet.electriccoin.co (34.149.161.34) 56(84) bytes of data.
64 bytes from 34.161.149.34.bc.googleusercontent.com (34.149.161.34): icmp_seq=1 ttl=255 time=27.2 ms
3 packets transmitted, 3 received, 0% packet loss

# Port connectivity test - SUCCESS  
Port 9067 open

The network layer works perfectly - DNS resolves, ping succeeds, and port 9067 is reachable. This strongly suggests a TLS/certificate validation issue at the gRPC layer.

Additional Context

  1. Cross-platform issue: Both iOS (physical device) and Android (emulator) exhibit identical behavior, suggesting this is not platform-specific but related to the underlying gRPC client configuration.

  2. Network security config (Android): Attempted to add explicit trust for lightwalletd servers and system certificates:

<network-security-config>
    <base-config cleartextTrafficPermitted="false">
        <trust-anchors>
            <certificates src="system" />
            <certificates src="user" />
        </trust-anchors>
    </base-config>
</network-security-config>

This did not resolve the issue.

  1. Endpoint configuration: The LightWalletEndpoint is created with secure: true (line 62 in RNZcashModule.kt):
val endpoint = LightWalletEndpoint(defaultHost, defaultPort, true)

Questions

  1. Are there known TLS/certificate issues with zcash-android-sdk 2.4.0?
  2. Does the gRPC client require additional configuration for certificate validation?
  3. Has the lightwalletd server certificate chain changed recently?
  4. Are there any alternative lightwalletd servers recommended for testing?

Potential Root Causes

Based on investigation:

  • gRPC TLS handshake failure: The gRPC client can reach the server but cannot complete the TLS handshake
  • Certificate chain validation: The client may not trust the server's certificate or intermediate CA
  • Missing TLS configuration: The SDK might need explicit TLS configuration that's not being set

Any guidance on debugging or resolving this would be greatly appreciated! I am still unsure if it is just from myself not undserstanding exactly our to initalize the syncronizer or what.

Appreciate it

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