proofgate 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,75 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ *.egg-info/
24
+ .installed.cfg
25
+ *.egg
26
+
27
+ # PyInstaller
28
+ *.manifest
29
+ *.spec
30
+
31
+ # Installer logs
32
+ pip-log.txt
33
+ pip-delete-this-directory.txt
34
+
35
+ # Unit test / coverage reports
36
+ htmlcov/
37
+ .tox/
38
+ .nox/
39
+ .coverage
40
+ .coverage.*
41
+ .cache
42
+ nosetests.xml
43
+ coverage.xml
44
+ *.cover
45
+ *.py,cover
46
+ .hypothesis/
47
+ .pytest_cache/
48
+
49
+ # Translations
50
+ *.mo
51
+ *.pot
52
+
53
+ # Environments
54
+ .env
55
+ .venv
56
+ env/
57
+ venv/
58
+ ENV/
59
+ env.bak/
60
+ venv.bak/
61
+
62
+ # IDEs
63
+ .idea/
64
+ .vscode/
65
+ *.swp
66
+ *.swo
67
+ *~
68
+
69
+ # mypy
70
+ .mypy_cache/
71
+ .dmypy.json
72
+ dmypy.json
73
+
74
+ # Ruff
75
+ .ruff_cache/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 0xCR6
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,248 @@
1
+ Metadata-Version: 2.4
2
+ Name: proofgate
3
+ Version: 0.1.0
4
+ Summary: Official ProofGate SDK — blockchain transaction validation and guardrails for AI agents
5
+ Project-URL: Homepage, https://www.proofgate.xyz
6
+ Project-URL: Documentation, https://www.proofgate.xyz/docs
7
+ Project-URL: Repository, https://github.com/ProofGate/proofgate-python
8
+ Project-URL: Issues, https://github.com/ProofGate/proofgate-python/issues
9
+ Author-email: 0xCR6 <cristian@proofgate.xyz>
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: ai-agent,blockchain,bsc,defi,ethereum,guardrails,proofgate,security,validation,web3
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Security
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Requires-Python: >=3.8
26
+ Requires-Dist: httpx>=0.24.0
27
+ Requires-Dist: pydantic>=2.0.0
28
+ Provides-Extra: dev
29
+ Requires-Dist: black>=23.0.0; extra == 'dev'
30
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
31
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
32
+ Requires-Dist: pytest-httpx>=0.21.0; extra == 'dev'
33
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
34
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
35
+ Description-Content-Type: text/markdown
36
+
37
+ # proofgate
38
+
39
+ > Blockchain guardrails for AI agents. Validate transactions before execution.
40
+
41
+ [![PyPI version](https://badge.fury.io/py/proofgate.svg)](https://pypi.org/project/proofgate/)
42
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
43
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
44
+
45
+ ## What is ProofGate?
46
+
47
+ ProofGate validates blockchain transactions before your AI agent executes them. It prevents:
48
+
49
+ - 🚫 **Wallet drains** from prompt injection attacks
50
+ - 🚫 **Infinite approvals** to malicious contracts
51
+ - 🚫 **Excessive spending** beyond daily limits
52
+ - 🚫 **High slippage** swaps that lose money
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ pip install proofgate
58
+ ```
59
+
60
+ ## Quick Start
61
+
62
+ ### Synchronous Usage
63
+
64
+ ```python
65
+ from proofgate import ProofGate
66
+
67
+ # Initialize client
68
+ pg = ProofGate(api_key="pg_your_api_key") # Get from proofgate.xyz/dashboard
69
+
70
+ # Validate before sending
71
+ result = pg.validate(
72
+ from_address="0xYourAgentWallet",
73
+ to="0xContractAddress",
74
+ data="0xa9059cbb...", # Transaction calldata
75
+ value="0",
76
+ )
77
+
78
+ if result.safe:
79
+ # ✅ Execute the transaction
80
+ wallet.send_transaction(to=to, data=data, value=value)
81
+ else:
82
+ # 🚫 Transaction blocked
83
+ print(f"Blocked: {result.reason}")
84
+ ```
85
+
86
+ ### Async Usage
87
+
88
+ ```python
89
+ from proofgate import AsyncProofGate
90
+
91
+ async def main():
92
+ async with AsyncProofGate(api_key="pg_your_api_key") as pg:
93
+ result = await pg.validate(
94
+ from_address="0xYourAgentWallet",
95
+ to="0xContractAddress",
96
+ data="0xa9059cbb...",
97
+ )
98
+
99
+ if result.safe:
100
+ # Execute transaction
101
+ pass
102
+ ```
103
+
104
+ ## API Reference
105
+
106
+ ### `ProofGate(config)` / `AsyncProofGate(config)`
107
+
108
+ Create a new ProofGate client.
109
+
110
+ ```python
111
+ pg = ProofGate(
112
+ api_key="pg_xxx", # Required: Your API key
113
+ chain_id=56, # Optional: Default chain (56 = BSC)
114
+ guardrail_id="xxx", # Optional: Default guardrail
115
+ base_url="https://...", # Optional: Custom API URL
116
+ timeout=30.0, # Optional: Request timeout (seconds)
117
+ )
118
+ ```
119
+
120
+ ### `pg.validate(request)`
121
+
122
+ Validate a transaction.
123
+
124
+ ```python
125
+ result = pg.validate(
126
+ from_address="0xAgent...",
127
+ to="0xContract...",
128
+ data="0x...",
129
+ value="0", # Optional
130
+ guardrail_id="xxx", # Optional: Override default
131
+ chain_id=56, # Optional: Override default
132
+ )
133
+
134
+ # Returns ValidateResponse with:
135
+ # - validation_id: str
136
+ # - result: "PASS" | "FAIL" | "PENDING"
137
+ # - reason: str
138
+ # - safe: bool
139
+ # - checks: List[ValidationCheck]
140
+ # - authenticated: bool
141
+ # - evidence_uri: str
142
+ ```
143
+
144
+ ### `pg.validate_or_throw(request)`
145
+
146
+ Validate and raise exception if unsafe.
147
+
148
+ ```python
149
+ from proofgate import ProofGateError
150
+
151
+ try:
152
+ pg.validate_or_throw(
153
+ from_address=from_addr,
154
+ to=to_addr,
155
+ data=calldata,
156
+ )
157
+ # Safe to execute
158
+ except ProofGateError as e:
159
+ print(f"Blocked: {e.message}")
160
+ ```
161
+
162
+ ### `pg.check_agent(wallet)`
163
+
164
+ Check an agent's trust score.
165
+
166
+ ```python
167
+ agent = pg.check_agent("0x123...")
168
+
169
+ print(agent.trust_score) # 85
170
+ print(agent.tier) # "gold"
171
+ print(agent.verification_status) # "verified"
172
+ ```
173
+
174
+ ### `pg.get_evidence(validation_id)`
175
+
176
+ Get evidence for a past validation.
177
+
178
+ ```python
179
+ evidence = pg.get_evidence("val_abc123")
180
+ print(evidence.transaction)
181
+ print(evidence.result)
182
+ ```
183
+
184
+ ## Guardrails
185
+
186
+ Guardrails define what your agent can do. Create them at [proofgate.xyz/guardrails](https://www.proofgate.xyz/guardrails).
187
+
188
+ Example guardrail rules:
189
+ - **Whitelist contracts**: Only Uniswap, Aave, Compound
190
+ - **Max approval**: 1,000 USDC per approval
191
+ - **Max slippage**: 1% on swaps
192
+ - **Daily limit**: $10,000 total spending
193
+
194
+ ## Error Handling
195
+
196
+ ```python
197
+ from proofgate import ProofGate, ProofGateError
198
+
199
+ try:
200
+ pg.validate(from_address=from_addr, to=to_addr, data=calldata)
201
+ except ProofGateError as e:
202
+ print(f"Code: {e.code}") # "VALIDATION_FAILED"
203
+ print(f"Message: {e.message}") # "Infinite approval detected"
204
+ print(f"Result: {e.validation_result}")
205
+ ```
206
+
207
+ Error codes:
208
+ - `MISSING_API_KEY` - No API key provided
209
+ - `INVALID_API_KEY` - Key doesn't start with `pg_`
210
+ - `VALIDATION_FAILED` - Transaction failed validation
211
+ - `API_ERROR` - API returned an error
212
+ - `NETWORK_ERROR` - Network request failed
213
+ - `TIMEOUT` - Request timed out
214
+
215
+ ## Type Hints
216
+
217
+ Full type hints included:
218
+
219
+ ```python
220
+ from proofgate import (
221
+ ProofGateConfig,
222
+ ValidateRequest,
223
+ ValidateResponse,
224
+ ValidationCheck,
225
+ AgentCheckResponse,
226
+ EvidenceResponse,
227
+ )
228
+ ```
229
+
230
+ ## Get Your API Key
231
+
232
+ 1. Go to [proofgate.xyz](https://www.proofgate.xyz)
233
+ 2. Connect your wallet
234
+ 3. Register your AI agent
235
+ 4. Copy your API key (starts with `pg_`)
236
+
237
+ **Free tier:** 100 validations/month
238
+
239
+ ## Links
240
+
241
+ - **Website:** [proofgate.xyz](https://www.proofgate.xyz)
242
+ - **Documentation:** [proofgate.xyz/docs](https://www.proofgate.xyz/docs)
243
+ - **Dashboard:** [proofgate.xyz/dashboard](https://www.proofgate.xyz/dashboard)
244
+ - **GitHub:** [github.com/ProofGate/proofgate-python](https://github.com/ProofGate/proofgate-python)
245
+
246
+ ## License
247
+
248
+ MIT © [0xCR6](https://twitter.com/0xCR6)
@@ -0,0 +1,212 @@
1
+ # proofgate
2
+
3
+ > Blockchain guardrails for AI agents. Validate transactions before execution.
4
+
5
+ [![PyPI version](https://badge.fury.io/py/proofgate.svg)](https://pypi.org/project/proofgate/)
6
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+
9
+ ## What is ProofGate?
10
+
11
+ ProofGate validates blockchain transactions before your AI agent executes them. It prevents:
12
+
13
+ - 🚫 **Wallet drains** from prompt injection attacks
14
+ - 🚫 **Infinite approvals** to malicious contracts
15
+ - 🚫 **Excessive spending** beyond daily limits
16
+ - 🚫 **High slippage** swaps that lose money
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install proofgate
22
+ ```
23
+
24
+ ## Quick Start
25
+
26
+ ### Synchronous Usage
27
+
28
+ ```python
29
+ from proofgate import ProofGate
30
+
31
+ # Initialize client
32
+ pg = ProofGate(api_key="pg_your_api_key") # Get from proofgate.xyz/dashboard
33
+
34
+ # Validate before sending
35
+ result = pg.validate(
36
+ from_address="0xYourAgentWallet",
37
+ to="0xContractAddress",
38
+ data="0xa9059cbb...", # Transaction calldata
39
+ value="0",
40
+ )
41
+
42
+ if result.safe:
43
+ # ✅ Execute the transaction
44
+ wallet.send_transaction(to=to, data=data, value=value)
45
+ else:
46
+ # 🚫 Transaction blocked
47
+ print(f"Blocked: {result.reason}")
48
+ ```
49
+
50
+ ### Async Usage
51
+
52
+ ```python
53
+ from proofgate import AsyncProofGate
54
+
55
+ async def main():
56
+ async with AsyncProofGate(api_key="pg_your_api_key") as pg:
57
+ result = await pg.validate(
58
+ from_address="0xYourAgentWallet",
59
+ to="0xContractAddress",
60
+ data="0xa9059cbb...",
61
+ )
62
+
63
+ if result.safe:
64
+ # Execute transaction
65
+ pass
66
+ ```
67
+
68
+ ## API Reference
69
+
70
+ ### `ProofGate(config)` / `AsyncProofGate(config)`
71
+
72
+ Create a new ProofGate client.
73
+
74
+ ```python
75
+ pg = ProofGate(
76
+ api_key="pg_xxx", # Required: Your API key
77
+ chain_id=56, # Optional: Default chain (56 = BSC)
78
+ guardrail_id="xxx", # Optional: Default guardrail
79
+ base_url="https://...", # Optional: Custom API URL
80
+ timeout=30.0, # Optional: Request timeout (seconds)
81
+ )
82
+ ```
83
+
84
+ ### `pg.validate(request)`
85
+
86
+ Validate a transaction.
87
+
88
+ ```python
89
+ result = pg.validate(
90
+ from_address="0xAgent...",
91
+ to="0xContract...",
92
+ data="0x...",
93
+ value="0", # Optional
94
+ guardrail_id="xxx", # Optional: Override default
95
+ chain_id=56, # Optional: Override default
96
+ )
97
+
98
+ # Returns ValidateResponse with:
99
+ # - validation_id: str
100
+ # - result: "PASS" | "FAIL" | "PENDING"
101
+ # - reason: str
102
+ # - safe: bool
103
+ # - checks: List[ValidationCheck]
104
+ # - authenticated: bool
105
+ # - evidence_uri: str
106
+ ```
107
+
108
+ ### `pg.validate_or_throw(request)`
109
+
110
+ Validate and raise exception if unsafe.
111
+
112
+ ```python
113
+ from proofgate import ProofGateError
114
+
115
+ try:
116
+ pg.validate_or_throw(
117
+ from_address=from_addr,
118
+ to=to_addr,
119
+ data=calldata,
120
+ )
121
+ # Safe to execute
122
+ except ProofGateError as e:
123
+ print(f"Blocked: {e.message}")
124
+ ```
125
+
126
+ ### `pg.check_agent(wallet)`
127
+
128
+ Check an agent's trust score.
129
+
130
+ ```python
131
+ agent = pg.check_agent("0x123...")
132
+
133
+ print(agent.trust_score) # 85
134
+ print(agent.tier) # "gold"
135
+ print(agent.verification_status) # "verified"
136
+ ```
137
+
138
+ ### `pg.get_evidence(validation_id)`
139
+
140
+ Get evidence for a past validation.
141
+
142
+ ```python
143
+ evidence = pg.get_evidence("val_abc123")
144
+ print(evidence.transaction)
145
+ print(evidence.result)
146
+ ```
147
+
148
+ ## Guardrails
149
+
150
+ Guardrails define what your agent can do. Create them at [proofgate.xyz/guardrails](https://www.proofgate.xyz/guardrails).
151
+
152
+ Example guardrail rules:
153
+ - **Whitelist contracts**: Only Uniswap, Aave, Compound
154
+ - **Max approval**: 1,000 USDC per approval
155
+ - **Max slippage**: 1% on swaps
156
+ - **Daily limit**: $10,000 total spending
157
+
158
+ ## Error Handling
159
+
160
+ ```python
161
+ from proofgate import ProofGate, ProofGateError
162
+
163
+ try:
164
+ pg.validate(from_address=from_addr, to=to_addr, data=calldata)
165
+ except ProofGateError as e:
166
+ print(f"Code: {e.code}") # "VALIDATION_FAILED"
167
+ print(f"Message: {e.message}") # "Infinite approval detected"
168
+ print(f"Result: {e.validation_result}")
169
+ ```
170
+
171
+ Error codes:
172
+ - `MISSING_API_KEY` - No API key provided
173
+ - `INVALID_API_KEY` - Key doesn't start with `pg_`
174
+ - `VALIDATION_FAILED` - Transaction failed validation
175
+ - `API_ERROR` - API returned an error
176
+ - `NETWORK_ERROR` - Network request failed
177
+ - `TIMEOUT` - Request timed out
178
+
179
+ ## Type Hints
180
+
181
+ Full type hints included:
182
+
183
+ ```python
184
+ from proofgate import (
185
+ ProofGateConfig,
186
+ ValidateRequest,
187
+ ValidateResponse,
188
+ ValidationCheck,
189
+ AgentCheckResponse,
190
+ EvidenceResponse,
191
+ )
192
+ ```
193
+
194
+ ## Get Your API Key
195
+
196
+ 1. Go to [proofgate.xyz](https://www.proofgate.xyz)
197
+ 2. Connect your wallet
198
+ 3. Register your AI agent
199
+ 4. Copy your API key (starts with `pg_`)
200
+
201
+ **Free tier:** 100 validations/month
202
+
203
+ ## Links
204
+
205
+ - **Website:** [proofgate.xyz](https://www.proofgate.xyz)
206
+ - **Documentation:** [proofgate.xyz/docs](https://www.proofgate.xyz/docs)
207
+ - **Dashboard:** [proofgate.xyz/dashboard](https://www.proofgate.xyz/dashboard)
208
+ - **GitHub:** [github.com/ProofGate/proofgate-python](https://github.com/ProofGate/proofgate-python)
209
+
210
+ ## License
211
+
212
+ MIT © [0xCR6](https://twitter.com/0xCR6)
@@ -0,0 +1,51 @@
1
+ """
2
+ ProofGate SDK
3
+
4
+ Blockchain guardrails for AI agents. Validate transactions
5
+ before execution to prevent wallet drains, infinite approvals,
6
+ and other security risks.
7
+
8
+ Example:
9
+ >>> from proofgate import ProofGate
10
+ >>>
11
+ >>> pg = ProofGate(api_key="pg_your_key")
12
+ >>>
13
+ >>> result = await pg.validate(
14
+ ... from_address="0xAgent...",
15
+ ... to="0xContract...",
16
+ ... data="0xa9059cbb...",
17
+ ... )
18
+ >>>
19
+ >>> if result.safe:
20
+ ... # Execute transaction
21
+ ... pass
22
+ ... else:
23
+ ... print(f"Blocked: {result.reason}")
24
+ """
25
+
26
+ from proofgate.client import ProofGate, AsyncProofGate
27
+ from proofgate.types import (
28
+ ProofGateConfig,
29
+ ValidateRequest,
30
+ ValidateResponse,
31
+ ValidationCheck,
32
+ AgentCheckResponse,
33
+ EvidenceResponse,
34
+ UsageResponse,
35
+ )
36
+ from proofgate.exceptions import ProofGateError
37
+
38
+ __all__ = [
39
+ "ProofGate",
40
+ "AsyncProofGate",
41
+ "ProofGateConfig",
42
+ "ValidateRequest",
43
+ "ValidateResponse",
44
+ "ValidationCheck",
45
+ "AgentCheckResponse",
46
+ "EvidenceResponse",
47
+ "UsageResponse",
48
+ "ProofGateError",
49
+ ]
50
+
51
+ __version__ = "0.1.0"