Skip to content

polus-arcticus/AH-p2p

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎯 AH-P2P: Multiplayer Metatransaction Auctions

Revolutionizing NFT Trading Through Decentralized P2P Architecture

Solving the orderbook revalidation problem with multiplayer metatransactions and real-time P2P networking.

▶️ Watch Video

🚀 The Problem: Fragile Offchain Orderbooks

Current offchain orderbooks are facing natural limits to scalability and rest on a fragile trust model.

How Current NFT Marketplaces Work:

  1. Users sign offchain orders - You create a digital signature saying "I'll sell my NFT for X tokens"
  2. Central authority indexes everything - Companies like OpenSea & Reservoir constantly monitor the blockchain (Reservoir's recent deprecation shows that despite every network optimization, NFT marketplace SaaS isn't a viable business model)
  3. Continuous revalidation required - They must check if your order is still valid:
    • ❌ Did you move your NFT to another wallet?
    • ❌ Did you revoke marketplace approval?
    • ❌ Did you spend the tokens you were bidding with?
    • ❌ Was the NFT collection disabled or flagged?

The Scalability Crisis:

  • Impure logic trade-offs - If a user has 5 bids of 1000 tokens each but only 1000 in their account, which 4 bids do you invalidate? Leaving all 5 as valid creates false market depth
  • Faster than block speed - Indexers must outpace blockchain updates or risk failed trades
  • Single points of failure - If the indexing service goes down, trading stops
  • False market depth - Orders appear valid but fail when executed

"As offchain orderbooks crumble under their own weight, the market desperately needs alternatives"


💡 Our Innovation: Two Revolutionary Components

🎮 1. Multiplayer Metatransaction System

File: EnglishAuction.sol

  • Zero revalidation needed - Contract finds the highest valid bid at execution time
  • Gasless bidding - Only auctioneer pays gas, bidders sign for free
  • EIP-712 signatures with nonce-based replay protection
  • Fail-safe execution - Automatically falls back to next highest valid bid
// Revolutionary: No pre-validation, just execution-time discovery
while (!swapMade) {
  if (validBid(auction.bids[iter])) {
    executeSwap(); // Found the winner!
    swapMade = true;
  } else {
    iter++; // Try next highest bid
  }
}

🌐 2. P2P Signature Collation Network

File: relay/index.js

  • IPFS PubSub + WebRTC for real-time bid collection
  • OrbitDB for decentralized auction state management
  • Circuit relay servers for NAT traversal and peer discovery
  • Resilient architecture - Auctions continue even if relay nodes fail
// Real-time P2P bid aggregation
node.services.pubsub.subscribe('ah-p2p.market/peer-announce')
// Collect signatures from multiple bidders simultaneously
// No central authority needed!

🎯 Why This Matters

Traditional Orderbooks AH-P2P Innovation
❌ O(n) revalidation costs ✅ O(1) execution discovery
❌ Centralized indexing ✅ Decentralized P2P network
❌ Constant monitoring needed ✅ Validation only at execution
❌ Single point of failure ✅ Resilient mesh network
❌ Gas costs for all participants ✅ Gasless bidding experience

🏗️ Technical Architecture

                    ┌─────────────────────────────┐
                    │       Auctioneer            │
                    │ (Signs Auction Authorization│
                    │  Defines NFT, Token, Rules) │
                    └─────────────┬───────────────┘
                                 │
┌─────────────────┐    ┌─────────▼─────────┐    ┌─────────────────┐
│   Bidder A      │    │   Bidder B        │    │   Bidder C      │
│  (Signs Bid)    │    │  (Signs Bid)      │    │  (Signs Bid)    │
└─────────┬───────┘    └─────────┬─────────┘    └─────────┬───────┘
          │                      │                        │
          └──────────────────────┼────────────────────────┘
                                 │
                    ┌─────────────▼───────────────┐
                    │     P2P Relay Network       │
                    │   (IPFS PubSub + WebRTC)    │
                    │      OrbitDB Storage        │
                    └─────────────┬───────────────┘
                                 │
                    ┌─────────────▼───────────────┐
                    │      Auctioneer             │
                    │  (Collects & Submits)       │
                    └─────────────┬───────────────┘
                                 │
                    ┌─────────────▼───────────────┐
                    │   EnglishAuction.sol        │
                    │ (Finds Highest Valid Bid)   │
                    └─────────────────────────────┘

🎮 Gamified Experience

  • Real-time auction battles with live chat
  • Cyberpunk gaming UI with battle terminology
  • Peer discovery through gossip protocols
  • Resilient rooms that survive network partitions

🔮 Future Extensions

  • Reputation systems for trusted auctioneers
  • Commit-reveal schemes for sealed bid auctions
  • Multi-asset bundles for complex NFT trades
  • Cross-chain bridges for universal liquidity

🛠️ Tech Stack

  • Smart Contracts: Solidity 0.8.30, Hardhat, OpenZeppelin
  • P2P Network: libp2p, IPFS, OrbitDB, WebRTC
  • Frontend: React, TypeScript, Tailwind CSS, Wagmi
  • Signatures: EIP-712, Viem

🚀 Getting Started

# Start the P2P relay
cd relay && npm start

# Deploy contracts  
cd hardhat && npx hardhat deploy --network localhost

# Launch the gaming UI
cd web && npm run dev

🏆 Impact & Vision

AH-P2P isn't just another marketplace - it's a paradigm shift.

By eliminating the need for constant revalidation and embracing P2P architecture, we're building the foundation for the next generation of decentralized trading infrastructure.

The future is peer-to-peer. The future is now.


Built with ❤️ for the decentralized future

About

Nft auction house with multiplayer metatransactions over ipfs pubsub + webrtc

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors