pot_generate
Generate cryptographic Proof of Time for transactions to determine execution order using multiple independent time sources and GRG integrity shards.
Instructions
Generate a Proof of Time for a transaction. Returns potHash, timestamp, stratum, and GRG integrity shards.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| txHash | Yes | Transaction hash (hex with 0x prefix) | |
| chainId | Yes | Chain ID (e.g. 8453 for Base, 84532 for Base Sepolia) | |
| poolAddress | Yes | DEX pool contract address |
Implementation Reference
- tools.ts:43-90 (handler)The handler function `potGenerate` which executes the tool logic to generate proof of time and anchor it.
export async function potGenerate(args: { txHash: string; chainId: number; poolAddress: string; }): Promise<unknown> { telemetryIncrement("pot_generate"); // 1. Synthesize time from multiple NTP/HTTPS sources const pot = await timeSynth.generateProofOfTime(); const potHash = TimeSynthesis.getOnChainHash(pot); // 2. GRG pipeline — encode tx data into integrity shards (black box) const txData = new TextEncoder().encode(args.txHash); const grgShards = GrgPipeline.processForward(txData, args.chainId, args.poolAddress); // 3. Ed25519 sign the PoT hash for non-repudiation const signature = potSigner.signPot(potHash); // 4. Log the anchor const entry: PotAnchorEntry = { potHash, timestamp: pot.timestamp.toString(), stratum: pot.stratum, mode: adaptiveSwitch.getCurrentMode(), chainId: args.chainId, poolAddress: args.poolAddress, createdAt: Date.now(), }; potLog.push(entry); if (potLog.length > POT_LOG_MAX) potLog.shift(); return serialize({ potHash, timestamp: pot.timestamp.toString(), stratum: pot.stratum, uncertainty: pot.uncertainty, confidence: pot.confidence, sources: pot.sources, nonce: pot.nonce, expiresAt: pot.expiresAt.toString(), grgShards: grgShards.map((s: Uint8Array) => Buffer.from(s).toString("hex")), signature: { issuerPubKey: signature.issuerPubKey, signature: signature.signature, issuedAt: signature.issuedAt.toString(), }, }); }