Skip to main content

proofgate

Blockchain guardrails for AI agents. Validate transactions before execution.

PyPI version Python 3.8+ License: MIT

What is ProofGate?

ProofGate validates blockchain transactions before your AI agent executes them. It prevents:

  • 🚫 Wallet drains from prompt injection attacks
  • 🚫 Infinite approvals to malicious contracts
  • 🚫 Excessive spending beyond daily limits
  • 🚫 High slippage swaps that lose money

Installation

pip install proofgate

Quick Start

Synchronous Usage

from proofgate import ProofGate

# Initialize client
pg = ProofGate(api_key="pg_your_api_key")  # Get from proofgate.xyz/dashboard

# Validate before sending
result = pg.validate(
    from_address="0xYourAgentWallet",
    to="0xContractAddress",
    data="0xa9059cbb...",  # Transaction calldata
    value="0",
)

if result.safe:
    # ✅ Execute the transaction
    wallet.send_transaction(to=to, data=data, value=value)
else:
    # 🚫 Transaction blocked
    print(f"Blocked: {result.reason}")

Async Usage

from proofgate import AsyncProofGate

async def main():
    async with AsyncProofGate(api_key="pg_your_api_key") as pg:
        result = await pg.validate(
            from_address="0xYourAgentWallet",
            to="0xContractAddress",
            data="0xa9059cbb...",
        )
        
        if result.safe:
            # Execute transaction
            pass

API Reference

ProofGate(config) / AsyncProofGate(config)

Create a new ProofGate client.

pg = ProofGate(
    api_key="pg_xxx",           # Required: Your API key
    chain_id=56,                 # Optional: Default chain (56 = BSC)
    guardrail_id="xxx",          # Optional: Default guardrail
    base_url="https://...",      # Optional: Custom API URL
    timeout=30.0,                # Optional: Request timeout (seconds)
)

pg.validate(request)

Validate a transaction.

result = pg.validate(
    from_address="0xAgent...",
    to="0xContract...",
    data="0x...",
    value="0",           # Optional
    guardrail_id="xxx",  # Optional: Override default
    chain_id=56,         # Optional: Override default
)

# Returns ValidateResponse with:
# - validation_id: str
# - result: "PASS" | "FAIL" | "PENDING"
# - reason: str
# - safe: bool
# - checks: List[ValidationCheck]
# - authenticated: bool
# - evidence_uri: str

pg.validate_or_throw(request)

Validate and raise exception if unsafe.

from proofgate import ProofGateError

try:
    pg.validate_or_throw(
        from_address=from_addr,
        to=to_addr,
        data=calldata,
    )
    # Safe to execute
except ProofGateError as e:
    print(f"Blocked: {e.message}")

pg.check_agent(wallet)

Check an agent's trust score.

agent = pg.check_agent("0x123...")

print(agent.trust_score)         # 85
print(agent.tier)                # "gold"
print(agent.verification_status) # "verified"

pg.get_evidence(validation_id)

Get evidence for a past validation.

evidence = pg.get_evidence("val_abc123")
print(evidence.transaction)
print(evidence.result)

Guardrails

Guardrails define what your agent can do. Create them at proofgate.xyz/guardrails.

Example guardrail rules:

  • Whitelist contracts: Only Uniswap, Aave, Compound
  • Max approval: 1,000 USDC per approval
  • Max slippage: 1% on swaps
  • Daily limit: $10,000 total spending

Error Handling

from proofgate import ProofGate, ProofGateError

try:
    pg.validate(from_address=from_addr, to=to_addr, data=calldata)
except ProofGateError as e:
    print(f"Code: {e.code}")          # "VALIDATION_FAILED"
    print(f"Message: {e.message}")    # "Infinite approval detected"
    print(f"Result: {e.validation_result}")

Error codes:

  • MISSING_API_KEY - No API key provided
  • INVALID_API_KEY - Key doesn't start with pg_
  • VALIDATION_FAILED - Transaction failed validation
  • API_ERROR - API returned an error
  • NETWORK_ERROR - Network request failed
  • TIMEOUT - Request timed out

Type Hints

Full type hints included:

from proofgate import (
    ProofGateConfig,
    ValidateRequest,
    ValidateResponse,
    ValidationCheck,
    AgentCheckResponse,
    EvidenceResponse,
)

Get Your API Key

  1. Go to proofgate.xyz
  2. Connect your wallet
  3. Register your AI agent
  4. Copy your API key (starts with pg_)

Free tier: 100 validations/month

Links

License

MIT © 0xCR6

Metadata

Release files for proofgate 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for proofgate 0.1.1
File Size Uploaded
proofgate-0.1.1.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for proofgate 0.1.1
File Interpreter ABI Platform
proofgate-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 18.0 kB

Release files / proofgate-0.1.1.tar.gz

Download URL proofgate-0.1.1.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b9d83645a90b8bf2c21631cace0d04425f97fcb6df28c0c1f83c98772bfdbd31
BLAKE2b-256 checksum
How to use checksums
2c75a638a2ba1f432ed3e59c4b7934fefa9fbd1c52b923377936b52325bee55e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / proofgate-0.1.1-py3-none-any.whl

Download URL proofgate-0.1.1-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28d23ebde13ce5b8a223fd019f8f8e2fb4a21425186f072b9d50f322d8025c34
BLAKE2b-256 checksum
How to use checksums
c3a31236d20223837dc173951e328e9589c4f216ed46f5d3c60b1b1b45c1886f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page