DEV Community

Gutopro
Gutopro

Posted on

Troubleshooting Midnight Pre-Prod: A Week in the Trenches

Midnight Network Challenge: Enhance the Ecosystem

Building on Midnight feels like being on the frontier of Web3. Between the Zero-Knowledge (ZK) primitives and the unique dual-token model, there is a lot to love—but being an early adopter means running into some undocumented "features."

I spent this week building on the Midnight pre-prod network from scratch. While the documentation is improving, I encountered several blockers that weren't immediately obvious. I also spent a lot of time in the Discord monitoring common pitfalls other devs are hitting.

If you are setting up your Midnight environment today, bookmark this. Here is how to fix the most common environment issues.

1. The "Invalid Address" Faucet Trap
The Issue: You try to fund your wallet using the Lace faucet, but it returns an "Address provided was invalid" error, even after you confirm you are on the pre-prod network.

The Fix: Switch to the 1AM wallet.

Crucial Step: You must set the wallet to the pre-prod network BEFORE you copy your address. A mainnet address string—even if generated by the same seed—will not be recognized by the pre-prod faucet.

// Set network to preprod
setNetworkId('preprod');
Enter fullscreen mode Exit fullscreen mode

2. Deployment Failures (deploy.ts)
The Issue: Your deploy.ts script fails to create or connect to a wallet. This usually happens because the default configuration in many boilerplate templates doesn't align with the 1AM wallet's requirements.

The Fix: This is a two-step process that is currently undocumented:

Replace your pre-prod configuration file with the specific 1AM network config.

// Preprod network configuration
const CONFIG = {
  indexer: 'https://indexer.preprod.midnight.network/api/v4/graphql',
  indexerWS: 'wss://indexer.preprod.midnight.network/api/v4/graphql/ws',
  node: 'https://rpc.preprod.midnight.network',
  proofServer: 'http://127.0.0.1:6300',
};
Enter fullscreen mode Exit fullscreen mode

Use the CLI to create your wallet after you have integrated that new config.
Doing only one of these will result in a hang. You need both to bridge the gap between the script and the network.

3. DUST Registration Timing Out
The Issue: You attempt to register for DUST, but the process hangs or fails repeatedly.

The Fix: This shares the same root cause as the deployment issue. If your config is pointing even slightly off-target, the registration handshake won't complete. Ensure you are using the 1AM network configuration before you even attempt the registration command.

4. The "Ghost DUST" Bug
The Issue: Several devs in Discord reported getting a green "Success" checkmark on the faucet, but no tDUST arrives, even after 48 hours.

The Fix: Currently, the most reliable workaround is to use the 1AM wallet specifically. In most cases, DUST credits immediately there, whereas Lace is seeing intermittent sync issues with the faucet during this pre-prod phase.

5. Unexpected Gas Drainage
The Issue: You’re building, and suddenly everything stops working because your tDUST balance is zero.

The Fix: Remember that every write operation consumes tDUST as gas. Because we are in a ZK environment, these costs can add up during heavy testing.

Pro-Tip: Use the 1AM Explorer to track your transaction history and gas per interaction. Refuel from the faucet proactively rather than waiting for a failure.

6. Contract Interaction "De-sync"
The Issue: Your contract interactions work for a while, then suddenly start failing mid-session without code changes.
_
The Fix_: The wallet (specifically Lace) sometimes loses sync with the chain or suffers an authentication timeout.

The Workflow: Manually click Sync in your wallet before every contract interaction. It feels redundant, but it prevents the "ghost failures" that catch most devs off guard.

My "Golden" Setup
If you want a stable environment to actually write code, here is the stack I currently have running successfully:

  • Runtime: Node 22
  • Compiler: Latest Compact compiler
  • Wallet: 1AM wallet (on pre-prod)
  • Workflow: Wallet created via CLI using 1AM config
  • Infrastructure: Proof server running locally via Docker

Verification: Contracts deployed and verified via 1AM Explorer

What’s Next?
I’m currently working through Midnight 301 (Advanced ZK DApp Development), building a privacy-preserving bulletin board. I’ll be documenting the full build-out as I go.

If you're stuck on a specific error, drop a comment or find me in the Midnight Discord. Let's build.

midnight #zkproofs #blockchain #web3 #tutorial

Top comments (0)