Skip to content

Repository files navigation

Atomic Patent β€” The Instant IP Ledger

CI Security Audit codecov

A decentralized Intellectual Property registry built on Stellar Soroban smart contracts using Pedersen Commitments and Atomic Swaps.

In engineering, proving "Prior Art" across borders is expensive, slow, and lawyer-dependent. Atomic Patent lets you claim an idea instantly β€” without revealing it to competitors β€” and sell it globally without intermediaries.

🎯 What is Atomic Patent?

Atomic Patent is a Zero-Knowledge IP registry on Stellar. Engineers, inventors, and creators can:

  • Commit a cryptographic hash of their design/code to the blockchain
  • Prove they had the idea at a specific timestamp β€” without revealing the idea
  • Sell the patent trustlessly via Atomic Swap β€” the buyer gets the decryption key in the same transaction they send payment

This Soroban implementation makes Atomic Patent:

βœ… Trustless (no lawyers, no notaries, no central registry) βœ… Private (Pedersen Commitments hide your idea until you choose to reveal it) βœ… Instant (timestamp your IP in seconds, not months) βœ… Global (a mechanical engineer in Lagos can sell a design to a firm in Tokyo β€” no intermediary needed)

πŸš€ Features

  • Claim IP: Commit a Pedersen hash of your design to Stellar with a verifiable timestamp
  • Prove Prior Art: On-chain proof that you held the idea before a specific date
  • Atomic Sale: Sell your patent via Atomic Swap β€” payment and decryption key exchange in one transaction
  • Trustless Verification: If the decryption key is invalid, the payment fails automatically
  • Borderless: Works for any creator, anywhere, with a Stellar wallet

πŸ› οΈ Quick Start

Prerequisites

  • Rust (1.70+)
  • Soroban CLI
  • Stellar CLI
  • Node.js (16+) and npm (for JS layer testing)

Build

./scripts/build.sh

Test

Run all tests (Rust + JS):

# Run Rust tests
./scripts/test.sh

# Run JS tests
npm test

# Run JS tests with coverage
npm run test:coverage

# Watch mode for JS tests
npm run test:watch

The JS test suite covers batch operations (cancellation, dispute resolution, fee calculation, etc.) and SDK modules.

Deploy to Testnet

# Configure your testnet identity first
stellar keys generate deployer --network testnet

# Deploy
./scripts/deploy_testnet.sh

🌐 Testnet Deployment Status

Deploy to Testnet

Latest testnet deployment addresses are published in GitHub Actions deployment summaries. Deployments are triggered automatically on release tags (v*).

πŸ“– Documentation

Core Documentation

Additional Resources

πŸ“ JS Type Annotations: JSDoc vs TypeScript Migration

The src/ JavaScript modules use JSDoc annotations (@param, @returns, @typedef) rather than a full TypeScript migration. This was a deliberate choice (#883):

  • No build step required. JSDoc works with the existing ESM + Jest setup without adding tsc, ts-jest, or a compilation stage.
  • IDE intelligence. VS Code and WebStorm resolve JSDoc types for autocompletion, go-to-definition, and inline docs β€” the primary tooling benefit of TypeScript without the migration cost.
  • API-server integration. Rust integrators can read the @param/@returns shapes directly from the source to understand the expected JSON structures, without needing to run a TypeScript compiler.
  • Low friction for contributors. Adding JSDoc to existing JS files is a one-file change with no dependency on type infrastructure; a TypeScript migration would require per-file changes across the entire src/ tree plus CI changes.

Future migration path: if the project adopts TypeScript, the existing JSDoc annotations act as a specification that can be mechanically converted with tsc --allowJs --declaration --emitDeclarationOnly. The decision to migrate fully to TypeScript should be tracked as a separate issue and is not blocked by the current JSDoc coverage.

πŸ“¦ Release Notes and Changelog

Release notes are generated automatically from commit messages and PR metadata. Push a tag in the format v* (e.g., v1.2.0) to trigger the release workflow.

πŸŽ“ Smart Contract API

IP Registry

commit_ip(owner, commitment_hash) -> u64          // Timestamp a new IP commitment
get_ip(ip_id) -> IpRecord                         // Retrieve an IP record
verify_commitment(ip_id, secret) -> bool          // Verify a commitment against a secret
list_ip_by_owner(owner) -> Vec<u64>               // List all IP IDs for an owner
reveal_and_verify_commitments(requests) -> Vec<VerifyResult>  // #458: Verify multiple commitments by revealing secret+blinding_factor (not ZK)
batch_verify_commitments(requests) -> Vec<VerifyResult>  // #780: Verify multiple commitments with a real ZK (Pedersen+Schnorr) proof
assign_ip_to_category(ip_id, category_hash)       // #459: Assign IP to a hierarchical category
list_ip_by_category(owner, category_hash) -> Vec<u64>    // #459: List IPs in a category
list_owner_categories(owner) -> Vec<BytesN<32>>   // #459: List all categories for an owner

// #464: Anonymous Batch Commitments
batch_commit_ip_anonymous(blinded_owner, commitment_hashes) -> Vec<u64>  // Register commitments without revealing submitter
get_anonymous_owner(commitment_hash) -> Option<BytesN<32>>               // Retrieve blinded owner for anonymous commitment
get_blinded_owner_batch(commitment_hashes) -> Vec<Option<BytesN<32>>>   // Batch lookup of blinded owners

// #465: Batch Escrow
batch_escrow_commitments(depositor, ip_ids, release_to, timeout) -> BytesN<32>  // Escrow multiple IPs for conditional release
get_batch_escrow(escrow_id) -> Option<EscrowRecord>                              // Retrieve escrow record
release_batch_escrow(escrow_id)                                                  // Release escrowed IPs to beneficiary
cancel_batch_escrow(escrow_id)                                                   // Cancel escrow after timeout

Atomic Swap

initiate_swap(ip_id, price, buyer) -> u64         // Seller initiates a patent sale
accept_swap(swap_id, payment)                     // Buyer accepts and sends payment
reveal_key(swap_id, decryption_key)               // Seller reveals key; payment releases
cancel_swap(swap_id)                              // Cancel if key is invalid or timeout

// #470: Price Oracle Integration
set_oracle(caller, oracle_address, enabled)       // Admin sets the price oracle contract
get_oracle_config() -> Option<OracleConfig>       // Query current oracle configuration
get_oracle_price(token) -> i128                   // Fetch current price from oracle
initiate_swap_with_oracle_price(...)  -> u64      // Initiate swap at oracle-determined price

πŸš€ JS Batch & Analytics Layer

The src/ directory contains the JavaScript/TypeScript batch operations and SDK modules that complement the Soroban smart contracts. This layer provides:

  • Batch Operations: Efficient multi-swap processing, cancellation, and dispute resolution
  • SDK Modules: Type-safe interfaces for interacting with the on-chain contract
  • Analytics: Fee calculation, reputation scoring, and transaction analysis
  • Testing: Comprehensive Jest test suite covering all batch workflows

Setup and Testing

Install dependencies:

npm install

Run the full JS test suite:

npm test

Run tests with coverage report:

npm run test:coverage

Run tests in watch mode (useful during development):

npm run test:watch

The test suite covers:

  • Batch swap cancellation logic
  • Dispute resolution workflows
  • Fee calculation and escrow handling
  • Multi-currency support
  • SDK module integration

For more details on the architecture and design patterns, see Architecture Overview.

πŸ§ͺ Testing

Comprehensive test suite covering:

βœ… IP commitment and timestamping βœ… Pedersen commitment verification βœ… Atomic swap initiation and acceptance βœ… Key reveal and payment release βœ… Invalid key rejection and payment refund βœ… Error handling and edge cases

Run tests:

cargo test

🌍 Why This Matters

Intellectual property protection today requires expensive lawyers, slow national patent offices, and jurisdiction-specific filings. This locks out independent inventors and engineers in the Global South from protecting and monetizing their ideas.

Blockchain Benefits:

  • No central authority to bribe, delay, or deny
  • Cryptographic proof of prior art β€” accepted anywhere
  • Atomic Swap eliminates counterparty risk in patent sales
  • Accessible to anyone with a Stellar wallet

Target Users:

  • Independent engineers and inventors
  • Open-source contributors protecting prior art
  • Startups in emerging markets
  • Any creator who can't afford a patent attorney

πŸ—ΊοΈ Roadmap

  • v1.0 (Current): XLM-only swaps, Pedersen commitment registry
  • v1.1: USDC/EURC payment support for patent sales
  • v2.0: Partial disclosure proofs (reveal claims without full design)
  • v3.0: Frontend UI with wallet integration
  • v4.0: Mobile app, legal document generation

🀝 Contributing

We welcome contributions! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.

πŸ™ Acknowledgments

About

A Zero-Knowledge IP registry on Stellar. Securely timestamp engineering designs using Pedersen Commitments and trade them globally via trustless Atomic Swaps on Soroban.

Resources

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages