Skip to main content
Glama

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
NameRequiredDescriptionDefault
txHashYesTransaction hash (hex with 0x prefix)
chainIdYesChain ID (e.g. 8453 for Base, 84532 for Base Sepolia)
poolAddressYesDEX 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(),
        },
      });
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Helm-Protocol/openttt-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server