Official ProofGate SDK — blockchain transaction validation and guardrails for AI agents
Project description
proofgate
Blockchain guardrails for AI agents. Validate transactions before execution.
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 providedINVALID_API_KEY- Key doesn't start withpg_VALIDATION_FAILED- Transaction failed validationAPI_ERROR- API returned an errorNETWORK_ERROR- Network request failedTIMEOUT- Request timed out
Type Hints
Full type hints included:
from proofgate import (
ProofGateConfig,
ValidateRequest,
ValidateResponse,
ValidationCheck,
AgentCheckResponse,
EvidenceResponse,
)
Get Your API Key
- Go to proofgate.xyz
- Connect your wallet
- Register your AI agent
- Copy your API key (starts with
pg_)
Free tier: 100 validations/month
Links
- Website: proofgate.xyz
- Documentation: proofgate.xyz/docs
- Dashboard: proofgate.xyz/dashboard
- GitHub: github.com/ProofGate/proofgate-python
License
MIT © 0xCR6
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file proofgate-0.1.1.tar.gz.
File metadata
- Download URL: proofgate-0.1.1.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9d83645a90b8bf2c21631cace0d04425f97fcb6df28c0c1f83c98772bfdbd31
|
|
| MD5 |
d496008f50083f06ba6ca3785a7f1995
|
|
| BLAKE2b-256 |
2c75a638a2ba1f432ed3e59c4b7934fefa9fbd1c52b923377936b52325bee55e
|
File details
Details for the file proofgate-0.1.1-py3-none-any.whl.
File metadata
- Download URL: proofgate-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28d23ebde13ce5b8a223fd019f8f8e2fb4a21425186f072b9d50f322d8025c34
|
|
| MD5 |
dc89e6253b85e4f3e89be496ed004ac3
|
|
| BLAKE2b-256 |
c3a31236d20223837dc173951e328e9589c4f216ed46f5d3c60b1b1b45c1886f
|