Skip to main content

Create a verification for a Python function

  1. Install the Prado CLI
go install github.com/prado-network/cli/cmd/prado@v0.0.2
NOTE: Make sure to have the Go binaries in your path Then, verify the installation:
prado
  1. Create a file called decision.py. This function takes an input object and decides whether to ALLOW or BLOCK an action based on a risk score.
    # decision.py
    def run(input):
        score = input.get("riskScore", 1.0)
        max_risk = input.get("maxRisk", 0.5)
    
        if score > max_risk:
            return {"action": "BLOCK", "reason": "risk_too_high"}
    
        return {"action": "ALLOW", "metadata": {"riskScore": score}}
    
    This function is deterministic:
    • given the same input
    • it always produces the same output
    This makes it suitable for verification.
  2. Create a file called input.json:
    // input.json
    {
      "riskScore": 0.42,
      "maxRisk": 0.7
    }
    
    This represents the data the system used to make its decision.
  3. Use the Prado CLI to execute the function and generate a receipt:
prado dev execute \
  --runtime python \
  --code decision.py \
  --input input.json \
  --out receipt.json \
  --token 179d36bf-c947-4932-8b56-fc5136473ca1
What happens here:
  • Prado executes the Python function with the given input
  • The input and output are canonicalized and hashed
  • A receipt is generated that commits to:
    • the input
    • the output
    • the runtime used
  1. After execution, a new file called receipt.json is created.
{
    "result": {
        "status": "ok"
    },
    "runtime": {
        "id": "py",
        "version": "1.0.0"
    },
    "specHash": "sha256:8af66cb4f80bed1b90b93a97164383c704b66cd78bb81ec3a4b5f3346d0c0cb1",
    "createdAt": "2026-02-08T16:52:52Z",
    "inputHash": "sha256:fd2bb6c96c34edc80a719c98835cebc2c67f66443fa911da04cc564e99015e56",
    "receiptId": "rcpt_2da10e2d-bdcc-4fcc-be50-9d985b891a48",
    "outputHash": "sha256:a0cbb40a4a2a3123fb4d1db13c3d53f010c45ac1c0fb41d3ca1b784a94d21312",
    "executionId": "exec_3"
}
The receipt does not contain raw data. It contains cryptographic commitments to what was executed.
  1. With this receipt, anyone can later verify that:
    • a Python function was executed
    • with a specific input
    • producing a specific output
    • under a known runtime
    The receipt does not claim:
    • that the decision was correct
    • that the logic is optimal
    It proves what happened, not whether it was right.
  2. Verify the receipt:
prado verify --receipt receipt.json --code decision.py --input input.json
This:
• re-runs the function locally
• recomputes the hashes
• checks that they match the receipt