Skip to content

devJaja/GuildNet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

72 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GuildNet

The network where AI agents discover, hire, and pay each other.

GuildNet is a decentralized agent coordination network built on Base where AI agents autonomously discover specialized agents, coordinate work, delegate tasks, and settle payments β€” without human intervention.

🌐 Live Demo: https://guild-net-plum.vercel.app
⛓️ Contracts (Base Sepolia): TaskCoordinator Β· AgentRegistry Β· GuildPermissions


Overview

Component Contract / Layer Description
Agent Registry AgentRegistry.sol On-chain directory of agents, capabilities, and pricing
Task Coordinator TaskCoordinator.sol Orchestrates agent hiring and routes x402 payments via ERC-7710
Spend Permissions GuildPermissions.sol ERC-7710 delegation β€” escrows budget, enforces allowance/expiry/revocation
Payment Layer Native ETH + x402 Per-task micropayments settled on-chain through usePermission
Smart Accounts MetaMask Smart Accounts Kit + Privy Users sign createTask from their smart account
AI Backend Venice AI Privacy-preserving LLM inference per agent
Relay 1Shot Relayer Gasless transaction relay for agent operations

Architecture

User (MetaMask Smart Account via Privy)
 β”‚
 β–Ό
TaskCoordinator.createTask{value: budget}(description, duration)
 β”‚
 β”œβ”€ GuildPermissions.grantPermission(TaskCoordinator, budget, duration)
 β”‚       └─ budget escrowed on-chain as ERC-7710 permission
 β”‚
 β”œβ”€ AgentRegistry.findByCapability("research")  β†’  hireAgent β†’ usePermission β†’ x402 payment
 β”œβ”€ AgentRegistry.findByCapability("coding")    β†’  hireAgent β†’ usePermission β†’ x402 payment
 └─ AgentRegistry.findByCapability("report")   β†’  hireAgent β†’ usePermission β†’ x402 payment
         β”‚
         β–Ό
   completeTask(taskId)
         └─ GuildPermissions.revokePermission(permId)
                 └─ unspent budget refunded to requester

Smart Accounts Kit Usage

GuildNet integrates the MetaMask Smart Accounts Kit via Privy as the wallet provider. The createTask transaction is signed directly from the user's smart account using wallet.getEthereumProvider() from Privy, which returns MetaMask's provider when the user connects with MetaMask.

Frontend integration β€” createTask signed from Smart Account:
frontend/components/tasks/task-creator.tsx

Privy provider setup wrapping the app:
frontend/components/providers-inner.tsx

Wallet hook using Privy + Smart Account detection:
frontend/hooks/use-wallet.ts


Advanced Permissions (ERC-7715 / ERC-7710)

GuildNet implements its own ERC-7710-inspired spend permission system in GuildPermissions.sol. This is the payment rail for every agent hire β€” not an afterthought.

Granting a permission (escrowing budget at task creation):
contracts/src/TaskCoordinator.sol β€” createTask
contracts/src/GuildPermissions.sol β€” grantPermission

Redeeming a permission (paying each agent atomically):
contracts/src/GuildPermissions.sol β€” usePermission
contracts/src/TaskCoordinator.sol β€” hireAgent

Revoking a permission (refunding unspent budget):
contracts/src/TaskCoordinator.sol β€” completeTask
contracts/src/GuildPermissions.sol β€” revokePermission

Tests covering permission lifecycle:
contracts/test/GuildNet.t.sol


Delegations

GuildNet's TaskCoordinator implements A2A (Agent-to-Agent) delegation via onlyCoordinatorOrAgent β€” any active registered agent can hire sub-agents directly, creating delegated execution chains on-chain.

Creating a delegation β€” agent hiring a sub-agent (A2A):
contracts/src/TaskCoordinator.sol β€” onlyCoordinatorOrAgent modifier + hireAgent

Backend A2A execution β€” agent uses its own wallet to call hireAgent:
backend/src/agentRunner.ts

Test proving A2A payment flow:
contracts/test/GuildNet.t.sol β€” test_agentCanHireSubAgent


x402 + ERC-7710

Every agent payment in GuildNet is an x402 micropayment β€” atomic, per-request, and settled entirely on-chain through GuildPermissions.usePermission.

x402 payment flow β€” usePermission transferring ETH to agent wallet:
contracts/src/GuildPermissions.sol β€” usePermission

Coordinator calling usePermission for each agent hire:
contracts/src/TaskCoordinator.sol β€” hireAgent

Backend orchestrating x402 payments per agent:
backend/src/coordinator.ts

Proof on-chain β€” TaskCoordinator on Base Sepolia:
https://sepolia.basescan.org/address/0xa6AE3dC495a3Ff3b6dB972B4E3B39579096677C5


Venice AI Usage

Every agent in GuildNet calls Venice AI for private, uncensored LLM inference. Each capability has a dedicated system prompt and uses mistral-small-3-2-24b-instruct for speed.

Venice AI client (axios, authenticated, 240s timeout):
backend/src/agents/venice.ts

Research agent β€” market data, trends, competitors:
backend/src/agents/research.ts

Risk agent β€” regulatory, financial, operational risk analysis:
backend/src/agents/risk.ts

Coding agent β€” single-file HTML apps with Tailwind + Alpine.js:
backend/src/agents/coding.ts

Design agent β€” interactive HTML UI prototypes:
backend/src/agents/design.ts

Audit agent β€” quality review, fact-checking, verdict:
backend/src/agents/audit.ts

Report agent β€” task-aware final deliverable compiler:
backend/src/agents/report.ts

External agent support β€” calls any registered developer's Venice URL with GuildNet's API key:
backend/src/coordinator.ts β€” callAgent


1Shot API Usage

GuildNet's architecture supports 1Shot for gasless agent transaction relay. The wallet client in chain.ts is configured with a comment showing exactly how to swap in the 1Shot transport.

1Shot relay configuration (swap transport to enable gasless relay):
backend/src/chain.ts

Agent mnemonic-derived wallets that would use 1Shot relay:
backend/src/agentRunner.ts β€” getAgentKey + agentWallet


Core Contracts

AgentRegistry.sol

On-chain discovery layer. Agents self-register with endpoint, capability, and price.

Function Description
register(endpoint, capability, pricePerTask) Agent self-registers
update(endpoint, pricePerTask) Update endpoint or pricing
deactivate() Remove from active pool
findByCapability(capability) Returns all active matching agents

GuildPermissions.sol

ERC-7710-inspired spend permission system.

Function Description
grantPermission(grantee, allowance, duration) Escrows ETH; returns permId
usePermission(permId, recipient, amount) Transfers ETH to recipient
revokePermission(permId) Cancels; returns unspent ETH to granter

TaskCoordinator.sol

Orchestration engine with A2A access control.

Function Description
createTask(description, duration) Escrows budget as ERC-7710 permission
hireAgent(taskId, agent) Coordinator or any active agent; pays via usePermission
completeTask(taskId) Revokes permission; refunds unspent ETH

Development

# Contracts
forge build
forge test -v

# Backend
cd backend && npm install && npm run build && npm start

# Frontend
cd frontend && npm install && npm run dev

Deploy

forge script contracts/script/DeployGuildNet.s.sol:DeployGuildNet \
  --rpc-url base_sepolia \
  --private-key $PRIVATE_KEY \
  --broadcast --verify \
  --etherscan-api-key $BASESCAN_API_KEY

Why GuildNet Wins

Prize Track Evidence
Best Agent / A2A onlyCoordinatorOrAgent β€” agents hire sub-agents on-chain; 1000+ real txs
Best x402 + ERC-7710 Every payment flows through GuildPermissions.usePermission β€” the rail, not an afterthought
Best Venice AI 6 agents each with dedicated Venice system prompts; outputs are live apps, not text
MetaMask Smart Accounts createTask signed from user's smart account via getEthereumProvider()

Feedback

We'd love feedback on:

  • ERC-7710 implementation in GuildPermissions.sol β€” alignment with the spec
  • A2A coordination pattern in TaskCoordinator.sol
  • Venice AI agent system prompts β€” output quality and task routing

Social Media

Follow the build journey on X: @GuildNet)


Future Vision

  • Reputation & staking β€” on-chain task completion history; agents stake ETH to signal quality
  • Streaming payments β€” per-second payment streams replacing lump-sum
  • Agent DAOs β€” guilds with shared treasuries and coordinated pricing
  • Multi-chain registry β€” agents discoverable across EVM chains
  • Mainnet deployment β€” Base mainnet with production Venice AI credits

About

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors