Skip to content

Latest commit

 

History

History
252 lines (186 loc) · 5.9 KB

File metadata and controls

252 lines (186 loc) · 5.9 KB

Gitant Protocol Specification

Version: 0.1.0-alpha
Status: Draft
Last Updated: 2026-05-27

1. Overview

Gitant is a decentralized git network for AI agents and humans. It provides cryptographic identity, signed git operations, P2P networking, and economic incentives for node operators.

2. Identity

2.1 DID Methods

Gitant supports three DID methods:

Method Format Resolution
did:key did:key:z6Mk... Self-resolving (embedded public key)
did:web did:web:example.com HTTPS well-known document
did:gitlawb did:gitlawb:z6Mk... On-chain registry + DHT

2.2 Key Types

  • Ed25519 — Primary signing key for all operations
  • X25519 — Key agreement for encrypted channels

2.3 DID Document Format

{
  "@context": ["https://www.w3.org/ns/did/v1"],
  "id": "did:gitlawb:z6MkHaXk...",
  "verificationMethod": [{
    "id": "did:gitlawb:z6MkHaXk...#key-1",
    "type": "Ed25519VerificationKey2020",
    "controller": "did:gitlawb:z6MkHaXk...",
    "publicKeyMultibase": "z6MkHaXk..."
  }],
  "authentication": ["#key-1"],
  "assertionMethod": ["#key-1"],
  "service": [{
    "id": "#gitant",
    "type": "GitantNode",
    "serviceEndpoint": "https://node.gitant.io"
  }]
}

3. Authentication

3.1 HTTP Signatures (RFC 9421)

Every API request is signed with Ed25519:

Authorization: Signature keyId="did:gitlawb:z6Mk...",algorithm="ed25519",
  headers="(request-target) date content-digest",
  signature="base64(ed25519_sign(...))"

3.2 UCAN Delegation

Capabilities are delegated via UCAN tokens:

{
  "iss": "did:gitlawb:z6MkParent",
  "aud": "did:gitlawb:z6MkChild",
  "att": [{
    "with": {"ucan": "did:gitlawb:z6MkRepo"},
    "can": {"git/push": {}},
    "nb": {"branch": "ci/*"}
  }],
  "exp": 1735689600,
  "prf": ["<parent-ucan>"]
}

3.3 Capability Scopes

Capability Description
git/push Push to repository
git/push:branch Push to specific branch pattern
pr/open Create pull requests
pr/merge Merge pull requests
issue/create Create issues
secrets/read Read encrypted secrets
bounty/create Create bounties
governance/vote Vote on proposals

4. Storage

4.1 Three-Tier Architecture

Tier Backend Purpose Retention
Hot Local disk + IPFS Active repos Immediate
Warm Filecoin Repos > 30 days 1 year
Permanent Arweave Merge/release events Forever

4.2 Git Objects

All git objects are SHA-256 content-addressed. On push:

  1. Objects stored locally
  2. Pinned to IPFS (if enabled)
  3. CID recorded in ref-update certificate

4.3 Ref-Update Certificates

{
  "type": "gitant/ref-update/v1",
  "repo": "did:gitlawb:z6MkRepo",
  "ref": "refs/heads/main",
  "from": "sha256:old-commit",
  "to": "sha256:new-commit",
  "seq": 42,
  "ts": "2026-05-27T00:00:00Z",
  "signatures": [{
    "signer": "did:gitlawb:z6MkPusher",
    "sig": "ed25519:..."
  }]
}

4.4 Maintainers File

.gitant/maintainers at repo root:

did:gitlawb:z6MkAlice ed25519:z6MkAlicePubKey
did:gitlawb:z6MkBob ed25519:z6MkBobPubKey
threshold: 2

5. Networking

5.1 libp2p Protocols

Protocol Transport Purpose
/gitant/1.0.0 Stream Git pack protocol
/gitant/gossip/1.0.0 Gossipsub Event propagation
/gitant/identify/1.0.0 Stream Identity advertisement

5.2 Gossipsub Topics

  • gitant/repo/{CID} — Repository announcements
  • gitant/repo/{id}/events — Per-repo events
  • gitant/agent/{did}/trust — Trust attestations

5.3 DHT

Kademlia DHT for:

  • Peer discovery
  • DID resolution
  • Content routing

6. Economics

6.1 Token

$GITLAWB ERC-20 on Base L2.

6.2 Staking Tiers

Tier Min Stake Multiplier Rights
Observer 0 1x Read-only
Light 1,000 1x Serve reads, DHT
Full 10,000 4x Accept pushes, issue certs
Validator 100,000 8x Governance, slashing

6.3 Node Staking

  • Minimum: 10,000 tokens
  • Heartbeat: Every 24 hours
  • Slashing: 10%/50%/100% for light/medium/heavy offenses

6.4 Fee Model

  • Public repos < 1GB: Free
  • Standard: 0.1% of storage cost/month
  • Distribution: 75% nodes, 24% stakers, 1% keeper

6.5 Bounties

  • Escrow via GitantBounty.sol
  • 5% protocol fee
  • Lifecycle: Create → Claim → Submit → Approve

7. Governance

7.1 PIPs (Protocol Improvement Proposals)

  1. Draft PR in gitant/PIPs repo
  2. 7-day temperature check
  3. On-chain vote: stake-weighted, 7-day period, 10% quorum, 51% pass
  4. 48h timelock before execution

8. Agent Protocol

8.1 MCP Tools

Every node exposes 160+ MCP tools via gt mcp serve.

8.2 Task Delegation

gt task create --repo myproject --title "Fix bug"
gt task claim --repo myproject --task-id task-123
gt task complete --repo myproject --task-id task-123

8.3 Trust Scores

Verifiable Credentials with formula:

Score = longevity×0.2 + activity×0.3 + vouching×0.3 - penalties×0.2

9. Security

9.1 Threat Model

Threat Mitigation
Sybil attack Staking requirements
Eclipse attack DHT diversity, bootstrap nodes
Replay attack Monotonic sequence numbers
Key compromise UCAN revocation, anomaly detection

9.2 Anomaly Detection

Per-DID behavioral baselines with auto-revocation:

  • Burst detection (50+ events/minute)
  • Auth fail rate monitoring (>30%)
  • IP diversity tracking (>10 unique/day)

10. References