Skip to content

rohan-protocol/sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Project Rohan πŸ›‘οΈ (@rohan-protocol/sdk)

The Universal Trust Layer for AI Agents.
Stop leaking agent data. Replace insecure REST APIs with local Zero-Knowledge Proofs.

LangChain Midnight Stripe DX Trending

🚨 v0.3.1 "The Gasless Update" is live: We achieved Stripe-DX for ZK-Proofs. No wallets, no DUST-tokens, no cryptography PhD required. Just an API key.

πŸ›‘ The Problem: AI Agents leak data via REST

When your agent talks to another agent via API, the payload is exposed. Centralized servers see your agent's confidential logic, system prompts, and negotiation limits.

⚑ The Solution: Rohan ZK-Handshakes

Rohan enables agents to negotiate confidential deals (NDAs, payments, secrets) using Zero-Knowledge Proofs (zk-SNARKs) on the Midnight Blockchain.

  • Private Deals: The actual deal content never leaves your server.
  • Public Proof: Only an encrypted cryptographic commitment lands on-chain.
  • Zero Web3 Friction: Our Relayer Node handles gas fees. You just code.

What is this?

Rohan enables AI agents to negotiate confidential deals (NDAs, payments, secrets) with each other using Zero-Knowledge Proofs (zk-SNARKs) on the Midnight Blockchain. The actual deal content never leaves your server. Only an encrypted cryptographic commitment lands on-chain.

With SDK v0.3.1, we refined the "Gas Station / Relayer" architecture (Stripe-DX). You no longer need to manage DUST-Token balances, blockchain wallets, or complex cryptography. You simply provide an API Key, and our Relayer pays the gas fees and manages the chain interactions for your agent.

Install

npm install @rohan-protocol/sdk

Quickstart

import { RohanNode } from '@rohan-protocol/sdk';

// 1. Create an agent connected to the Relayer (No Wallets required!)
const agent = new RohanNode({
  apiKey: process.env.ROHAN_API_KEY || 'rohan_sk_test',
  relayerUrl: 'https://api.rohanprotocol.network'
});

// 2. Listen for incoming deals (Trustless Verification via Network Ledger)
agent.onHandshake((deal) => {
  console.log(`Deal confirmed on-chain! From: ${deal.from}`);
  console.log(`Commitment Hash: ${deal.commitment}`);
});

// 3. Connect to the Blockchain Tracker
await agent.start();

Send a Confidential Handshake

You can prompt your agent to execute a confidential data transfer utilizing our ZK Proof flow:

const result = await agent.handshake(
  'did:rohan:partner_agent',           // Target DID (or raw Contract Address)
  { nda: 'Project Alpha', blueprints: true }, // Secret data (remains offline, auto-stringified)
  150  // Toll fee in DUST
);

console.log(result.status);            // "success"
console.log(result.txId);              // "tx_mid_892f7dbf..."
console.log(result.onChainCommitment); // "ca5ab9c2..."

πŸ€– LangChain Integration (God Mode)

Turn your standard LLM into an autonomous Web3 protocol user. We provide a drop-in LangChain Tool wrapper. Your agent can decide by itself when it is appropriate to use a ZK-Handshake to protect confidential data.

import { RohanSecureHandshakeTool } from '@rohan-protocol/sdk';

// Inject the Tool into LangChain/LangGraph
const handshakeTool = new RohanSecureHandshakeTool(agent);
const tools = [handshakeTool, /* other system tools */];

// The LLM will now autonomously construct the ZK-Handshake payload 
// when its system prompt instructs it to securely transmit money or data.

API Reference

new RohanNode(config)

Parameter Type Required Default Description
apiKey string βœ… – API key for the Gas Station / Relayer
relayerUrl string βœ… – The URL of the Rohan Gas Station
did string ❌ Auto-generated Decentralized Identifier for this node

agent.start(): Promise<void>

Initializes the Ledger Poller. It watches the Midnight Blockchain for status updates relevant to this node.

agent.onHandshake(callback): void

Fires automatically when a cryptographic ZK-Proof addressed to this agent is successfully verified on the Midnight Ledger.

agent.handshake(targetIdentifier, dealPayload, fee): Promise<HandshakeResult>

Generates a Zero-Knowledge Proof locally and relays it via the Gas Station API.

  • targetIdentifier: A DID (did:rohan:...) or a raw Midnight Contract Address. DIDs are resolved automatically.
  • dealPayload: string | object β€” The confidential data you are masking. Objects are auto-stringified.
  • fee: Toll fee in DUST (default: 150, minimum: 100).

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Your AI Agent                      β”‚
β”‚                                                      β”‚
β”‚   const agent = new RohanNode({ apiKey, relayerUrl })β”‚
β”‚   agent.handshake("did:rohan:partner", { secret })   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚  @rohan-protocol/sdkβ”‚
        β”‚  (Prover Module)    β”‚ ← Generates ZK-Proof locally
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚ HTTP POST (Proof Blob + API Key)
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚  Rohan Relayer Node β”‚ ← Verifies API Key & Pays DUST Fee
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚ Submit transaction to Midnight
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚  Midnight Network   β”‚ ← The ZK-Settlement Layer
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Security

  • Gasless Architecture: API Keys replace vulnerable Wallet Seeds on the client side.
  • Zero-Knowledge: The deal content is hashed prior to proof generation. Only mathematical assurances are broadcasted.
  • Trustless Execution: Webhooks are deprecated. Incoming deals trigger strictly based on cryptographic changes on the Ledger.

Seeking Alpha Access? We are currently hand-picking our first 50 validators. Send your Agent DID and use-case to alpha@rohanprotocol.network

License

MIT Β© Rohan Protocol

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors