Skip to content

0xAtelerix/pintent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pintent

Cross-chain intent protocol connecting Midnight with EVM and non-EVM blockchains, powered by Pelagos consensus.

This project is built on the Midnight Network.

What is Pintent?

Pintent enables cross-chain token transfers from Midnight to any blockchain through an intent-based model. Users lock tNIGHT on Midnight and specify a destination — competitive solvers deliver tokens on the target chain — and a deterministic appchain on Pelagos orchestrates verification and settlement.

The protocol is chain-agnostic by design: the Pelagos multichain oracle already supports EVM chains, Solana, and Midnight, with Cardano and Bitcoin planned. Solvers operate on destination chains natively, meaning Pintent can bridge to any chain that Pelagos can observe.

How It Works

    Midnight                       Pelagos                   Destination Chain
┌────────────────┐          ┌──────────────────┐          ┌──────────────┐
│                │          │                  │          │  Ethereum    │
│  User locks    │  block   │  Appchain        │          │  Solana      │
│  tNIGHT in     │──sync──▶│  detects intent  │          │  Cardano     │
│  bridge.compact│          │  status: Open    │          │  Bitcoin     │
│                │          │                  │  query   │  any L1/L2   │
│                │          │  Solvers watch   │◀─────────│              │
│                │          │  open intents    │          │  Solver      │
│                │          │                  │          │  delivers    │
│  Contract      │◀─settle─│  Validates fill  │◀──fill───│  tokens      │
│  marks intent  │          │  status: Settled │          │              │
│  FULFILLED     │          │                  │          │              │
└────────────────┘          └──────────────────┘          └──────────────┘
  1. User creates intent on Midnight — locks tNIGHT in the bridge contract, specifies destination chain and address
  2. Pelagos oracle syncs the Midnight block, appchain detects the new intent
  3. Solver queries open intents via JSON-RPC, evaluates profitability
  4. Solver delivers tokens on the destination chain (EVM, Solana, Cardano, etc.)
  5. Appchain validates the delivery and authorizes fulfillment on Midnight
  6. Bridge contract verifies authorization and marks the intent fulfilled

If no solver fills before the deadline, the user can cancel and reclaim their tNIGHT.

Midnight Contract

The bridge contract is written in Compact — Midnight's zero-knowledge smart contract language.

Circuits

Circuit Who Description
createIntent Any user Locks tNIGHT, stores intent on public ledger, returns intent ID
fulfillIntent Validator set Verifies authorization proof, marks intent as fulfilled
cancelIntent Intent creator Refunds locked tNIGHT back to creator
updateValidatorKey Admin Rotates the validator-set public key

State Model

All intent data lives on Midnight's public ledger (disclosed state), queryable via the indexer:

Field Type Description
intentAmounts Map<Field, Uint<64>> Intent ID to locked tNIGHT amount
intentDestAddresses Map<Field, Bytes<32>> Intent ID to destination address
intentDestChains Map<Field, Bytes<32>> Intent ID to target chain
intentStatuses Map<Field, IntentStatus> PENDING / FULFILLED / CANCELLED
intentCreators Map<Field, Bytes<32>> Intent ID to creator address
validatorKey Bytes<32> Public key for fulfillment authorization

Intent Lifecycle

createIntent()          fulfillIntent()
  PENDING ───────────────▶ FULFILLED
     │
     │ cancelIntent()
     ▼
  CANCELLED (tNIGHT refunded)

Architecture

Pintent relies on the Pelagos network for cross-chain coordination:

  • Multichain oracle — syncs Midnight blocks and contract actions into SQLite via GraphQL indexer
  • Intent appchain — deterministic state machine that manages the intent lifecycle across chains
  • Validator set — distributed key management for authorizing cross-chain fulfillment

The appchain consumes finalized Midnight blocks from the oracle, detects contract actions on the bridge contract, and coordinates with solvers who operate on destination chains.

Supported Destination Chains

Chain Status
Ethereum + L2s (Arbitrum, Optimism, Base, etc.) Supported
Solana Supported
Cardano Planned
Bitcoin Planned

The intent model is chain-agnostic — adding a new destination chain requires only that the Pelagos multichain oracle can observe it and solvers can operate on it. No changes to the Midnight contract are needed.

Repository Structure

pintent/
├── contracts/
│   └── midnight/
│       ├── src/
│       │   ├── bridge.compact      # ZK bridge intent contract
│       │   ├── witnesses.ts        # Witness implementations
│       │   └── index.ts            # Re-exports
│       ├── package.json
│       └── tsconfig.json
└── docs/
    ├── architecture.md             # System design
    ├── protocol.md                 # Intent protocol specification
    └── midnight-bridge.md          # Midnight integration details

Building

cd contracts/midnight
npm install
npm run build    # compactc compile + tsc

Requires Compact compiler v0.21.0+.

Status

  • Midnight bridge contract: deployed on Preprod
  • EVM destination chains: supported (Ethereum, L2s)
  • Solana destination chains: supported
  • Cardano, Bitcoin: planned
  • Appchain: private repository (closed source)
  • Fulfillment authorization: signature scheme under development

Contributors