{
  "id": "merkle-bundle-compose",
  "name": "Count-bound Merkle artifact bundle",
  "description": "Compose a local SHA-256 Merkle content commitment binding exact IDs, bytes and item count, plus selected shape-aware inclusion paths. This is consistency with a separately trusted root, not identity, signature, authenticity, confidentiality, completeness, timestamp or file-safety verification.",
  "category": "structured",
  "priceUsd": "0.005",
  "pricingStatus": "proposed-unverified",
  "pricing": {
    "unit": "one successful operation call",
    "proposedNominalUsd": "0.005",
    "sixDecimalTokenBaseUnits": "5000",
    "subscription": false,
    "includesPayerWalletOrNetworkFees": false,
    "liveQuoteVerified": false,
    "condition": "Actual SDK challenge is authoritative only within the caller's explicit authorization; configured six-decimal token peg is an operator assertion, not a conversion guarantee."
  },
  "intents": [
    "Commit an artifact bundle to one count-bound content root",
    "Produce selective inclusion proofs for supplied artifact bytes"
  ],
  "whenToUse": [
    "Hand off one supplied artifact and its logarithmic inclusion path without resending the full bundle"
  ],
  "whenNotToUse": [
    "Signatures, certificate transparency, blockchain protocol compatibility, append-only proofs or trusted root distribution",
    "Authentication, identity, confidentiality, timestamping, safety or complete-item-list verification",
    "Executing code, writing files, environment changes, network requests, publishing or deployment"
  ],
  "capabilities": [
    "Domain bytes 00 for framed leaves, 01 for internal pairs and 02 for count-bound public root",
    "Exact UTF-16 ID sorting; canonical base64 and UTF-8 equivalence",
    "Greatest-power-of-two split without leaf duplication; cached tree, bottom-up sibling orientation",
    "Verifier must validate index, count and exact expected proof shape; hashes do not anonymize low-entropy content",
    "Complete bounded computation before payment challenge and execution; externalRequests=0"
  ],
  "limits": {
    "inputBytes": 100000,
    "outputBytes": 400000,
    "jsonNodes": 12000,
    "depth": 20,
    "items": 128,
    "proofs": 128,
    "idUnits": 100,
    "decodedBytes": 60000,
    "treeNodes": 255,
    "hashCalls": 256,
    "proofSiblings": 7
  },
  "related": [
    "content-digest",
    "artifact-manifest-check",
    "zip-store-compose"
  ],
  "errorCodes": [
    "INPUT_LIMIT",
    "OUTPUT_LIMIT",
    "COMPLEXITY_LIMIT",
    "INVALID_JSON",
    "INVALID_NUMBER",
    "INVALID_UNICODE",
    "UNSAFE_KEY",
    "INVALID_BASE64",
    "DUPLICATE_ID",
    "DUPLICATE_PROOF_ID",
    "UNKNOWN_PROOF_ID",
    "PAYLOAD_LIMIT"
  ],
  "requirementsProfile": {
    "format": "declared-requirements-v1",
    "facts": {
      "execution.suppliedCode": false,
      "execution.remoteMutation": false,
      "execution.llmInference": false,
      "execution.paidMcp": false,
      "verification.semanticTruth": false,
      "verification.sourceAuthenticity": false,
      "verification.liveVulnerabilities": false,
      "numbers.arbitraryPrecisionJson": false,
      "numbers.model": "ieee754-binary64",
      "privacy.requestBodyPersisted": false,
      "execution.deterministic": true,
      "execution.networkAccess": false,
      "privacy.resultBodyPersisted": false,
      "payment.x402": true,
      "payment.mpp": true,
      "operation.id": "merkle-bundle-compose",
      "operation.category": "structured",
      "limit.httpRequestBytes": 131072,
      "limit.requestBytes": 100000,
      "limit.responseBytes": 524288,
      "limit.resultBytes": 400000,
      "limit.jsonDepth": 20,
      "limit.jsonNodes": 12000,
      "merkle.profile": "id-bytes-merkle-sha256-v1",
      "merkle.maxItems": 128,
      "merkle.maxDecodedBytes": 60000,
      "merkle.maxProofs": 128,
      "merkle.maxSiblingsPerProof": 7,
      "merkle.algorithm": "sha256",
      "merkle.leafBindsIdAndBytes": true,
      "merkle.rootBindsItemCount": true,
      "merkle.order": "exact-utf16-item-id",
      "merkle.signature": false,
      "merkle.sourceAuthenticity": false,
      "merkle.trustedRootDistribution": false,
      "merkle.appendOnlyConsistency": false,
      "merkle.safetyVerified": false,
      "merkle.completeInventoryVerified": false,
      "merkle.hashAnonymizesContent": false,
      "input.items.maxItems": 128,
      "input.items.minItems": 1,
      "input.proofIds.maxItems": 128
    },
    "unknownPolicy": "Undeclared requirements are unknown, never compatible. Matching declared facts does not establish semantic fit or input validity.",
    "preflight": "/preflight"
  },
  "documentation": "/reference/tools/merkle-bundle-compose.md",
  "serviceContract": "/reference/services/merkle-bundle-compose.json",
  "errors": [
    {
      "status": 400,
      "meaning": "Malformed JSON, missing/invalid idempotency key, or payment identifier mismatch",
      "retry": "Correct the request before payment"
    },
    {
      "status": 402,
      "meaning": "Payment challenge or rejected payment",
      "retry": "Use official protocol SDK; inspect payment outcome before another payment"
    },
    {
      "status": 409,
      "meaning": "Idempotency conflict, duplicate proof, or PAYMENT_UNCERTAIN",
      "retry": "Keep original key, body, and proof; reconcile uncertainty with operator; never blindly repay"
    },
    {
      "status": 413,
      "meaning": "Input or generated output too large",
      "retry": "Reduce input; no payment attempted for validation failure"
    },
    {
      "status": 415,
      "meaning": "Unsupported media type or compression",
      "retry": "Send uncompressed application/json"
    },
    {
      "status": 422,
      "meaning": "Schema or service-specific semantic validation failure",
      "retry": "Correct input using returned error code; no payment attempted"
    },
    {
      "status": 429,
      "meaning": "Request/payment-attempt rate exceeded",
      "retry": "Wait for rate limit window; preserve existing payment identity"
    },
    {
      "status": 503,
      "meaning": "Payment configuration/provider/state unavailable, or live DNS preparation failed before settlement",
      "retry": "Check readiness; DNS preparation failures may retry the identical key/body/credential only; uncertainty requires reconciliation"
    }
  ],
  "numericPrecision": "JavaScript IEEE-754 numbers; use strings for large integer IDs/exact decimals where the schema accepts strings. No lossless numeric parsing.",
  "paymentWorkflow": {
    "discoveryOnly": false,
    "supportedProtocols": [
      "x402",
      "mpp"
    ],
    "x402": {
      "credentialHeader": "PAYMENT-SIGNATURE",
      "challengeHeader": "PAYMENT-REQUIRED",
      "receiptHeader": "PAYMENT-RESPONSE",
      "version": 2,
      "scheme": "exact",
      "paymentIdentifier": "payment-identifier extension MUST equal the HTTP Idempotency-Key",
      "sdk": "@x402/core with @x402/evm"
    },
    "mpp": {
      "supported": true,
      "credentialHeader": "Authorization",
      "challengeHeader": "WWW-Authenticate",
      "receiptHeader": "Payment-Receipt",
      "method": "tempo",
      "intent": "charge",
      "sdk": "mppx",
      "tokenDecimals": 6
    },
    "steps": [
      "Check configured readiness and the exact service schema",
      "Generate a fresh random Idempotency-Key for this operation; never use a discovery probe fixture for purchases",
      "Send valid input without a credential to obtain the official protocol challenge",
      "Use the official SDK and authorized wallet to fulfill the challenge",
      "Retry only with identical key, body, protocol and credential",
      "On PAYMENT_UNCERTAIN stop and request operator reconciliation; never blindly pay again"
    ],
    "versionedRetries": "Request fingerprint includes service release version. Retries across a version upgrade can conflict; coordinate upgrades outside the 24-hour replay window and reconcile pending attempts.",
    "docs": "/llms.txt"
  },
  "method": "POST",
  "paths": {
    "x402": "/v1/x402/merkle-bundle-compose",
    "mpp": "/v1/mpp/merkle-bundle-compose"
  },
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "items": {
        "minItems": 1,
        "maxItems": 128,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "encoding": {
              "type": "string",
              "enum": [
                "utf8",
                "base64"
              ]
            },
            "data": {
              "type": "string",
              "maxLength": 90000
            }
          },
          "required": [
            "id",
            "encoding",
            "data"
          ],
          "additionalProperties": false
        }
      },
      "proofIds": {
        "maxItems": 128,
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        }
      }
    },
    "required": [
      "items",
      "proofIds"
    ],
    "additionalProperties": false
  },
  "outputSchema": {
    "type": "object",
    "required": [
      "operation",
      "version",
      "result",
      "provenance"
    ],
    "properties": {
      "operation": {
        "const": "merkle-bundle-compose",
        "type": "string"
      },
      "version": {
        "const": "0.29.0",
        "type": "string"
      },
      "result": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "profile": {
            "type": "string",
            "const": "id-bytes-merkle-sha256-v1"
          },
          "root": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "treeHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "itemCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 128
          },
          "manifest": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100
                },
                "index": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "byteLength": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "leafHash": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                }
              },
              "required": [
                "id",
                "index",
                "byteLength",
                "leafHash"
              ],
              "additionalProperties": false
            }
          },
          "proofs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100
                },
                "index": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "itemCount": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 128
                },
                "siblings": {
                  "maxItems": 7,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "side": {
                        "type": "string",
                        "enum": [
                          "left",
                          "right"
                        ]
                      },
                      "hash": {
                        "type": "string",
                        "pattern": "^[a-f0-9]{64}$"
                      }
                    },
                    "required": [
                      "side",
                      "hash"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "id",
                "index",
                "itemCount",
                "siblings"
              ],
              "additionalProperties": false
            }
          },
          "externalRequests": {
            "type": "number",
            "const": 0
          },
          "authenticityVerified": {
            "type": "boolean",
            "const": false
          }
        },
        "required": [
          "profile",
          "root",
          "treeHash",
          "itemCount",
          "manifest",
          "proofs",
          "externalRequests",
          "authenticityVerified"
        ],
        "additionalProperties": false
      },
      "provenance": {
        "type": "object",
        "required": [
          "inputSha256",
          "outputSha256",
          "deterministic",
          "externalRequests"
        ],
        "properties": {
          "inputSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "outputSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "deterministic": {
            "const": true
          },
          "externalRequests": {
            "const": 0
          }
        }
      }
    },
    "additionalProperties": false
  },
  "exampleInput": {
    "items": [
      {
        "id": "a",
        "encoding": "utf8",
        "data": "A"
      },
      {
        "id": "b",
        "encoding": "utf8",
        "data": "B"
      },
      {
        "id": "c",
        "encoding": "base64",
        "data": "AP8="
      }
    ],
    "proofIds": [
      "a"
    ]
  },
  "exampleResponse": {
    "operation": "merkle-bundle-compose",
    "version": "0.29.0",
    "result": {
      "profile": "id-bytes-merkle-sha256-v1",
      "root": "4f60c66aed8c8da2fe90771108c10a02951b380ab0c0e5b515c619cc0a8f1d9d",
      "treeHash": "d85a25d6b37e6f85dd8eee6489845d06e42c8df14567ca344a8bd833524c6c03",
      "itemCount": 3,
      "manifest": [
        {
          "id": "a",
          "index": 0,
          "byteLength": 1,
          "leafHash": "728d8462eee330125f9b80cc67dabc50d2b19be470f4e0db6dae1db8479fd68e"
        },
        {
          "id": "b",
          "index": 1,
          "byteLength": 1,
          "leafHash": "0b17a04d58081b5d3fbbf2b58e132ca9857cb7a806d8b6590df3c498a4e717e3"
        },
        {
          "id": "c",
          "index": 2,
          "byteLength": 2,
          "leafHash": "896c085e5286e008c46dc1219c9508f2f575f0dd667a48af63f8efdcda36fc31"
        }
      ],
      "proofs": [
        {
          "id": "a",
          "index": 0,
          "itemCount": 3,
          "siblings": [
            {
              "side": "right",
              "hash": "0b17a04d58081b5d3fbbf2b58e132ca9857cb7a806d8b6590df3c498a4e717e3"
            },
            {
              "side": "right",
              "hash": "896c085e5286e008c46dc1219c9508f2f575f0dd667a48af63f8efdcda36fc31"
            }
          ]
        }
      ],
      "externalRequests": 0,
      "authenticityVerified": false
    },
    "provenance": {
      "inputSha256": "589ef52b234d843c25226c2fcfa453e7a2980ec2b03514bb6c26acdf277db550",
      "outputSha256": "5d213c82d85b14afdd8492030f41aae579136720b2567ff6fb1577714478bca4",
      "deterministic": true,
      "externalRequests": 0
    }
  },
  "requiredHeaders": {
    "Content-Type": "application/json",
    "Idempotency-Key": "random 16–128 character operation identifier"
  },
  "fixedExample": "/reference/examples/merkle-bundle-compose.json",
  "execution": {
    "deterministic": true,
    "externalRequests": 0,
    "maxExternalRequests": 0,
    "resultSnapshotPersisted": false,
    "fixedExampleIsIllustrativeSnapshot": false,
    "requiresPayment": true,
    "supportsMcpExecution": false
  },
  "releaseSnapshot": {
    "format": "static-release-reference-v1",
    "sourceVersion": "0.29.0",
    "sourceRegistrySha256": "a2b5ec09bf6c38b9d2879d746a4fded374f5928b445377b0270ef6aa8e6cac65",
    "generatedAt": "2026-10-06T15:38:00Z",
    "releaseAcceptance": "not-verified-by-generator",
    "runtimeReadiness": "not-evaluated",
    "livePaymentsVerified": false,
    "indexingVerified": false,
    "apiOrigin": null,
    "notice": "Build-time release reference. Runtime readiness, deployment, payment settlement and external indexing are not evaluated here. Prices are proposed; this file cannot authorize execution or payment."
  }
}
