Skip to content

Latest commit

Β 

History

153 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CI License: MIT OR Apache-2.0 Telegram Chat

A complete Rust integration path for Morpho Midnight offers.

SDK Guide | API Docs | Examples | CLI Guide

Nocturne - made in Rust

What is Nocturne?

Nocturne is a Rust SDK for integrating with the Morpho Midnight protocol. It builds and signs offers, constructs Merkle trees, simulates execution, reads the public order book, manages lending and borrowing positions, and produces transactions that Rust wallet clients can submit.

Status

Nocturne is an early v0.1.0 release and has not been independently security-audited. See SECURITY.md before using it with real value.

Install

The crates.io package and Rust import intentionally have different names:

Context Name
crates.io SDK package nocturne-midnight
Rust import nocturne

Add the SDK to a Rust application:

[dependencies]
nocturne = { package = "nocturne-midnight", version = "0.1.0" }

Install the CLI:

cargo install nocturne-verify

Complete flows

flowchart LR
    A[Offer terms] --> B[Build and validate]
    B --> C[Group and build tree]
    C --> D[Sign or ratify]
    D --> E[Encode payload]
    E --> F[Publish with Rust wallet]

    G[Midnight API] --> H[Book or quote]
    H --> I[Size and simulate]
    I --> J[Encode take calldata]
    J --> K[Submit with Rust wallet]

    D -. inspect .-> V[Offline review]
    E -. inspect .-> V
    J -. inspect .-> V
Loading
  • Maker: build β†’ validate β†’ group β†’ sign or ratify β†’ encode β†’ publish.
  • Taker: fetch β†’ quote β†’ size β†’ simulate β†’ encode β†’ submit.
  • Reviewer: receive bytes or typed data β†’ decode β†’ reproduce root and digest β†’ verify.

Start with the SDK quickstart and complete workflows. Every example and its exact Cargo command are listed in the examples index. CLI commands are documented in the CLI guide.

Development and verification

The minimum supported Rust version is 1.90. Run the repository checks with:

cargo test --workspace --all-targets

Protocol-critical outputs have contract and TypeScript SDK parity coverage. The maintainer-only live Anvil harness exercises complete maker, taker, authorization, cancel-and-replace, state-decoding, and market-making lifecycles against deployed Midnight contracts.

Nocturne emphasizes deterministic offchain construction, validation, and simulation wherever possible. Most SDK behavior can be developed and tested locally without funding a wallet; Anvil and live-chain tests are reserved for the integration boundaries that require them.

Contributing

Contributions are welcome. See CONTRIBUTING.md for the development workflow, testing expectations, and pull request guidelines.

Getting help

Acknowledgements

Disclaimer

Independent, personal open source projectβ€”not created, endorsed, or supported by Morpho. Provided "AS IS" with no warranty and no liability, and it is not financial, investment, or legal advice. Interacting with blockchain protocols and automated trading carries significant risk, including total loss of funds. See DISCLAIMER.md for the full text.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

About

πŸŒ’ Rust toolkit for Morpho Midnight: offer trees, signing, simulation & payload verification

Resources

Contributing

Security policy

Stars

9 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages