Wallet accepts contract address as seed and initializes wallet

While testing a Midnight application, I accidentally pasted a contract address into the wallet seed input field instead of the seed used to sync the wallet.

Instead of rejecting the input, the wallet initialized successfully and generated:

  • a shielded address

  • an unshielded address

  • a dust address

The wallet then synced normally (empty state, since there were no notes associated with the derived addresses).

Steps to Reproduce

  1. Start wallet initialization / sync

  2. In the seed input field, paste a contract address (e.g. 32ce...) instead of a seed

  3. Proceed with wallet setup

Observed Behavior

The wallet initializes successfully and derives addresses even though the input is not a valid mnemonic or seed.

Expected Behavior

Either:

  • the wallet validates the seed format and rejects invalid inputs, or

  • the UI clearly states that arbitrary input strings are accepted as seed entropy

Notes

This behavior may be intentional if the wallet allows arbitrary entropy for deterministic wallet generation. However, it could potentially confuse users if they accidentally paste something other than their seed and unknowingly generate a new wallet.

great question!
This is expected behavior at the SDK level. HDWallet.fromSeed() in @midnight-ntwrk/wallet-sdk-hd accepts any valid length byte array and derives addresses deterministically. It doesn’t enforce mnemonic validation.

validateMnemonic:

That said, you raise a good UX point. It’s not obvious from the SDK that validation is the app’s responsibility, and there’s nothing stopping a user from pasting the wrong thing and ending up with a ghost wallet. Worth flagging as a docs/DX improvement.

2 Likes