Introduction
Midday SDK is a developer-friendly SDK for building decentralized applications (dapps) on the Midnight Network.
What is Midnight Network?
Midnight is a data-protection blockchain that uses zero-knowledge proofs to enable privacy-preserving smart contracts. It allows developers to build applications where sensitive data remains private while still being verifiable on-chain.
Why Midday SDK?
The official Midnight JavaScript libraries are powerful but can be complex to work with. Midday SDK provides:
- Simplified API - High-level abstractions that reduce boilerplate
- Multiple Programming Styles - Choose between Promise API, Effect API, or Effect with Dependency Injection
- Browser Support - First-class support for browser environments with Lace wallet integration
- Type Safety - Full TypeScript support with typed contract actions and state
- Effect Integration - Built on Effect for robust error handling and composability
API Styles
Midday SDK offers three ways to interact with contracts:
Promise API
The simplest approach, ideal for quick prototypes or developers unfamiliar with Effect:
const loaded = await client.loadContract({ module: CounterContract, zkConfig, privateStateId: 'my-id' });const deployed = await loaded.deploy();await deployed.actions.increment();const state = await deployed.ledgerState();Effect API
For developers who want functional programming benefits without dependency injection:
const program = Effect.gen(function* () { const loaded = yield* client.effect.loadContract({ module, zkConfig, privateStateId: 'my-id' }); const deployed = yield* loaded.effect.deploy(); yield* deployed.effect.actions.increment(); return yield* deployed.effect.ledgerState();});Effect with Dependency Injection
For large applications that benefit from testability and modularity:
const program = Effect.gen(function* () { const client = yield* Midday.Client.MiddayClientService; const loaded = yield* client.effect.loadContract({ module, zkConfig, privateStateId: 'my-id' }); const deployed = yield* loaded.effect.deploy(); yield* deployed.effect.actions.increment(); return yield* deployed.effect.ledgerState();});Next Steps
Ready to get started? Head to the Quick Start guide.