NIGHT exists as both a shielded and an unshielded asset — different token
types in different pools, not the same balance shown twice.
This page covers embedded Midnight wallets (created via social/email
login). For wallets connected through the injected 1am browser extension,
see Using Midnight wallets.
Enabling Midnight
1
Enable Midnight in the dashboard
Enable Midnight under Chains & Networks.
2
Enable Private Key Exports in the dashboard
Midnight embedded wallets internally derive signing keys via the key export mechanism. Private Key Exports must be enabled in your environment settings or all wallet operations (balance reads, signing, transfers) will fail with a 403 error.Go to Embedded Wallets → Security in the Dynamic dashboard and toggle Private Key Exports on.
3
Install the connector
4
Add the embedded connector to DynamicContextProvider
Use
DynamicWaasMidnightConnectors for embedded (MPC) wallets.React
Getting a Midnight wallet
Narrow a wallet withisMidnightWallet before calling Midnight methods. The
guard both confirms the chain and gives you the typed wallet — all operations
below are called directly on it.
React
Reading balances
getFormattedBalances() returns display-ready strings for all three surfaces in
one call:
React
dustSyncing to know when all surfaces are ready:
React
React
getBalances(), which returns { shielded, unshielded, dust } keyed by token
type, with bigint values:
React
The first balance read on a device runs a one-time background sync (the DUST
state can take a while to fold). Subsequent reads resume from a local
checkpoint and return quickly.
Signing a message
React
Sending tokens
Embedded Midnight wallets support both unshielded (public) and shielded (private) transfers for NIGHT and other tokens. Amounts are in the token’s smallest (atomic) unit unlesstoken.decimals is set.
Simple send
sendBalance builds, proves, and broadcasts in one call, and routes to the
right pool automatically based on the recipient prefix (mn_shield… →
shielded, otherwise unshielded). It returns the transaction hash.
React
sendBalance routes based on the recipient address prefix: mn_addr draws
from the unshielded pool; mn_shield draws from the shielded pool. Cross-pool
transfers (unshielded → shielded or vice versa) are not supported.The optional token parameter lets you send tokens other than native NIGHT.
Pass token.address with the token type identifier and token.decimals if
the amount needs decimal conversion. Omit token entirely for NIGHT transfers.Step-by-step send
For more control, run the three steps yourself — build → sign → submit. This lets you inspect or persist the serialized transaction between steps. Settype to 'unshielded' or 'shielded' per transfer.
React
Transactions are paid for in DUST, generated by registered unshielded
NIGHT. If a wallet has no DUST, register it first (see below).
Registering for DUST
DUST is the resource that pays for Midnight transactions. It is generated over time by unshielded NIGHT that has been registered for generation. CallregisterDust() once to designate the wallet’s NIGHT for DUST generation.
React
Recovering reserved UTxOs
If a transaction is built or signed but never submitted, its inputs stay reserved. These methods release them:React