Version: 3.4
Status: Public Specification
License: Apache 2.0
Transaction Gateway Protocol (TGP) is an economic routing and settlement coordination protocol for blockchain transactions. It enables buyers, merchants, and settlement providers to coordinate safe, non-custodial transactions across trust boundaries without requiring direct relationships or shared custody of funds.
TGP defines how parties express transaction intent, verify authenticity, negotiate terms, and coordinate settlement—while maintaining transaction boundary isolation and split visibility between participants.
- Not a wallet — TGP works with existing wallets
- Not a blockchain — TGP is chain-agnostic and operates at the application layer
- Not a token — TGP is a messaging protocol, not a cryptocurrency
- Not custodial — Funds remain in user control until final settlement
- Not zero-knowledge by default — Privacy extensions are strictly optional
Each party sees only the information necessary for their role in the transaction. Buyers, merchants, and settlement providers operate within isolated transaction boundaries.
No single party has complete visibility into all transaction details. Transaction identifiers are not shared across boundaries to prevent correlation.
Gateways coordinate transaction execution without ever controlling user keys or funds. Settlement is enforced by on-chain contracts, not trusted intermediaries.
TGP is designed to minimize custody risk. Gateways verify and route transactions but cannot unilaterally move funds.
The base specification defines:
- Message types (QUERY, ACK, SETTLE, WITHDRAW)
- State transitions and validation rules
- Settlement coordination semantics
- WebSocket transport layer
- Signature schemes and replay protection
All implementations MUST support the base protocol.
An optional extension that adds zero-knowledge proof verification for enhanced privacy:
buyer_commitmentfield (Poseidon hash commitment)zk_prooffield (Groth16 proof structure)- On-chain verification semantics
Zero-knowledge functionality is strictly optional. Base protocol implementations are fully compliant without ZK support. ZK fields are invalid in base protocol messages unless the extension is explicitly declared.
/specs
├── TGP-00-v3.4-README.md # Overview and navigation
├── TGP-00-v3.4-Part1.md # Core Protocol & Transport
├── TGP-00-v3.4-Part2.md # Economic Messages & Preview Layer
├── TGP-00-v3.4-Part3.md # Implementation & Security
├── TGP-00-v3.4-ZK.md # Zero-knowledge extension (optional)
├── TGP-EXT-00.md # Extension rules & philosophy
├── TGP-GLOSSARY.md # Term definitions
└── TGP-CHANGELOG.md # Version history
/diagrams
└── (protocol flow diagrams)
/examples
├── query.json # Transaction query example
├── settle.json # Settlement request example
└── (other message examples)
CONTRIBUTING.md # How to contribute
README.md # This file
LICENSE # Apache 2.0
TGP operates as a "Layer 8" economic control plane—above traditional network layers but below application business logic. It provides transaction routing, policy evaluation, and settlement coordination without modifying wallet behavior.
Transactions are evaluated by gateways that verify:
- Merchant authenticity and registry membership
- Transaction structure and validity
- Policy compliance (amount limits, jurisdictional rules, etc.)
- Settlement contract state and eligibility
Gateways return executable transaction envelopes that wallets sign and submit.
TGP achieves privacy by separating transaction visibility:
- Buyers see merchant identity but not settlement details
- Merchants see payment confirmation but not buyer wallet addresses
- Settlement providers see on-chain state but not buyer-merchant relationship
- No shared transaction identifiers across boundaries
For enhanced privacy, buyers can optionally include zero-knowledge proofs that cryptographically prove intent without revealing:
- Wallet addresses
- Transaction amounts
- Nonce values
This extension is backward-compatible and opt-in per transaction.
- Start with TGP-00 v3.4 for the base protocol
- Review TGP-GLOSSARY.md for terminology
- Check TGP-00-v3.4-ZK.md if implementing privacy features
- See TGP-EXT-00.md for extension design philosophy
TGP is designed to be implemented independently by:
- Wallets and agents (clients) — Sign messages, manage previews, interact with users
- Routing and coordination services (gateways) — Validate messages, generate previews, coordinate settlement
- Settlement and escrow smart contracts — Hold funds, enforce rules, execute withdrawals
See /implementations for reference designs and code examples.
-
For Client Developers:
- Read Client Reference
- Implement EIP-712 message signing
- Add preview hash storage
- Handle WebSocket communication
-
For Gateway Developers:
- Read Gateway Reference
- Implement signature verification
- Add preview generation
- Build routing and validation pipeline
-
For Contract Developers:
- Read Escrow Reference
- Deploy settlement contracts
- Add preview binding (recommended)
- Implement withdrawal logic
The /examples directory contains annotated JSON message examples showing:
- Basic transaction queries
- Settlement coordination flows
- Optional ZK extension usage
- GitHub Discussions: Protocol design and implementation questions
- Telegram: [TGP Contributors Group] (coming soon)
- Issues: Bug reports and specification clarifications
Merchants can accept blockchain payments without exposing customer wallet addresses or revealing their own settlement infrastructure.
Coordinate multi-chain transactions with atomic settlement guarantees, enabling buyers and merchants on different networks to transact safely.
Gateways can enforce jurisdiction-specific rules, amount limits, and compliance requirements without requiring changes to wallet software.
Autonomous agents can use TGP to negotiate and execute payments on behalf of users, with cryptographic guarantees preventing unauthorized spending.
- Wallet developers adding commerce capabilities
- Payment gateway operators
- RPC providers offering value-added services
- Settlement network operators
- E-commerce platforms requiring blockchain payments
- Autonomous agent platforms
- Cross-border payment services
- Decentralized marketplaces
- Privacy protocol designers
- Economic mechanism designers
- Distributed systems researchers
1. QUERY → Buyer expresses transaction intent to gateway
2. ACK → Gateway returns authorization (offer/allow/deny/revise)
3. SETTLE → Buyer submits signed transaction for settlement
4. ACK → Gateway confirms on-chain settlement
Transactions progress through defined states:
PENDING— Initial query receivedOFFERED— Gateway provides previewALLOWED— Executable envelope providedSETTLING— Transaction submitted to blockchainSETTLED— On-chain confirmation receivedCOMPLETE— Full protocol flow finished
Every transaction passes through deterministic verification:
- Registry Validation — Merchant authenticity
- Cryptographic Validation — Signatures and proofs
- Contract Integrity — Bytecode and state verification
- Policy Evaluation — Business rules and limits
- Settlement Eligibility — On-chain state checks
- Non-Custodial Operation: Gateways cannot seize or move user funds
- Deterministic Evaluation: Same inputs always produce same outputs
- Replay Protection: Nonces and timestamps prevent replay attacks
- Signature Verification: All messages cryptographically authenticated
- State Binding: Transactions bind to specific contract states
- Anonymity: Base protocol reveals transaction existence (use ZK extension for privacy)
- Censorship Resistance: Gateways can reject transactions per policy
- Finality: Settlement depends on underlying blockchain finality
- Regulatory Compliance: Implementers must ensure local compliance
TGP can be triggered by HTTP 402 responses or x402 events but operates independently. x402 provides negotiation transport; TGP provides settlement coordination.
TGP settlement often uses EIP-2612 permit signatures for gasless approvals, but the protocol is not dependent on any specific approval mechanism.
TGP uses WebSocket for real-time bidirectional communication but could be adapted to other transports (HTTP long-polling, gRPC, etc.).
We welcome contributions from the community! See CONTRIBUTING.md for:
- How to propose specification changes
- PR format requirements
- Discussion guidelines
- What changes require version bumps
Please Note: TGP is designed as a neutral, implementation-agnostic protocol. Contributions should focus on protocol clarity, not implementation details or chain-specific optimizations.
This specification is licensed under the Apache License 2.0. See LICENSE for full terms.
Code implementations may have different licenses. This repository contains only specification documents.
TGP is maintained as an open protocol with community governance:
- Specification changes follow public review process
- Breaking changes require major version increments
- Backward compatibility is prioritized
- Multiple implementations encouraged
TGP builds on research and development in:
- Trust-minimized exchange protocols
- Zero-knowledge proof systems
- Blockchain settlement mechanisms
- Economic protocol design
The protocol is designed to be implementation-agnostic and vendor-neutral.
- GitHub Issues: Technical questions and bug reports
- GitHub Discussions: Design discussions and proposals
- Email: [To be determined]
Transaction Gateway Protocol is an open standard for blockchain commerce coordination. It enables private, non-custodial transactions across trust boundaries.